YAML front matter

View as MarkdownMarkdown

Set up your AI agent

Give your coding agent live access to the GroupDocs documentation and API reference through the GroupDocs Docs MCP server — no install, no API key. Learn more

claude mcp add --transport http groupdocs-docs https://docs.groupdocs.com/mcp

Also process documents locally

The GroupDocs.Markdown MCP server lets your agent work with files on your machine; they are never uploaded. It needs the .NET 10 SDK or Docker.

claude mcp add groupdocs-markdown -- dnx GroupDocs.Markdown.Mcp --yes
Folders, licensing and more →

Call setIncludeFrontMatter(true) 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

import com.groupdocs.markdown.*;

public class FrontMatterExample {

    public static void main(String[] args) {
        DocumentConvertOptions options = new DocumentConvertOptions();
        options.setIncludeFrontMatter(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:...;base64,[elided])

**Meridian Outdoor Co. — Business Plan**
[TRUNCATED]

Download full output

Combined with heading offset

import com.groupdocs.markdown.*;

public class FrontMatterCombined {

    public static void main(String[] args) {
        DocumentConvertOptions options = new DocumentConvertOptions();
        options.setIncludeFrontMatter(true);
        options.setHeadingLevelOffset(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:...;base64,[elided])

**Annual Report 2025**
[TRUNCATED]

Download full output

Front matter fields

Only non-empty fields are included:

FieldSourceExample
titleBuilt-in document title property"Q3 Report"
authorBuilt-in document author property"Jane Doe"
formatDetected file formatDocx
pagesPage or worksheet count12