Socket
Socket
Sign inDemoInstall

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)


Version published
Weekly downloads
1.1M
decreased by-5.76%
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

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc