• Stars
    star
    435
  • Rank 100,085 (Top 2 %)
  • Language
    JavaScript
  • Created about 7 years ago
  • Updated over 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Renders markdown files to HTML with highlighted code blocks BUT ALSO RENDERS THE JAVASCRIPT ONES.

Render Markdown JavaScript

Renders markdown files to HTML with highlighted code blocks BUT ALSO RENDERS THE JAVASCRIPT ONES.

screenshot

Why?

I've got a bunch of little JavaScript UI libs that don't need much more than a README.md for documentation, but a demo is worth a thousand README.md's, so I'd like the code in the README.md to actually render in a browser. Also great so people can copy/paste from the docs and know that it runs.

How?

Write normal markdown but for code fence blocks you want to have render in the browser also, use the "render" or "render-babel" language. Github markdown hates code fenced blocks inside of code fenced blocks, so I don't have an example here, look at the demo.md

How do I get JavaScript and CSS onto the page?

With <script>, <link>, and <style> of course.

<script src="https://unpkg.com/[email protected]/dist/react.js"></script>
<script src="https://unpkg.com/[email protected]/dist/react-dom.js"></script>
<link rel="stylesheet" type="text/css" href="https://unpkg.com/[email protected]/build/pure-min.css"/>
<style>body { color: red }</style>

# Then markdown as usual...

You can place your scripts at the bottom of the markdown file to prevent blocking your content from rendering, all scripts are run after DOMContentLoaded.

Also check out the demo.md file from the screenshot.

Does it babel?

Yes, first include babel standalone at the top of your markdown file and then use the render-babel language instead of render. Again, github hates code fence blocks inside code fence blocks here so I can't really show you in this README. Check out the demo

How Do I Attach Stuff to the DOM?

There will be a variable called DOM_NODE available to use, its the node for just that script.

CLI Usage

npm install render-markdown-js
render-markdown-js ./some-file.md > output.html

Node API Usage

const rmj = require('render-markdown-js')
const html = rmj('#string of markdown')

Options

There are none. Copy, paste, tweak.

Enjoy!

Please enjoy!

More Repositories

1

react-training

Mini React Training Course
JavaScript
1,012
star
2

ember-tools

Generators and build tools for Ember applications
JavaScript
875
star
3

async-props

Co-located data loading for React Router
JavaScript
566
star
4

example-react-router-server-rendering-lazy-routes

JavaScript
559
star
5

react-router-mega-demo

WIP Move Along
JavaScript
471
star
6

react-magic-move

JavaScript
447
star
7

reactconf-2015-HYPE

JavaScript
348
star
8

react-lumberjack

Logging setState for React
JavaScript
279
star
9

snack

A tiny, cross-browser, JavaScript library.
JavaScript
245
star
10

gatsby-source-firebase

Gatsby plugin to turn Firebase into a Gatsby data source.
JavaScript
149
star
11

github-plusone-extension

JavaScript
124
star
12

react-title-component

Nested document title management for React.js
JavaScript
121
star
13

SlideShow

Extensible mid-level MooTools slideshow class that manages transitions of elements that share the same space, typically for slideshows, tabs, and galleries.
JavaScript
106
star
14

remix-planner

TypeScript
95
star
15

loom

Weave your wefts betwixt the warps of loom generators and scaffolds
JavaScript
92
star
16

react-router-relative-links

JavaScript
77
star
17

react-router-restore-scroll

JavaScript
75
star
18

jquery-rf-slideshow

Super flexible, low-level jQuery slideshow built on the jquery.widget system
JavaScript
61
star
19

CSSAnimation

CSS Transitions and Transforms with JavaScript
JavaScript
60
star
20

non-trivial-js

An example on how to build and structure a non-trivial JavaScript application.
JavaScript
60
star
21

moo4q

MooTools Object Oriented Classes for jQuery
JavaScript
57
star
22

advanced-react-workshop

JavaScript
51
star
23

firebase-schema

Schema for your Firebase
JavaScript
44
star
24

jsconf2014

JavaScript
41
star
25

react-router-apply-middleware

Composable middleware for React Router
JavaScript
40
star
26

limescripts

LimeChat JavaScript
JavaScript
40
star
27

publisher.js

Publish / Subscribe for JavaScript
JavaScript
36
star
28

react-clone

Declarative element cloning for React.js
JavaScript
33
star
29

webpack-node-demo

Tiny boilerplate to run a node app through webpack first
JavaScript
27
star
30

react-router-named-routes

Finally, they're back!
25
star
31

create-container

Simple application container
JavaScript
25
star
32

react-router-contacts

JavaScript
22
star
33

rf-changelog

create changelogs for git repos
JavaScript
21
star
34

remix-blog-vercel

JavaScript
21
star
35

broccoli-dist-es6-module

Author in ES6, distribute everywhere.
JavaScript
20
star
36

rf-release

tag, push, and publish to npm and bower
JavaScript
20
star
37

ember-amd-boilerplate

JavaScript
19
star
38

bower-import

wip, move along :)
JavaScript
19
star
39

nested-router

JavaScript
18
star
40

addressbook-api

An address book api
JavaScript
16
star
41

FitText

Truncates lines of text to fit within a container
JavaScript
16
star
42

loom-generators-ember

Loom generators with ES6 ember modules
JavaScript
15
star
43

todo-api

An API for your favorite Todo demos
CoffeeScript
15
star
44

client-vs-server-templating

WHICH IS BETTER?! I DONT KNOW!
Ruby
15
star
45

lunchjs-flux

JavaScript
14
star
46

js-stylesheet

Write styles in JavaScript for simpler component distribution.
JavaScript
13
star
47

jQuery.addObject

This method allows you to add a JavaScript constructor to the jQuery, and then manage the state of an instance with the jQuery API
JavaScript
13
star
48

remix-architect

TypeScript
12
star
49

mootools-channels

An extended, natural publish subscribe system for MooTools.
JavaScript
12
star
50

netlify-starter

WIP
TypeScript
12
star
51

raziel

command-line password management
JavaScript
11
star
52

bbesnpm

...
JavaScript
11
star
53

LazyPagination

Automatically sends ajax requests as the user scrolls an element.
JavaScript
11
star
54

planner2

He does.
TypeScript
10
star
55

Fx.Scroll.Carousel

Extends Fx.Scroll to provide carousel functionality.
JavaScript
10
star
56

modern-advanced-react-workshop

Workshop material for https://reach.tech/workshops
10
star
57

bnpm

better npm
Shell
9
star
58

webpack-skel

template for new projects
JavaScript
9
star
59

detect-amd

Detect AMD support in JavaScript source files
JavaScript
9
star
60

mootools-element-filters

A declarative approach to element behavior.
JavaScript
9
star
61

Loop

A utility funciton used to run a class method on a periodical.
JavaScript
8
star
62

garuda

Git-hosting-server-side ruby library of scripts used to deploy multiple repositories to multiple web servers.
Ruby
8
star
63

wannabe-mvc

A Wannabe MVC in PHP
PHP
8
star
64

fifo

Graceful localStorage
CoffeeScript
8
star
65

mootools-wallpaper

Resizes elements to fit or fill a container
JavaScript
8
star
66

remix-content-blocks

JavaScript
8
star
67

talk-emberconf-2014

my "slides"
JavaScript
7
star
68

mootools-string-inflections

Several methods to convert strings back and forth between "railsish" names. Helpful when creating JavaScript heavy rails (or similar MVC) apps.
JavaScript
7
star
69

talks

Talks I've given
JavaScript
7
star
70

listener

A no frills cross-browser DOM event listener with ender integration
JavaScript
6
star
71

mootools-base64

String methods for encoding and decoding Base64 data
JavaScript
6
star
72

unbundled

JavaScript
6
star
73

mootools-template

Packager and a whole lotta packages ready for you.
PHP
6
star
74

advise.js

Aspect Oriented Programming for JavaScript Objects
JavaScript
6
star
75

basic-cf-pages-template

Basic Cloudflare Pages template
JavaScript
6
star
76

talk-react-js-utah-2014-10-28

Building an application in, and then around, React components.
JavaScript
5
star
77

x_1

TypeScript
5
star
78

vercel-test

JavaScript
5
star
79

webpack-help

JavaScript
5
star
80

ember-addon-kit

Boilerplate repository for creating ember addons
JavaScript
5
star
81

gunnlod

super slick markdown editor for any static site
JavaScript
5
star
82

hmr-test

JavaScript
5
star
83

rackt-datepicker

JavaScript
4
star
84

fs-routes

move along
JavaScript
4
star
85

detect-globals

Detect browser globals in JavaScript source files.
JavaScript
4
star
86

broccoli-es6-module-filter

Transpiler ES6 authored modules to other module types
JavaScript
4
star
87

hilite

Syntax highlighter written in JavaScript
JavaScript
4
star
88

rjbb

RequireJS Boilerplate with AMD versions of jQuery, Underscore, and Backbone
JavaScript
4
star
89

Resizable

Creates resizable user interface elements, stores and retrieves positions from cookies, and each instance is aware of neighboring instances so the resizable limits are dynamically set to avoid resizing over each other
JavaScript
4
star
90

jQuery.dojo

Everything in dojo, brought to jQuery!!!!!!11
3
star
91

accessibility-in-practice

JavaScript
3
star
92

list-app

make quick checklists, usually from my wife's text message shopping lists
Shell
3
star
93

originate

Command line tool that generates new project scaffolds with loom
JavaScript
3
star
94

punchclock

A simple JavaScript time tracker app
JavaScript
2
star
95

Element.GetUntil

Element methods for selecting sibling and parent nodes up to but not including a matched element from a selector.
JavaScript
2
star
96

city-search

JavaScript
2
star
97

test

2
star
98

indie-syd

TypeScript
2
star
99

mootools-custom-form

Custom form controls
JavaScript
2
star
100

actually-this-is-a-number

JavaScript
2
star