Socket
Book a DemoInstallSign in
Socket

markdown-post-parser

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

markdown-post-parser

Parser for building blogs in Markdown.

0.0.4
latest
Source
npmnpm
Version published
Weekly downloads
4
33.33%
Maintainers
1
Weekly downloads
 
Created
Source

markdown-post-parser

npm version Build Status Coverage Status License: MIT

Parser for building blogs in Markdown.

Install

npm install --save-dev markdown-post-parser

Use

CLI

# generate
mpp -m index.md -i ./src -o ./json/blog.json -s ./static

# watch
mpp -w -m index.md -i ./src -o ./json/blog.json -s ./static

API


const MarkdownPostParser = require('markdown-post-parser')
const markdownPostParser = new MarkdownPostParser({
  main: 'index.md',
  input: './src',
  output: './json/blog.json',
  static: './static'
})

// generate
markdownPostParser.generate().then(() => {
  console.log('Generate completeed')
})

// watch
markdownPostParser.watch()

Example

Directory

src
├─ post-01
│  ├─ index.md
│  └─ example.png
├─ post-02
│  ├─index.md
│  └─ example.png
└─ post-02
   └─index.md

Markdown format

src/post-01/index.md

---
id: post-01
title: Example Post
description: test post
created_at: "2019-04-01"
updated_at: "2019-04-01"
tags:
    - HTML
    - CSS
    - JavaScript
---

## overview

text text

- list item
- list item
- list item
- list item

JSON format

{
  // All posts
  "posts": [
    {
      "path": "src/post-01",
      "main": "src/post-01/index.md",
      "id": "post-01",
      "title": "Example Post",
      "description": "test post",
      "created_at": "2019-04-01",
      "updated_at": "2019-04-01",
      "tags": [
        "HTML",
        "CSS",
        "JavaScript"
      ],
      "body": {
        "md": "...", // Markdown source
        "html": "...", // HTML source
        "text": "..." // Plane text source
      },
      "resource": [
        "src/post-01/example.png"
      ]
    },
    ...
  ],

  // All tags
  "tags": [
    "HTML",
    "CSS",
    "JavaScript",
    ...
  ],

  // All resources
  "resources": [
    "src/post-01/example.png",
    "src/post-02/example.png"
  ]

Development

# Build TypeScript
yarn build

# Development mode
yarn dev

# Unit test
yarn test

Todos

  • Enhance test code
  • Update document
  • CLI design

License

MIT License

Keywords

markdown

FAQs

Package last updated on 15 Sep 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.