masanos note

🔧Convert Markdown to HTML. convert frontmatter to json

2021-10-01
icon

Install

$ npm install --save-dev processmd

package.json

"scripts": {
  "md": "processmd ./posts/**/*.md --stdout --outputDir _posts/_json > ./_posts/summary.json"
},
"dependencies": {
  "nuxt": "^2.15.8"
},
"devDependencies": {
  "processmd": "^4.6.3"
}

Files

posts/a/a1.md

---
title: A1
description: a1
arr: ["x", "y"]
---

### Markdown
a1

posts/a/a2.md

---
title: A2
description: a2
arr: ["x", "y"]
---

### Markdown
a2

posts/b/b1.md

---
title: B1
description: b1
arr: ["x", "y"]
---

### Markdown
b1

Note

Make _posts/summary.json &

$ npm run md

then, dir & file are created(updated).

_json.json

  • _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"
}

_posts/summary.json

{
  "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"
  ]
}


Related Notessupabase with Vue3 Vue3 with bootstrap-icons[vue3]Install bootstrap5[vue3] install[Nuxt3]The first thing I do when launching a nuxt3 project. (^3.5.2)[Nuxt3][Bootstrap]Use Bootstrap icons with Nuxt3.[Node.js] Storing API results in js🔧[GA4][GTM]Configure GA4 in GTM🔧[Nuxt3]Using Google Tag manager with NUXT3🔧[GA4][BigQuery]Linking GA4 and BigQuery🔧When you want to scrape a SPA site, PhantomJsCloud is solution.🐛Error brew -v | update-reset🔧Use Google Spreadsheet as API with Nuxt3.🔧 Get json from a spreadsheet using GoogleSheetsAPI v4.🔧[Python]Install Python to Mac[Nuxt3]Install stable version of Nuxt 3.0.0. | npx nuxi init nuxt3-appMake Ranking with MySQLwatch & v-model | Vue3 (Nuxt3)window & document | Nuxt3Using custom domain, Hosting to GitHub Pages with Nuxt3GA4 with Nuxt3📝MySQL - Date Function - Tips Use Nuxt3 props🔧Use MicroCMS with Nuxt3🔧Using GoogleFont with Nuxt3📝Error - Deprecation Warning: $weight: Passing a number without unit % (100) is deprecated. - Bootstrap5 📝using sass with nuxt📝Firebase9 Google Authentication with Nuxt3.📝Set favicon in Nuxt3📝Use bootstrap5 with Nuxt3🐛Error Code: 1290. The MySQL server is running with the --secure-file-priv option so it cannot execute this statement[Nuxt3] How to separate source directoriesmicroCMS & GitHub Actions & Nuxt3Using highlight in Nuxt3.use package.json value🔧frontmatter-markdown-loader & highlight.js🔧Install Font Awesome on Nuxt2 via npm.Github pages with GitHub ActionsCannot find module '~/*/*.vue' or its corresponding type declarations.Vetur(2307)🐛Cannot find module. Consider using '--resolveJsonModule' to import module with '.json' extension.ts(2732)TypeScript Object.🔧Bootstrap5 with Nuxt2processmd with Nuxt2🔧[MySQL]Install MySQL Workbench🔧Install homebrew, nvm, node to Mac🔧[MySQL]Record of installing and starting mysql with homebrew.🎨 Display the photo full screen and overlay the header and footer on top.🔧Set git repository to created project.[Nuxt3] Make Header & Footer
A record of the development is left in a web note.
Masanos
I want to make the world I see happy. Little by little, I am preparing to start a business. Thank you for your support.
Buy Me A Coffee
Copyright© masanos All Rights Reserved.