Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/rwu823/mark-it-down
:books: The modern Markdown parser, painless and all in one
https://github.com/rwu823/mark-it-down
markdown
Last synced: 4 days ago
JSON representation
:books: The modern Markdown parser, painless and all in one
- Host: GitHub
- URL: https://github.com/rwu823/mark-it-down
- Owner: rwu823
- License: mit
- Created: 2016-09-22T22:10:50.000Z (about 8 years ago)
- Default Branch: master
- Last Pushed: 2023-12-15T05:07:28.000Z (11 months ago)
- Last Synced: 2024-04-09T22:53:42.011Z (7 months ago)
- Topics: markdown
- Language: JavaScript
- Homepage: https://rwu823.github.io/mark-it-down
- Size: 123 KB
- Stars: 35
- Watchers: 2
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# mark-it-down
The modern Markdown parser, painless and all in one, your good friend of write documentation. It works well in Browser and Node.## Demo
`mark-it-down` provides two themes: the `light` and `dark`, check [here](http://rwu823.github.io/mark-it-down) to review.## Install
```sh
$ npm i --save mark-it-down
```## Usage
```js
import Markdown from 'mark-it-down'
const md = new Markdown({})const html = md.toHTML(markdownSyntax)
```## Options
- `hasHeadHash`: _[Boolean]_ `true` or `false`, auto generation the hash link, the spaces will convert to `-` and transform to lower case
```js
const md = new Markdown({
hasHeadHash: true
})
md.toHTML('## Browser Supported')// outputs
Browser Supported
```- `theme`: _[String]_ `light` or `dark`, the Markdown theme
- `codeTheme`: _[String]_ `light` or `dark`, the code snippet themThe other [valid options](https://github.com/showdownjs/showdown#valid-options)
### Default options
```js
constructor(option = {}) {
const opts = {
hasHeadHash: true,
noHeaderId: true,
strikethrough: true,
tables: true,
tasklists: true,
theme: 'light', // or dark
codeTheme: 'light', // or dark
...option
}
}
```## API
### .toHTML(String)
Convert markdown syntax to HTML.### .mountToTextArea(queryselector or textarea element)
This is `browser` only, it mounts to a textarea element, and convert value to markdown HTML.