This is a fork of marked
Why?
- Actively maintained
- Rewrote in ES6 and bundled with Rollup for smaller size (15KB)
- Support more GFM extras like task lists
yarn add md
You can find a CDN version at https://unpkg.com/md/
const md = require('md')
const html = md(`## hello world
A modern **markdown** parser!
- [ ] todo
- [x] done
`)
You can preview the HTML result here: https://egoist.moe/md2html/ (source)
Type: string
Required: true
Input markdown string.
All marked options plus:
Type: boolean
Default: true
Enable GFM task lists, this will only work if options.gfm
is true
.
Type: boolean | (href: string) => boolean
Default: undefined
Open links in a new window/tab.
Type: boolean
Default: true
Add data-line
attribute to <pre>
tag for code fences, it's useful with the line-highlight plugin in PrismJS.
```js{1}
console.log('hi')
```
This will yield:
<pre data-line="1"><code class="lang-js">console.log('hi')</code></pre>
- Fork it!
- Create your feature branch:
git checkout -b my-new-feature
- Commit your changes:
git commit -am 'Add some feature'
- Push to the branch:
git push origin my-new-feature
- Submit a pull request :D
# lint and unit test
yarn test
# lint only
yarn lint
# fix lint issues
yarn lint -- --fix
md © egoist, Released under the MIT License.
Authored and maintained by egoist with help from contributors (list).
egoist.moe · GitHub @egoist · Twitter @_egoistlily