sanitize-html VS markdown-it

Compare sanitize-html vs markdown-it and see what are their differences.


Clean up user-submitted HTML, preserving whitelisted elements and whitelisted attributes on a per-element basis. Built on htmlparser2 for speed and tolerance (by apostrophecms)


Markdown parser, done right. 100% CommonMark support, extensions, syntax plugins & high speed (by markdown-it)
Our great sponsors
  • SurveyJS - Open-Source JSON Form Builder to Create Dynamic Forms Right in Your App
  • InfluxDB - Power Real-Time Data Analytics at Scale
  • WorkOS - The modern identity platform for B2B SaaS
sanitize-html markdown-it
4 54
3,552 16,839
0.9% 1.1%
7.2 8.4
3 days ago 3 days ago
JavaScript JavaScript
MIT License MIT License
The number of mentions indicates the total number of mentions that we've tracked plus the number of user suggested alternatives.
Stars - the number of stars that a project has on GitHub. Growth - month over month growth in stars.
Activity is a relative number indicating how actively a project is being developed. Recent commits have higher weight than older ones.
For example, an activity of 9.0 indicates that a project is amongst the top 10% of the most actively developed projects that we are tracking.


Posts with mentions or reviews of sanitize-html. We have used some of these posts to build our list of alternatives and similar projects. The last one was on 2023-07-19.


Posts with mentions or reviews of markdown-it. We have used some of these posts to build our list of alternatives and similar projects. The last one was on 2024-02-26.
  • Creating an Automated Profile README using Nodejs and GitHub Actions
    5 projects | | 26 Feb 2024
    We can easily use markdown-it, a markdown parser for rendering a mix of JavaScript and plain text into a markdown file. To get started, kindly create a new directory with the following file structure:
  • Construindo um Painel de Blog Dinâmico com Next.js
    6 projects | | 1 Dec 2023 - markdown biblioteca.
  • dd
    6 projects | /r/u_vjvpundjke | 11 May 2023
    markdown-it - Markdown parser done right. Fast and easy to extend.
  • How to convert markdown to json in react js
    2 projects | /r/reactjs | 31 Dec 2022
    Maybe Markdown It? link
  • My Journey into Open Source
    3 projects | | 28 Dec 2022
    I have found that when you start working on just a single project, it will naturally lead to other opportunities (e.g. upstream libraries, similar projects, etc). When I started working on MarkBind, a static site generator, I was also making occasional contributions to some of the plugins for markdown-it, the Markdown parser that MarkBind uses. I was fixing bugs in MarkBind by discovering the root causes in the upstream libraries and pushing fixes there to hopefully benefit other projects as well. I even made a pull request to fix the documentation that I was reading on an MDN page for : The Table Body element, something that broke the server-side rendering of MarkBind.
  • Remembering how to make a website without React
    5 projects | | 28 Dec 2022
    Next, I setup a markdown parser, markdown-it. I then created another Mustache lambda for converting markdown to HTML and injecting it in the template output. I also ran the Markdown string through the Mustache parser, so I could use my “media” lambda inside markdown. This is where things got gross in the code.
  • Sweeter searches with Pagefind
    7 projects | | 8 Dec 2022
    In Eleventy, a footnote’s HTML begins like this if one is using the most typical footnotes-ready Markdown setup, i.e., the markdown-it parser combined with the markdown-it-footnote plugin:
  • Want to create attractive, interactive docs? Use these amazing documentation tools and examples
    11 projects | | 2 Dec 2022
    At its core it is an extension to the popular open-source Markdown library markdown-it. Plugins for markdown parsers and preprocesseors are an avenue for more innovation of this nature.
  • Rendering Markdown with Enhance
    3 projects | | 18 Nov 2022
    Enhance does not natively support rendering markdown into HTML, which is out of scope for the project. Instead, we rely on markdown-it, an excellent JavaScript markdown parser that is endlessly configurable with plugins. As we use markdown in many different projects, we’ve created a node module called, Arcdown, which packages together our preferred conventions for parsing markdown files.
  • DPS909 Blog - Lab 6: Full MD Support
    3 projects | | 25 Oct 2022
    I found a NPM library called markdown-it that parses all MD syntax into HTML. I thought this was a good module because it also supports plugins to extend it's functionality, so if I need additional features to be supported I can easily implement them.

What are some alternatives?

When comparing sanitize-html and markdown-it you can also consider the following projects:

DOMPurify - DOMPurify - a DOM-only, super-fast, uber-tolerant XSS sanitizer for HTML, MathML and SVG. DOMPurify works with a secure default, but offers a lot of configurability and hooks. Demo:

marked - A markdown parser and compiler. Built for speed.

remark - markdown processor powered by plugins part of the @unifiedjs collective

js-xss - Sanitize untrusted HTML (to prevent XSS) with a configuration specified by a Whitelist

PEG.js - PEG.js: Parser generator for JavaScript

js-yaml - JavaScript YAML parser and dumper. Very fast.

nearley - 📜🔜🌲 Simple, fast, powerful parser toolkit for JavaScript.


docx-to-pdf-on-AWS-Lambda - Microsoft Word doc/docx to PDF conversion on AWS Lambda using Node.js

Jison - Bison in JavaScript.

strip-json-comments - Strip comments from JSON. Lets you use comments in your JSON files!

obsidian-pandoc - Pandoc document export plugin for Obsidian (