Socket
Socket
Sign inDemoInstall

@diplodoc/markdown-it-markdown-renderer

Package Overview
Dependencies
69
Maintainers
9
Versions
33
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @diplodoc/markdown-it-markdown-renderer

render markdown-it tokens into markdown


Version published
Weekly downloads
108
decreased by-11.48%
Maintainers
9
Install size
15.2 MB
Created
Weekly downloads
 

Readme

Source

markdown-it-markdown-renderer

This is custom markdown-it renderer that aims to provide zero diff with original markdown in most cases and exact zero diff in the case of the html render.

supporting syntax from the commonmark specification

Overview

Usage

Plugin

Plugin interface allows you to configure your markdown-it instance with plugin to use renderer to render into markdown instead of the html.

import MarkdownIt from 'markdown-it';

import {MarkdownRendererEnv} from 'src/renderer';
import {mdRenderer} from 'src/plugin';

const md = new MarkdownIt('commonmark', {html: true});

md.use(mdRenderer);

Markdown renderer needs additional information parsed from the document

For that reason we require you to provide, MarkdownRendererEnv described in the renderer module.

source - is original markdown string split by new lines

const markdown = '# Title\nparagraph goes **here**\n- list item one\n- list item two\n';

const env: MarkdownRendererEnv = {source: markdown.split('\n')};

const rendered = md.render(markdown, env);

Keywords

FAQs

Last updated on 24 Jan 2024

Did you know?

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc