Secure markdown renderer working on browsers for user input data.


Keywords
markdown, latex, mathjax
Licenses
Apache-2.0/MPL-2.0
Install
npm install securemark@0.118.1

Documentation

Securemark

Build Status Coverage Status

Secure markdown renderer working on browsers for user input data.

Features

  • Secure DOM rendering.
  • Declarative syntax.
  • Recursive parsing.
  • Incremental update.
  • Progressive rendering.
  • Unblinking rendering.
  • Large document support.
  • Syntax highlight with PrismJS.
  • LaTeX rendering with MathJax.
  • Figure, Annotation, and Authority syntax.
  • Index generation for headings, terms, and figures.
  • Shortlink syntax for local references of indexes and figures.
  • Auto numbering of figures and footnotes.
  • Footnote and its bidirectional reference link generation from annotations and authorities.
  • Table of contents.

Demos

https://falsandtru.github.io/securemark/

APIs

index.d.ts

Syntax

markdown.d.ts

  • Heading (#)
  • UList (-)
  • OList (0., 1., a., A.)
  • DList (~)
  • Table (| |)
  • Blockquote (>, !>)
  • Preformattedtext (```)
  • HorizontalRule (---)
  • Inline markups (*, `, []{}, {}, ![]{}, !{}, [](), ++, ~~, (()), ...)
  • Inline HTML tags (<small>, <bdi>, ...)
  • Autolink (https://host, ttps://host, account@host, @account)
  • Shartmedia (!https://host/image.png, !https://youtu.be/..., !https://gist.github.com/...)
  • Syntex highlight (```lang filename)
  • LaTeX (${expr}$, $$expr$$)
  • Index (# title [#indexer], ~ term [#indexer], [#index])
  • Figure (~~~figure [:fig-name])
  • Label ([:fig-name])
  • Data ([~name], [~name=value], [~name=value|text])
  • Annotation (((annotation)))
  • Authority ([[authority]])
  • Channel (@account#tag)
  • Hashtag (#tag)
  • Template ({{ template }})
  • Comment (<# comment #>)

Media

  • Twitter
  • YouTube
  • Gist
  • SlideShare
  • PDF (.pdf)
  • Video (.webm, .ogv)
  • Audio (.oga, .ogg)
  • Images

Graph

Dependencies

  • PrismJS
  • MathJax
  • jQuery (for Ajax)
  • DOMPurify

Browsers

Requires es6 and modern DOM API support.

  • Chrome
  • Firefox
  • Edge
  • Safari

Polyfill: https://cdn.polyfill.io