Skip to main content

latest
Works with
It is unknown whether this package works with Node.js, Deno, Browsers, Cloudflare Workers, Bun
It is unknown whether this package works with Node.js
It is unknown whether this package works with Deno
It is unknown whether this package works with Browsers
It is unknown whether this package works with Cloudflare Workers
It is unknown whether this package works with Bun
JSR Score64%
Published2 years ago (0.215.0)

Functions

f
createExtractor(formats: Partial<Record<"yaml" | "toml" | "json" | "unknown", Parser>>): Extractor

Factory that creates a function that extracts front matter from a string with the given parsers. Supports YAML, TOML and JSON.

f
test(
str: string,
formats?: ("yaml" | "toml" | "json" | "unknown")[]
): 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 Extractor.

  • No documentation available
  • body: string
    No documentation available
  • frontMatter: string
    No documentation available
T
Extractor = <T = Record<string, unknown>>(str: string) => Extract<T>

Function return type for createExtractor.

T
Parser = <T = Record<string, unknown>>(str: string) => T

Parser function type used alongside createExtractor.

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";