
Security News
npm Adopts OIDC for Trusted Publishing in CI/CD Workflows
npm now supports Trusted Publishing with OIDC, enabling secure package publishing directly from CI/CD workflows without relying on long-lived tokens.
@github-docs/frontmatter
Advanced tools
Parse and validate YAML frontmatter
This is a frontmatter parser built on gray-matter
that supports optional frontmatter validation using a revalidator JSON schema.
This is a Node.js module available through the npm registry.
npm install @github-docs/frontmatter
enum
.validateKeyOrder
validateKeyNames
const frontmatter = require('@github-docs/frontmatter')
const schema = {
properties: {
title: {
type: 'string',
required: true
},
meaning_of_life: {
type: 'number',
minimum: 40,
maximum: 50
}
}
}
const markdown = `---
title: Hello, World
meaning_of_life: 42
---
I am content.
`
const { data, content, errors } = frontmatter(markdown)
frontmatter(markdown, [options])
Parses a string containing markdown and (optional) frontmatter.
markdown
String (required) - the contents of a markdown file that includes YAML frontmatter.options
Object (optional)
schema
Object - A revalidator JSON schema.filepath
String - The name of the file being parsed. Useful for debugging when errors occur.validateKeyNames
Boolean - If true
, checks that all keys are specified as schema properties. Defaults to false
validateKeyOrder
Boolean - If true
, checks that all keys are in the same order they appear in the schema. Defaults to false
frontmatter.stringify(markdown, [data])
This is the same stringify
method exported by the gray-matter
module, which can be used to join a markdown string and a frontmatter object together as a single string.
MIT
FAQs
Parse and validate YAML frontmatter
The npm package @github-docs/frontmatter receives a total of 567 weekly downloads. As such, @github-docs/frontmatter popularity was classified as not popular.
We found that @github-docs/frontmatter demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 open source maintainers 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
npm now supports Trusted Publishing with OIDC, enabling secure package publishing directly from CI/CD workflows without relying on long-lived tokens.
Research
/Security News
A RubyGems malware campaign used 60 malicious packages posing as automation tools to steal credentials from social media and marketing tool users.
Security News
The CNA Scorecard ranks CVE issuers by data completeness, revealing major gaps in patch info and software identifiers across thousands of vulnerabilities.