Skip to main content
Home

Built and signed on GitHub Actions

Works with
This package works with Cloudflare Workers, Node.js, Deno, Bun, Browsers
This package works with Cloudflare Workers
This package works with Node.js
This package works with Deno
This package works with Bun
This package works with Browsers
JSR Score88%
Downloads3,749/wk
Published11 months ago (1.0.9)

Extract front matter from strings

Functions

f
extract<T>(text: string): Extract<T>
3 overloads

Extracts and parses JSON from the metadata of front matter content.

f
test(
str: string,
formats?: Format[]
): boolean

Tests if a string has valid front matter. Supports YAML, TOML and JSON.

Type Aliases

T
Extract<T> = { frontMatter: string; body: string; attrs: T; }

Return type for extract function.

  • No documentation available
  • body: string
    No documentation available
  • frontMatter: string
    No documentation available
T
Format = "yaml" | "toml" | "json"

Supported format for front matter. "unknown" is used when auto format detection logic fails.

Report package

Please provide a reason for reporting this package. We will review your report and take appropriate action.

Please review the JSR usage policy before submitting a report.

Add Package

deno add jsr:@std/front-matter

Import symbol

import * as mod from "@std/front-matter";
or

Import directly with a jsr specifier

import * as mod from "jsr:@std/front-matter";