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 };
MarkdownConverter.ToFile("business-plan.docx", "front-matter-example.md", options);
// Output:
// ---
// title: "Q3 Report"
// author: "Jane Doe"
// format: Docx
// pages: 12
// ---
//
// # Q3 Report
// ...

business-plan.docx is a sample file used in this example. Click here to download it.

---
title: "Meridian Outdoor Co. — Business Plan"
author: "Meridian Outdoor Co."
format: Docx
pages: 5
---

![](data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAlgAAAC0CAYAAABIf1IMAAAABHNCSVQICAgIfAhkiAAADcJJREFUeJzt3VFo3VWeB/BfF2EfdJraSWKkpovabiokaRZcfWiM4jCS0mELjvgwzlZt16fdlUFpKbLCgDKELQ7Oum+yNdYdH4StCLMkdBexSfow7sC0SUA7TZVJW0zbWI1OF/ap+xD+/97k/u/Nze1JbJLPBwo9/3vu/Z1/L5Qv55x7/uumJkauBQAAyfzZdz0AAIDVRsACAEhMwAIASEzAAgBI7Jaii//67/8dZ89dSlbkH576Qdy7+Y4F+6Wqq5566qmnnnrqqbdc9YoUBqyJyYsxevrcDQ2q1LdX/6
[TRUNCATED]

Download full output

Combined with heading offset

using GroupDocs.Markdown;

var options = new ConvertOptions
{
    IncludeFrontMatter = true,
    HeadingLevelOffset = 1
};
MarkdownConverter.ToFile("annual-report.docx", "front-matter-combined.md", options);

annual-report.docx is a sample file used in this example. Click here to download it.

---
title: "Meridian Outdoor Co. — Annual Report 2025"
author: "Elena Márquez, CFO"
format: Docx
pages: 6
---

![](data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAlgAAAC0CAYAAABIf1IMAAAABHNCSVQICAgIfAhkiAAADcJJREFUeJzt3VFo3VWeB/BfF2EfdJraSWKkpovabiokaRZcfWiM4jCS0mELjvgwzlZt16fdlUFpKbLCgDKELQ7Oum+yNdYdH4StCLMkdBexSfow7sC0SUA7TZVJW0zbWI1OF/ap+xD+/97k/u/Nze1JbJLPBwo9/3vu/Z1/L5Qv55x7/uumJkauBQAAyfzZdz0AAIDVRsACAEhMwAIASEzAAgBI7Jaii//67/8dZ89dSlbkH576Qdy7+Y4F+6Wqq5566qmnnnrqqbdc9YoUBqyJyYsxevrcDQ2q1Ld
[TRUNCATED]

Download full output

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