getFrontMatterInfo
Official
Given the contents of a file, get information about the frontmatter of the file, including whether there is a frontmatter block, the offsets of where it starts and ends, and the frontmatter text.
Import:
import { getFrontMatterInfo } from 'obsidian';Example:
const content = `---key1: value1key2: value2---main content`;console.log(getFrontMatterInfo(content));Signature:
function getFrontMatterInfo(content: string): FrontMatterInfoParameters:
| Parameter | Type | Description |
|---|---|---|
content | string |
Returns: FrontMatterInfo
Example:
const content = `---key1: value1key2: value2---main content`;console.log(getFrontMatterInfo(content));