Extract structured frontmatter (YAML, JSON, TOML) and JSON-LD RDF graph attributes from markdown documents with full spec conformance.
Parse frontmatter attributes, raw frontmatter text, and clean document body in a single call.
import { extract, LinkedMarkdownError } from "@wazoo/linked-markdown"; const markdown = `--- @id: "https://example.org/note/1" @type: "KnowledgeNote" title: "Linked Markdown Document" tags: ["rdf", "typescript"] --- # Hello Linked World This is the document body.`; // Parse document const { attrs, frontMatter, body } = extract(markdown); console.log(attrs.title); // => "Linked Markdown Document" console.log(attrs["@type"]); // => "KnowledgeNote" console.log(frontMatter); // => Raw frontmatter string console.log(body); // => Clean body with leading newlines stripped
Automatic format detection across YAML, JSON, and TOML frontmatter markers.
| Format | Supported Markers | Default Object Type |
|---|---|---|
| YAML | --- · ---yaml · = yaml = |
YAML Object |
| JSON | ---json · = json = |
JSON Object |
| TOML | ---toml · +++ · = toml = |
TOML Object |
Built for reliable parsing, knowledge graph compatibility, and spec adherence.
jsonld.toRDF().LinkedMarkdownError with programmatic codes like LMD_NO_FRONTMATTER and LMD_INVALID_FRONTMATTER.wazootech/linked-markdown.