
Security News
MCP Steering Committee Launches Official MCP Registry in Preview
The MCP Steering Committee has launched the official MCP Registry in preview, a central hub for discovering and publishing MCP servers.
@cmdlucas/markdown-metadata
Advanced tools
Markdown metadata extractor. Extract metadata from a markdown document.
Install the latest version with npm or Yarn:
$ npm install @cmdlucas/markdown-metadata
$ yarn add @cmdlucas/markdown-metadata
In order to be parsed, metadata must be placed at the beginning of the markdown document between two triple dashes. Example:
---
title: Lorem ipsum dolor sit amet
author: Marcus Antonius
keywords: latin, ipsum
---
Vestibulum tortor quam, *feugiat vitae*, ultricies eget, tempor sit amet, ante.
Here's how to parse the metadata:
const metadataParser = require('@cmdlucas/markdown-metadata');
// Assuming source is a string containing the markdown document
const source = '--- title: Lorem...';
// Parse source. Result is a two-property object
const result = metadataParser(source);
// The first property, 'metadata', is the object of parsed metadata. Example:
//
// {
// 'title': 'Lorem ipsum dolor sit amet',
// 'author': 'Marcus Antonius',
// 'keywords': 'latin, ipsum'
// };
result.metadata;
// The second property, 'content', is the document source without metadata. Example:
//
// Vestibulum tortor quam, *feugiat vitae*, ultricies eget, tempor sit amet, ante.
result.content;
Currently, only yaml
is supported. Future versions intend to support toml
and other popular file configuration formats.
Markdown Metadata extractor is licensed under the MIT License. See the LICENSE
file for details.
FAQs
Parse metadata in a markdown document
We found that @cmdlucas/markdown-metadata demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
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.
Security News
The MCP Steering Committee has launched the official MCP Registry in preview, a central hub for discovering and publishing MCP servers.
Product
Socket’s new Pull Request Stories give security teams clear visibility into dependency risks and outcomes across scanned pull requests.
Research
/Security News
npm author Qix’s account was compromised, with malicious versions of popular packages like chalk-template, color-convert, and strip-ansi published.