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

markup-it

Package Overview
Dependencies
Maintainers
5
Versions
94
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

markup-it

Pipeline for working with markup input (for example Markdown)

  • 13.0.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
687
increased by33.14%
Maintainers
5
Weekly downloads
 
Created
Source

markup-it

Build Status NPM version

markup-it is a JavaScript library to serialize/deserialize markdown content using an intermediate format backed by an immutable model.

Installation

$ npm i markup-it --save

or

$ yarn add markup-it

Usage

Parse markdown
const { State, MarkdownParser } = require('markup-it');

const state = State.create(MarkdownParser);
const document = state.deserializeToDocument('Hello **World**');
Render document to HTML
const { State, HTMLParser } = require('markup-it');

const state = State.create(HTMLParser);
const str = state.serializeDocument(document);
Render document to Markdown
const { State, MarkdownParser } = require('markup-it');

const state = State.create(markdown);
const str = state.serializeDocument(document);

ES6

markup-it is ESM compliant through the package.json module field, so you can safely use it with ES6 syntax for tree-shaking.

import { State, HTMLParser } from 'markup-it';

const state = State.create(HTMLParser);
const str = state.serializeDocument(document);

Testing

There are many scripts available in the /bin folder to output an HTML or Markdown file to multiple formats (HTML, Hyperscript, JSON, Markdown, YAML).

These scripts can be called with babel-node, for example:

babel-node bin/toJSON.js ./page.md

Keywords

FAQs

Package last updated on 19 Mar 2021

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