New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

readme-export-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

readme-export-parser

ReadMe export markdown parser

  • 1.0.3
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
1
decreased by-66.67%
Maintainers
1
Weekly downloads
 
Created
Source

Readme Export Parser

A tiny library for parsing markdown files exported from ReadMe. Provides a single function as the default export, parse, and a set of JSDoc type definitions for the various content block types.

Usage

The only export is a function that takes a ReadMe markdown string as its only argument, and returns a document data object. The following:

const fs = require('fs')
const parseReadmeMarkdown = require('readme-export-parser')

const srcMD = fs.readFileSync('/path/to/export/file.md', 'utf-8')
const data = parseReadmeMarkdown(srcMD)

console.log(JSON.stringify(data, null, 2))

Would output something along the lines of:

{
  "id": "file_id",
  "slug": "file_id_snake_case",
  "title": "Documentation",
  "description": "Content from 'excerpt' front matter data",
  "elements": [{
    "type": "MARKDOWN",
    "content": "### A Header\n\nSome content **follows**"
  }, {
    "type": "CODE",
    "content": {
      "codes": [{
        "code": "const example = () => {}\nconst var = 42",
        "language": "javascript",
        "name": "Example"
      }]
    }
  }, {
    "type": "CALLOUT",
    "content": {
      "type": "info",
      "title": "Some Notice",
      "body": "A notice body\n\n**As markdown**"
    }
  }]
}

Contributing

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create a new Pull Request

Keywords

FAQs

Package last updated on 29 May 2020

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

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc