@phenomic/markdown-as-json
v1.0.0
Published
Transform markdown files as json files
Downloads
4
Readme
@phenomic/markdown-as-json
Transform markdown content as a JSON
Handles:
- front-matter (via gray-matter)
- auto slug for headings (with anchors)
- code highlight (via highlight.js)
- table of contents (via remark-toc)
The idea is to get a markdown like this
---
test: a
test2: b
---
## Test
[link](href)
```js
console.log(window);
```
like
{
"test": "a",
"test2": "b",
"headings": [
{
"id": "test",
"level": 2,
"text": "Test",
},
],
"body": {
"c": [
{
"c": [
{
"c": [
{
"p": {
"class": "icon icon-link",
},
"t": "span",
},
],
"p": {
"aria-hidden": "true",
"href": "#test",
},
"t": "a",
},
"Test",
],
"p": {
"id": "test",
},
"t": "h2",
},
"
",
{
"c": [
{
"c": [
"link",
],
"p": {
"href": "href",
},
"t": "a",
},
],
"t": "p",
},
"
",
{
"c": [
{
"c": [
{
"c": [
"console",
],
"p": {
"class": "hljs-built_in",
},
"t": "span",
},
".log(",
{
"c": [
"window",
],
"p": {
"class": "hljs-built_in",
},
"t": "span",
},
")",
],
"p": {
"class": "hljs language-js",
},
"t": "code",
},
],
"t": "pre",
},
],
"t": "div",
},
}
For easy rendering to dom (eg: React etc).
Check out input & output to get an idea of what to expect from this package.