marked vs markdown-it vs remove-markdown vs strip-markdown
Markdown Processing and Manipulation Comparison
1 Year
markedmarkdown-itremove-markdownstrip-markdownSimilar Packages:
What's Markdown Processing and Manipulation?

Markdown Processing and Manipulation libraries in JavaScript provide tools for converting Markdown text into HTML, stripping Markdown syntax, or manipulating Markdown content. These libraries are essential for web applications, content management systems, and any platform that needs to handle Markdown-formatted text. They offer features like customizable parsing, rendering, and the ability to handle various Markdown flavors. Whether you need a lightweight solution for simple tasks or a feature-rich library for complex Markdown processing, there are options available to suit different needs.

Package Weekly Downloads Trend
Github Stars Ranking
Stat Detail
Package
Downloads
Stars
Size
Issues
Publish
License
marked11,302,70333,985968 kB1920 days agoMIT
markdown-it7,363,46319,029767 kB48a year agoMIT
remove-markdown305,33632318.5 kB42 months agoMIT
strip-markdown74,98414617.4 kB0a year agoMIT
Feature Comparison: marked vs markdown-it vs remove-markdown vs strip-markdown

Parsing and Rendering

  • marked:

    marked offers fast Markdown parsing and rendering with support for custom rendering functions. It is designed to be lightweight and efficient, making it ideal for applications that require quick Markdown processing without a lot of overhead.

  • markdown-it:

    markdown-it provides full Markdown parsing and rendering capabilities, supporting a wide range of Markdown features and extensions. It is highly customizable, allowing developers to create their own plugins and modify the rendering process as needed.

  • remove-markdown:

    remove-markdown does not parse or render Markdown; instead, it strips all Markdown syntax from the input text, leaving only the plain text. This makes it useful for sanitizing input or preparing text for display without any formatting.

  • strip-markdown:

    strip-markdown focuses on removing all Markdown syntax from the input text, providing a clean plain text output. It does not offer parsing or rendering features, making it a specialized tool for stripping away Markdown formatting.

Customization

  • marked:

    marked allows for some customization, particularly in the rendering process, where developers can provide their own rendering functions for specific Markdown elements. However, it is less extensible than markdown-it in terms of plugin architecture.

  • markdown-it:

    markdown-it is highly customizable, with support for plugins, custom rendering, and configuration options. Developers can easily extend its functionality and create tailored solutions for their specific Markdown processing needs.

  • remove-markdown:

    remove-markdown has limited customization options, as its primary function is to strip Markdown syntax. It does not support plugins or configurable rendering, making it a straightforward tool with a single purpose.

  • strip-markdown:

    strip-markdown offers minimal customization, focusing on effectively removing Markdown syntax from text. It is designed to be simple and efficient, with no extensive configuration or plugin support.

Performance

  • marked:

    marked is known for its speed and efficiency, making it one of the fastest Markdown parsers available. It is particularly well-suited for applications that require quick processing of Markdown content with minimal resource usage.

  • markdown-it:

    markdown-it is optimized for performance, especially when using its default settings. However, the performance may vary depending on the complexity of the Markdown being processed and the number of plugins used.

  • remove-markdown:

    remove-markdown is lightweight and performs well when stripping Markdown syntax from text. Its performance is consistent, as it does not involve complex parsing or rendering processes.

  • strip-markdown:

    strip-markdown is designed for quick and efficient removal of Markdown syntax. It is lightweight and performs well, making it suitable for applications that need to process text quickly without any formatting.

Use Case Example

  • marked:

    marked is perfect for scenarios where fast and efficient Markdown processing is needed, such as real-time Markdown editors, chat applications, and any platform that requires quick rendering of Markdown content.

  • markdown-it:

    markdown-it is ideal for applications that require full-featured Markdown parsing and rendering, such as content management systems, blogging platforms, and any application that needs to display Markdown content with rich formatting.

  • remove-markdown:

    remove-markdown is best suited for applications that need to sanitize or clean up Markdown input, such as form validation, data processing pipelines, and any tool that requires plain text output without any formatting.

  • strip-markdown:

    strip-markdown is useful for projects that need to convert Markdown content to plain text, such as text analysis tools, data cleaning applications, and any system that requires text input without any Markdown formatting.

Ease of Use: Code Examples

  • marked:

    Fast Markdown parsing with marked

    const { marked } = require('marked');
    const html = marked('# Fast Markdown Parsing');
    console.log(html);
    
  • markdown-it:

    Markdown parsing with markdown-it

    const MarkdownIt = require('markdown-it');
    const md = new MarkdownIt();
    const html = md.render('# Hello World');
    console.log(html);
    
  • remove-markdown:

    Stripping Markdown with remove-markdown

    const removeMarkdown = require('remove-markdown');
    const text = removeMarkdown(`This is **bold** and this is *italic*.`);
    console.log(text);
    
  • strip-markdown:

    Simple Markdown stripping with strip-markdown

    const stripMarkdown = require('strip-markdown');
    const plainText = stripMarkdown(`Here is some ~~strikethrough~~ text.`);
    console.log(plainText);
    
How to Choose: marked vs markdown-it vs remove-markdown vs strip-markdown
  • marked:

    Select marked if you want a lightweight and fast Markdown parser with a simple API. It is designed for speed and efficiency, making it ideal for applications where performance is critical. marked also supports custom rendering and has a straightforward implementation.

  • markdown-it:

    Choose markdown-it if you need a fast, extensible, and compliant Markdown parser with a focus on performance and flexibility. It supports plugins and offers a high degree of customization, making it suitable for both simple and complex Markdown processing tasks.

  • remove-markdown:

    Use remove-markdown if your primary goal is to strip all Markdown syntax from text while preserving the plain text content. This library is lightweight and easy to use, making it perfect for applications that need to sanitize or clean up Markdown input without any formatting.

  • strip-markdown:

    Opt for strip-markdown if you need a simple and effective solution for removing Markdown syntax from text. It provides a clean API and is focused on stripping out all Markdown elements, making it suitable for projects that require plain text output without any formatting.

README for marked

Marked

npm install size downloads github actions snyk

  • ⚡ built for speed
  • ⬇️ low-level compiler for parsing markdown without caching or blocking for long periods of time
  • ⚖️ light-weight while implementing all markdown features from the supported flavors & specifications
  • 🌐 works in a browser, on a server, or from a command line interface (CLI)

Demo

Checkout the demo page to see marked in action ⛹️

Docs

Our documentation pages are also rendered using marked 💯

Also read about:

Compatibility

Node.js: Only current and LTS Node.js versions are supported. End of life Node.js versions may become incompatible with Marked at any point in time.

Browser: Not IE11 :)

Installation

CLI:

npm install -g marked

In-browser:

npm install marked

Usage

Warning: 🚨 Marked does not sanitize the output HTML. Please use a sanitize library, like DOMPurify (recommended), sanitize-html or insane on the output HTML! 🚨

DOMPurify.sanitize(marked.parse(`<img src="x" onerror="alert('not happening')">`));

CLI

# Example with stdin input
$ marked -o hello.html
hello world
^D
$ cat hello.html
<p>hello world</p>
# Print all options
$ marked --help

Browser

<!doctype html>
<html>
<head>
  <meta charset="utf-8"/>
  <title>Marked in the browser</title>
</head>
<body>
  <div id="content"></div>
  <script src="https://cdn.jsdelivr.net/npm/marked/marked.min.js"></script>
  <script>
    document.getElementById('content').innerHTML =
      marked.parse('# Marked in the browser\n\nRendered by **marked**.');
  </script>
</body>
</html>

or import esm module

<script type="module">
  import { marked } from "https://cdn.jsdelivr.net/npm/marked/lib/marked.esm.js";
  document.getElementById('content').innerHTML =
    marked.parse('# Marked in the browser\n\nRendered by **marked**.');
</script>

License

Copyright (c) 2011-2022, Christopher Jeffrey. (MIT License)