Socket
Book a DemoInstallSign in
Socket

micromark-extension-frontmatter

Package Overview
Dependencies
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

micromark-extension-frontmatter

micromark extension to support frontmatter (YAML, TOML, etc)

latest
Source
npmnpm
Version
2.0.0
Version published
Weekly downloads
2.1M
8.42%
Maintainers
1
Weekly downloads
 
Created

What is micromark-extension-frontmatter?

The micromark-extension-frontmatter package is an extension for micromark, a Markdown parser, that allows for the parsing of frontmatter. Frontmatter is metadata at the beginning of a Markdown file, typically used for configuration or data storage purposes.

What are micromark-extension-frontmatter's main functionalities?

Parsing YAML Frontmatter

This feature allows you to parse YAML frontmatter in a Markdown file. The code sample demonstrates how to use the micromark-extension-frontmatter to parse a Markdown string containing YAML frontmatter and convert it to HTML.

const micromark = require('micromark');
const { frontmatter } = require('micromark-extension-frontmatter');

const markdown = `---
title: Example Title
author: John Doe
---

# Hello World
`;

const html = micromark(markdown, {
  extensions: [frontmatter()]
});

console.log(html);

Parsing TOML Frontmatter

This feature allows you to parse TOML frontmatter in a Markdown file. The code sample demonstrates how to use the micromark-extension-frontmatter to parse a Markdown string containing TOML frontmatter and convert it to HTML.

const micromark = require('micromark');
const { frontmatter } = require('micromark-extension-frontmatter');

const markdown = `+++
title = "Example Title"
author = "John Doe"
+++

# Hello World
`;

const html = micromark(markdown, {
  extensions: [frontmatter('toml')]
});

console.log(html);

Parsing JSON Frontmatter

This feature allows you to parse JSON frontmatter in a Markdown file. The code sample demonstrates how to use the micromark-extension-frontmatter to parse a Markdown string containing JSON frontmatter and convert it to HTML.

const micromark = require('micromark');
const { frontmatter } = require('micromark-extension-frontmatter');

const markdown = `{
  "title": "Example Title",
  "author": "John Doe"
}

# Hello World
`;

const html = micromark(markdown, {
  extensions: [frontmatter('json')]
});

console.log(html);

Other packages similar to micromark-extension-frontmatter

Keywords

micromark

FAQs

Package last updated on 27 Jun 2023

Did you know?

Socket

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