frontmatter
formatFrontMatterList()β
function formatFrontMatterList(
prop,
indentation,
prefix): string[]
Defined in: frontmatter.ts:79
Formats an array into a front matter YAML-like structure as string array.
Parametersβ
propβ
unknown
The array to format.
indentationβ
number
= 0
The current indentation level. Defaults to 0.
prefixβ
string
= "- "
The prefix for each list item. Defaults to "- ".
Returnsβ
string
[]
An array of strings representing the formatted front matter list.
Exampleβ
const list = ["item1", "item2"];
formatFrontMatterList(list);
// [
// "- item1",
// "- item2"
// ]
formatFrontMatterObject()β
function formatFrontMatterObject(
props,
indentation,
prefix?): string[]
Defined in: frontmatter.ts:39
Formats an object into a front matter YAML-like structure as string array.
Parametersβ
propsβ
unknown
The object to format.
indentationβ
number
= 0
The current indentation level. Defaults to 0.
prefix?β
string
An optional prefix for each line.
Returnsβ
string
[]
An array of strings representing the formatted front matter.
Exampleβ
const obj = { title: "My Title", tags: ["tag1", "tag2"] };
formatFrontMatterObject(obj);
// [
// " title: My Title",
// " tags:",
// " - tag1",
// " - tag2"
// ]
formatFrontMatterProp()β
function formatFrontMatterProp(
prop,
indentation,
prefix?): string[]
Defined in: frontmatter.ts:122
Formats a single property into a front matter YAML-like structure as string array.
Parametersβ
propβ
unknown
The property to format, represented as an object with a single key-value pair.
indentationβ
number
= 0
The current indentation level. Defaults to 0.
prefix?β
string
An optional prefix for the property.
Returnsβ
string
[]
An array of strings representing the formatted front matter property.
Exampleβ
const prop = { title: "My Title" };
formatFrontMatterProp(prop);
// [
// "title: My Title"
// ]