gray-matter VS markdown-it

Compare gray-matter vs markdown-it and see what are their differences.

gray-matter

Smarter YAML front matter parser, used by metalsmith, Gatsby, Netlify, Assemble, mapbox-gl, phenomic, vuejs vitepress, TinaCMS, Shopify Polaris, Ant Design, Astro, hashicorp, garden, slidev, saber, sourcegraph, and many others. Simple to use, and battle tested. Parses YAML by default but can also parse JSON Front Matter, Coffee Front Matter, TOML Front Matter, and has support for custom parsers. Please follow gray-matter's author: https://github.com/jonschlinkert (by jonschlinkert)

markdown-it

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
gray-matter markdown-it
17 55
3,754 17,085
- 1.7%
3.3 8.5
5 months ago 29 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.

gray-matter

Posts with mentions or reviews of gray-matter. We have used some of these posts to build our list of alternatives and similar projects. The last one was on 2024-03-05.
  • Building a flat-file CMS with Angular
    3 projects | dev.to | 5 Mar 2024
    Writing in markdown is super convenient, and supported by just about any text editor. To convert these .md files to browser-ready HTML, I wrote a simple little Node.js script using two great npm packages called gray-matter and showdown.
  • Eleventy vs. Next.js for static site generation
    4 projects | dev.to | 14 Dec 2023
    Next, install gray-matter to extract metadata from the front matter of markdown files, and marked to convert the markdown files to HTML:
  • Exploring the code behind Docusaurus
    4 projects | dev.to | 30 Oct 2023
    It turns out that Docusaurus uses an open source JavaScript parser called gray-matter to parse the front matter from markdown files! After installing gray-matter using npm and them importing it into the markdownUtils.ts file, all it takes is calling the matter method and passing the markdown file contents to get returned an Object with data and content (the data being the front matter and the content being the rest of the markdown file contents).
  • Create an Interactive Table of Contents for a Next.js Blog with Remark
    5 projects | dev.to | 21 Apr 2023
    Although we are building a custom table of contents, we won't have to write everything from scratch. To separate the Markdown/MDX content from the front matter, we'll use the Gray-matter package. It is optional in case you don't have front matter in your Markdown files. To process the Markdown itself, we'll use the Remark package. We'll also need the unist-util-visit package for traversing node trees and mdast-util-to-string for getting the text content of a node.
  • Create your own blog with MDX and NextJS
    2 projects | dev.to | 5 Dec 2022
    In this article we walk you through the process of creating a simple blog app using the popular React framework NextJS, gray-matter and next-mdx-remote.
  • NextJS 13 Blog Starter
    6 projects | dev.to | 14 Nov 2022
    In order to get post information (such as author, title, date, etc.) from our HTML without having them be apart of our rendered post we need a way to parse YAML front matter, this is where gray-matter comes in hand.
  • Create a Markdown Editor with Rust and React
    12 projects | dev.to | 13 Oct 2022
    It’s actually not part of the CommonMark spec, so you’ll often need a 3rd party library to parse it out on top of your Markdown parser. In JavaScript we use gray-matter which converts frontmatter into a JS object we can more easily use.
  • Turn a Markdown blog to a simple SSG
    4 projects | dev.to | 30 Jul 2022
    Over the past few weeks, I mostly wrote on how to template a Node.js application with EJS using Express. Then, I wrote an article showing how to create a Markdown blog in Node.js using EJS, Express, gray-matter and markdown-it. Today, I'll combine those tutorials to turn the Markdown blog, from the last tutorial, into a simple SSG.
  • Markdown blog with EJS
    3 projects | dev.to | 25 Jul 2022
    gray-matter, to parse the front matter from the Markdown files
  • Create Blog Post Bookmarks in Next.js
    3 projects | dev.to | 6 Jun 2022
    Luckily for us, there is a fantastic NPM package that can help us with this. Let’s install it.

markdown-it

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-03-14.
  • Creating excerpts in Astro
    4 projects | dev.to | 14 Mar 2024
    Parse it into HTML using markdown-it
  • Creating an Automated Profile README using Nodejs and GitHub Actions
    5 projects | dev.to | 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 | dev.to | 1 Dec 2023
    github.com/markdown-it/markdown-it - 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 | dev.to | 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 | dev.to | 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 | dev.to | 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 | dev.to | 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 | dev.to | 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.

What are some alternatives?

When comparing gray-matter and markdown-it you can also consider the following projects:

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

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

front-matter - Extract YAML front matter from strings

react-markdown - Markdown component for React

TypeScript - TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

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!