Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
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: 2 days 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 7 years ago)
- Default Branch: master
- Last Pushed: 2021-12-25T14:06:25.000Z (about 3 years ago)
- Last Synced: 2024-12-18T02:09:01.179Z (10 days ago)
- Topics: compiler, html, markdown, marked, parser
- Language: JavaScript
- Homepage:
- Size: 127 KB
- Stars: 131
- Watchers: 6
- Forks: 10
- Open Issues: 5
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# md
[![NPM version](https://img.shields.io/npm/v/md.svg?style=flat)](https://npmjs.com/package/md) [![NPM downloads](https://img.shields.io/npm/dm/md.svg?style=flat)](https://npmjs.com/package/md) [![Build Status](https://img.shields.io/circleci/project/egoist/md/master.svg?style=flat)](https://circleci.com/gh/egoist/md) [![codecov](https://codecov.io/gh/egoist/md/branch/master/graph/badge.svg)](https://codecov.io/gh/egoist/md)
[![donate](https://img.shields.io/badge/$-donate-ff69b4.svg?maxAge=2592000&style=flat)](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)