New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

markdown-extractor

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

markdown-extractor

Get everythings from markdown document

latest
Source
npmnpm
Version
1.0.1
Version published
Maintainers
1
Created
Source

markdown-extractor

Get everythings from markdown document

node: ^0.10.40
npm: ^1.4.28

Install

$ npm install markdown-extractor

Usage

NodeJS

var mdext = require('markdown-extractor');

console.log(mdext.heading("> Get lots of heading in document\n# Heading\n## Sub heading"));

// Output: [{ type: 'h1', data: 'Heading' }, { type: 'h2', data: 'Sub heading' }]

Browser

Add script in ./lib/markdown-extractor.js

<script src="./lib/markdown-extractor.js"></script>

In script using

console.log(mdext.heading("> Get lots of heading in document\n# Heading\n## Sub heading"));

// Output: [{ type: 'h1', data: 'Heading' }, { type: 'h2', data: 'Sub heading' }]

Demo

Demo here

API

mdext.heading(content)

Get headings from content. The result is array object. Each object have two field type and data.

Example:

console.log(mdext.heading("# Heading\n## Sub heading"));

// Output: [{ type: 'h1', data: 'Heading' }, { type: 'h2', data: 'Sub heading' }]

mdext.metadata(content)

Get metadata from content. The result is object key: value

Example:

console.log(mdext.metadata("Outside <!--metadata\ntitle: Hello\ndescription: Love u\n-->\nOutside"));

// Output: {title: 'Hello', description: 'Love u'}

Note: Metadata in markdown document must had structure like:

<!--metadata
key1: value1
key2: value2
-->

LICENSE

MIT

Keywords

markdown

FAQs

Package last updated on 16 Jul 2016

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