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)
default

Extracts front matter from strings.

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.

any

Variables

v
extract: Extractor
No documentation available
create_extractor

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.

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.

json

Variables

v
extract: Extractor
No documentation available
test

Functions

f
test(
str: string,
formats?: ("yaml" | "toml" | "json" | "unknown")[]
): boolean

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

toml

Variables

v
extract: Extractor
No documentation available
yaml

Variables

v
extract: Extractor
No documentation available

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 front_matter from "@std/front-matter";
or

Import directly with a jsr specifier

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