Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

remark-mdx-frontmatter

Package Overview
Dependencies
Maintainers
1
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

remark-mdx-frontmatter

A remark plugin for converting frontmatter metadata into MDX exports

  • 2.1.1
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
403K
decreased by-10.71%
Maintainers
1
Weekly downloads
 
Created

What is remark-mdx-frontmatter?

The remark-mdx-frontmatter package is a plugin for the remark processor that allows you to parse and transform frontmatter in MDX files. This is useful for handling metadata in your MDX content, such as titles, dates, and other custom fields.

What are remark-mdx-frontmatter's main functionalities?

Parsing Frontmatter

This feature allows you to parse frontmatter in MDX files. The code sample demonstrates how to use the remark-mdx-frontmatter plugin to parse frontmatter and process the MDX content.

const remark = require('remark');
const mdx = require('remark-mdx');
const frontmatter = require('remark-mdx-frontmatter');

const content = `---
title: 'Hello World'
date: '2023-10-01'
---

# Hello World`;

remark()
  .use(mdx)
  .use(frontmatter)
  .process(content, (err, file) => {
    if (err) throw err;
    console.log(String(file));
  });

Transforming Frontmatter

This feature allows you to transform frontmatter in MDX files. The code sample demonstrates how to use a custom transformer to manipulate the frontmatter data after it has been parsed.

const remark = require('remark');
const mdx = require('remark-mdx');
const frontmatter = require('remark-mdx-frontmatter');

const content = `---
title: 'Hello World'
date: '2023-10-01'
---

# Hello World`;

const transformer = () => (tree) => {
  // Transform the frontmatter here
  console.log(tree.children[0].data);
};

remark()
  .use(mdx)
  .use(frontmatter)
  .use(transformer)
  .process(content, (err, file) => {
    if (err) throw err;
    console.log(String(file));
  });

Other packages similar to remark-mdx-frontmatter

Keywords

FAQs

Package last updated on 27 Oct 2022

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