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

@honkit/markup-it

Package Overview
Dependencies
Maintainers
2
Versions
35
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@honkit/markup-it

Pipeline for working with markup input (for example Markdown)

Source
npmnpm
Version
6.0.3
Version published
Weekly downloads
17
-75%
Maintainers
2
Weekly downloads
 
Created
Source

@honkit/markup-it

@honkit/markup-it is a JavaScript library to parse and modify markuped content (for example Markdown) using an intermediate format backed by an immutable model.

@honkit/markup-it is fork of markup-it@2.2.0

  • Less dependency
  • For stability

Installation

$ npm i @honkit/markup-it  --save

Usage

Initialize a syntax:

var MarkupIt = require('@honkit/markup-it');
var markdownSyntax = require('@honkit/markup-it/syntaxes/markdown');
var htmlSyntax = require('@honkit/markup-it/syntaxes/html');

var markdown = new MarkupIt(markdownSyntax);
var html = new MarkupIt(htmlSyntax);

Parse a text

var content = markdown.toContent('Hello **World**');

Render content to HTML/Markdown

// Render back to markdown:
var textMd = markdown.toText(content);

// Render to HTML
var textHtml = html.toText(content);

Convert HTML into Markdown

var content = html.toContent('Hello <b>World</b>');
var textMd = markdown.toText(content);

Extend Syntax

This module contains the markdown syntax, but you can write your custom syntax or extend the existing ones.

Create rules

var myRule = MarkupIt.Rule(DraftMarkup.BLOCKS.HEADING_1)
    .regExp(/^<h1>(\S+)<\/h1>/, function(state, match) {
        return {
            tokens: state.parseAsInline(match[1])
        };
    })
    .toText(function(state, token) {
        return '<h1>' + state.renderAsInline(token) + '</h1>';
    });

Custom Syntax

Create a new syntax inherited from the markdown one:

var mySyntax = markdownSyntax.addBlockRules(myRule);

License

Apache-2.0

It includes Samy Pesse and GitBook works.

Keywords

draft-js

FAQs

Package last updated on 01 May 2025

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