$ npm install --save-dev processmd
"scripts": {
"md": "processmd ./posts/**/*.md --stdout --outputDir _posts/_json > ./_posts/summary.json"
},
"dependencies": {
"nuxt": "^2.15.8"
},
"devDependencies": {
"processmd": "^4.6.3"
}
---
title: A1
description: a1
arr: ["x", "y"]
---
### Markdown
a1
---
title: A2
description: a2
arr: ["x", "y"]
---
### Markdown
a2
---
title: B1
description: b1
arr: ["x", "y"]
---
### Markdown
b1
Make `_posts/summary.json` &
$ npm run md
then, dir & file are created(updated).
- _json/a/a1.json
- _json/a/a2.json
- _json/b/b1.json
for example `_json/a/a1.json`
{
"title": "A1",
"description": "a1",
"arr": [
"x",
"y"
],
"bodyContent": "### Markdown\na1",
"bodyHtml": "<h3>Markdown</h3>\n<p>a1</p>\n",
"dir": "_posts/_json/a",
"base": "a1.json",
"ext": ".json",
"sourceBase": "a1.md",
"sourceExt": ".md"
}
{
"fileMap": {
"_posts/_json/a/a1.json": {
"title": "A1",
"description": "a1",
"arr": [
"x",
"y"
],
"dir": "_posts/_json/a",
"base": "a1.json",
"ext": ".json",
"sourceBase": "a1.md",
"sourceExt": ".md"
},
"_posts/_json/a/a2.json": {
"title": "A2",
"description": "a2",
"arr": [
"x",
"y"
],
"dir": "_posts/_json/a",
"base": "a2.json",
"ext": ".json",
"sourceBase": "a2.md",
"sourceExt": ".md"
},
"_posts/_json/b/b1.json": {
"title": "B1",
"description": "b1",
"arr": [
"x",
"y"
],
"dir": "_posts/_json/b",
"base": "b1.json",
"ext": ".json",
"sourceBase": "b1.md",
"sourceExt": ".md"
}
},
"sourceFileArray": [
"./posts/a/a1.md",
"./posts/a/a2.md",
"./posts/b/b1.md"
]
}