https://github.com/egoist/md
A markdown parser and compiler. Built for speed.
https://github.com/egoist/md
compiler html markdown marked parser
Last synced: 3 months ago
JSON representation
A markdown parser and compiler. Built for speed.
- Host: GitHub
- URL: https://github.com/egoist/md
- Owner: egoist
- License: mit
- Created: 2017-04-08T15:12:18.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2021-12-25T14:06:25.000Z (over 3 years ago)
- Last Synced: 2025-04-02T15:09:43.983Z (3 months ago)
- Topics: compiler, html, markdown, marked, parser
- Language: JavaScript
- Homepage:
- Size: 127 KB
- Stars: 131
- Watchers: 5
- Forks: 11
- Open Issues: 5
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# md
[](https://npmjs.com/package/md) [](https://npmjs.com/package/md) [](https://circleci.com/gh/egoist/md) [](https://codecov.io/gh/egoist/md)
[](https://github.com/egoist/donate)> This is a fork of [marked](https://github.com/markedjs/marked)
**Why?**
- Actively maintained
- Rewrote in ES6 and bundled with Rollup for smaller size (15KB)
- Support more GFM extras like [task lists](https://github.com/blog/1375-task-lists-in-gfm-issues-pulls-comments)## Install
```bash
yarn add md
```You can find a CDN version at https://unpkg.com/md/
## Usage
```js
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](https://github.com/egoist/md2html))
## API
### md(src, [options])
#### src
Type: `string`
Required: `true`Input markdown string.
#### options
All marked [options](https://marked.js.org/#/USING_ADVANCED.md) plus:
##### taskLists
Type: `boolean`
Default: `true`Enable GFM task lists, this will only work if `options.gfm` is `true`.
##### linksInNewTab
Type: `boolean | (href: string) => boolean`
Default: `undefined`Open links in a new window/tab.
##### dataLine
Type: `boolean`
Default: `true`Add `data-line` attribute to `
` tag for code fences, it's useful with the [line-highlight](http://prismjs.com/plugins/line-highlight/) plugin in PrismJS.````markdown
```js{1}
console.log('hi')
```
````This will yield:
```html
console.log('hi')
```## Contributing
1. Fork it!
2. Create your feature branch: `git checkout -b my-new-feature`
3. Commit your changes: `git commit -am 'Add some feature'`
4. Push to the branch: `git push origin my-new-feature`
5. Submit a pull request :D## Development
```bash
# lint and unit test
yarn test# lint only
yarn lint# fix lint issues
yarn lint -- --fix
```## Author
**md** © [egoist](https://github.com/egoist), Released under the [MIT](./LICENSE) License.
Authored and maintained by egoist with help from contributors ([list](https://github.com/egoist/md/contributors)).> [egoist.moe](https://egoist.moe) · GitHub [@egoist](https://github.com/egoist) · Twitter [@_egoistlily](https://twitter.com/_egoistlily)