nkvs-md-parser
v1.1.1
Published
A plugin of nkv-store. Parse the markdown string into an array-object.
Downloads
13
Maintainers
Readme
nkv-store/markdown-parser
Usage
// import * as parser from 'nkvs-md-parser'
// import * as store from 'nkv-store'
const parser = require('nkvs-md-parser')
// const store = require('nkv-store')
// store.inject(parser)
// const parser = store.getNamespace('nkv-store/markdown-parser')
const markdownString = `
# ==Test== 1
## ul
- 1
- 1.1 **Important**
- 1.2
- 123
- 1.3
- 1.3.1
- 2
-  123
## ol
1. 123
2. 456
1. 789
## checkbox & radio
- [x] 1
- [ ] 2
- ( ) A
- (x) B
\`\`\`JavaScript index.js 121231
import * as store from 'nkv-store'
store.setNamespace('test', {
number: 0,
increase() {
this.number++
}
})
\`\`\`
Hello!
World!
\`code\`
\`code\`
\`code\`
***strong & em***
***strong & em***
**strong & em**
**strong**
**strong**
*strong & em*
*strong*
*strong*
*strong*
*em*
*em*
H~2~O
H~2~O
x^2^
x^2^
==Test==
==Test==
~del~
~~del~~
~~del~
~~del~~
### H3
#### H4
##### H5
###### H6


[link](http://www.bing.com)
[link](http://www.bing.com "Bing!")
---
::CustomA class="p-4"
123
::CustomB padding="4" 123
content
::
::CustomC padding="4" 123
::CustomD
::
::
456
::CustomC padding="4" 123
::CustomD
::
::
789
::
::CustomAA
::
| A | B | C | \`D\` |
| :--: | ---: | :--- | ---- |
| 1 | 1 | 1 | \`1\` |
| 2 | 2 | 2 | 2 |
| 3 | 3 | 3 | 3 |
[](link "title")
> Dorothy followed her through many of the beautiful rooms in her castle.
>
>> The Witch bade her clean the pots and kettles and sweep the floor and keep the fire fed with wood.
>> The Witch bade her clean the pots and kettles and sweep the floor and keep the fire fed with wood.
> #### The quarterly results look great!
>
> - Revenue was off the chart.
> - Profits were higher than ever.
>
> *Everything* is going according to **plan**.
`.trim()
console.log(parser.parse(markdownString))Version
- 1.0.0
- Elements: p, code, mark, sub, sup, strong, em, a, img, h1, h2, h3, h4, h5, h6, ul, ol, li (checkbox, radio), pre.
- 1.0.1
- Fix an error about pre.
- Add custom element or component parse method.
- 1.0.2
- Change usage.
- 1.0.3
- Add an element: hr.
- Fix an error about pre.
- Fix an error about custom element or component.
- 1.0.4
- Fix an error about img.
- Fix an error about a.
- 1.0.5
- Add component name.
- 1.0.6
- Add an element: table.
- 1.0.7
- Add an element: del.
- Fix some issues about inline elements.
- 1.1.0
- Optimize algorithm.
- Change some key-values.
- Add an element: blockquote.
- 1.1.1
- Correct the description.
