• Stars
    star
    155
  • Rank 240,864 (Top 5 %)
  • Language
    JavaScript
  • License
    MIT License
  • Created over 9 years ago
  • Updated about 9 years ago

Reviews

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

Repository Details

markdown to react element

md2react Circle CI

npm install --save md2react

See md2react playground

Example

global.React = require('react');
var md2react = require('md2react');

var md = '# Hello md2react';
var html = React.renderToString(md2react(md));

/*
<div data-reactid=".14qrwokr3sw" data-react-checksum="20987480"><h1 data-reactid=".14qrwokr3sw.$_start_root_0_heading"><span data-reactid=".14qrwokr3sw.$_start_root_0_heading.0">Hello md2react</span></h1></div>'
//'<div data-reactid=".58nba97pxc" data-react-checksum="-55236619"><h1 data-reactid=".58nba97pxc.0"><span data-reactid=".58nba97pxc.0.0">Hello</span></h1></div>'
*/

Checklist

Compiled elements are given checked/unchecked class if bullet has checkbox.

var md = '- [x] a\n- [ ] b\n- c';
var html = React.renderToString(md2react(md, tasklist: true));
<div><ul><li class="checked"><p>a</p></li><li class="unchecked"><p>b</p></li><li class=""><p>c</p></li></ul></div>

Write your checklist style

API

  • md2react(markdown: string , mdastOptionsWithSanitize: Object): ReactElement

See mdast detail in wooorm/mdast

And sanitize: true uses dompurify to raw html input(examle, <span onload='alert(1)'></span>)

ChangeLog

v0.5.1

  • Support table align

v0.5.0

  • Update mdast to 0.12.0
  • Fix table align

LICENSE

MIT

More Repositories

1

next-editor

Standalone Git Editor on Browser
TypeScript
316
star
2

arda

Meta-Flux Framework
CoffeeScript
216
star
3

flumpt

JavaScript
151
star
4

frontend-boilerplate

JavaScript
143
star
5

uniroll

Opinionated universal frontend bundler in browser
TypeScript
110
star
6

trans-loader

webpack-less frontend with service-worker
TypeScript
100
star
7

mints

lightweight typescript compiler
TypeScript
94
star
8

amdx

Accelarated MDX
JavaScript
82
star
9

next-boilerplate-20200727

TypeScript
72
star
10

mdbuf

TypeScript
65
star
11

warden

Client router with resouce management
JavaScript
62
star
12

swdev

No bundle frontend by service-worker
TypeScript
60
star
13

hard-reducer

Type friendly reducer helper
JavaScript
56
star
14

tsx-source-jump

Jump from the HTML element to the source code of the generator
TypeScript
46
star
15

horn.js

simple reactive view framework inspired by knockout, angular and backbone
CoffeeScript
45
star
16

frontend-gh-action-playground

TypeScript
44
star
17

stone-skin

Isomorphic IndexedDb and in memory db wrapper.
CoffeeScript
43
star
18

use-react-redux-context

Alternative ReactRedux.connect by useContext for performance
TypeScript
43
star
19

dts-parser

CoffeeScript
43
star
20

next-pwa-boilerplate

Next PWA
JavaScript
34
star
21

my-feed-reader

JavaScript
34
star
22

fe-base

JavaScript
32
star
23

modern-js-stack-example-with-react

JavaScript
32
star
24

skin.js

Simple and primitive DOM wrapper
JavaScript
31
star
25

react-dispatcher-decorator

JavaScript
29
star
26

atom-git-grep

git-grep in atom editor
CoffeeScript
26
star
27

backbone-test-pattern

JavaScript
26
star
28

mdex-editor

JavaScript
24
star
29

shaker-phobia

TypeScript
24
star
30

deftypes.js

JavaScript Type Definition and Typed Function DSLs
CoffeeScript
23
star
31

dev

TypeScript
23
star
32

reiny

Template engine for React / Mithril / Mercury
CoffeeScript
21
star
33

modern-node-project-2022

TypeScript
20
star
34

remix-d1-bullets

TypeScript
20
star
35

redux-workerized

TypeScript
19
star
36

zodiarg

TypeScript
19
star
37

momic

CoffeeScript
17
star
38

minlink

Minimum(> 1kb) and isomorphic worker wrapper with comlink like rpc.
TypeScript
17
star
39

rn-expo-firebase-web

JavaScript
17
star
40

bower-build

CoffeeScript
17
star
41

flyio-playground

JavaScript
16
star
42

frontend-challenges

TypeScript
16
star
43

gulp-react-jade

CoffeeScript
15
star
44

Wanderer

Websocket Based Diablo Clone
JavaScript
15
star
45

injector.js

JavaScript DCI inspired by Robotlegs
CoffeeScript
14
star
46

vk

CoffeeScript
14
star
47

vistree

TypeScript
13
star
48

mizchi

13
star
49

qwik-svelte

TypeScript
13
star
50

dotfiles-deprecated

Shell
13
star
51

webview-pane

CoffeeScript
12
star
52

tcs

Tiny and typed coffeescript like language
CoffeeScript
12
star
53

react-unite

Editable layout system
TypeScript
12
star
54

toxen

TypeScript
12
star
55

posenet-worker

TypeScript
12
star
56

modern-js-stack-example

JavaScript
11
star
57

frontend-starter-react-redux-typescript

TypeScript
11
star
58

frontend-deno

HTML
11
star
59

gpt-markup-preview

TypeScript
10
star
60

bundle-on-browser

TypeScript
10
star
61

bincr

incremental build helper
JavaScript
10
star
62

whiteboard

JavaScript
10
star
63

ardux

Async + Reducer + Redux Like API
JavaScript
10
star
64

promised-reducer

Fold promise queue and detect sync or async
JavaScript
9
star
65

absurd-sql-example-with-typeorm

TypeScript
9
star
66

mz-match

JavaScript
9
star
67

vite-monorepo-example

TypeScript
9
star
68

summon

CoffeeScript
9
star
69

react-animation

JavaScript
9
star
70

prj

minimum frontend project
HTML
8
star
71

overworld

JavaScript
8
star
72

sabizan

Network proxy by ServiceWorker
JavaScript
8
star
73

lint-with-deno

TypeScript
8
star
74

next-amp-tailwind-purgecss

TypeScript
8
star
75

lizod

TypeScript
8
star
76

next-prisma-example

TypeScript
7
star
77

qwik-microfront-base

TypeScript
7
star
78

flow-require

JavaScript
7
star
79

next-like-frameworks

TypeScript
7
star
80

visual-typescript

TypeScript
6
star
81

web-shell

TypeScript
6
star
82

sketch-board

JavaScript
6
star
83

sqlite-wasm-playground

TypeScript
6
star
84

vue-haxe

Haxe
6
star
85

libretto

CoffeeScript
6
star
86

microfront-base

TypeScript
6
star
87

kawa.js

CoffeeScript
6
star
88

berry-typescript-project

JavaScript
5
star
89

markdown-code-features

TypeScript
5
star
90

bony

JavaScript
5
star
91

whirlr.js

Deferred task runner and manager.
CoffeeScript
5
star
92

minfront

JavaScript
5
star
93

bundler

hobby bundler
TypeScript
5
star
94

frontend-starter

Start your own frontend project
HTML
5
star
95

underscore.d.ts

5
star
96

mytown

TypeScript
5
star
97

virdy

Handy react element DSL
CoffeeScript
5
star
98

noo

CoffeeScript
5
star
99

vite-wasm-pack-starter

Rust
5
star
100

qwik-vue

TypeScript
5
star