YAML front matter

YAML front matter

Enable IncludeFrontMatter to extract document metadata into a YAML block at the beginning of the Markdown output. This is commonly used by static site generators like Jekyll, Hugo, and Docusaurus.

Example

using GroupDocs.Markdown;

var options = new ConvertOptions { IncludeFrontMatter = true };
string md = MarkdownConverter.ToMarkdown("report.docx", options);

Console.WriteLine(md);
// Output:
// ---
// title: "Q3 Report"
// author: "Jane Doe"
// format: Docx
// pages: 12
// ---
//
// # Q3 Report
// ...

Combined with heading offset

using GroupDocs.Markdown;

var options = new ConvertOptions
{
    IncludeFrontMatter = true,
    HeadingLevelOffset = 1
};
MarkdownConverter.ToFile("chapter.docx", "chapter.md", options);

Front matter fields

Only non-empty fields are included:

FieldSourceExample
titleBuiltInDocumentProperties.Title"Q3 Report"
authorBuiltInDocumentProperties.Author"Jane Doe"
formatDetected file formatDocx
pagesPage or worksheet count12