New to Telerik Document ProcessingStart a free 30-day trial

Using MarkdownFormatProvider

Updated on May 13, 2026

The MarkdownFormatProvider allows you to import and export RadFlowDocument instances to and from the Markdown (.md and .markdown) format. RadWordsProcessing includes a built-in Markdown parser and writer that supports the most common Markdown elements used in documentation and content authoring workflows.

To use the MarkdownFormatProvider, install the Telerik.Documents.Flow NuGet package for .NET Standard and .NET (Target OS: None) or Telerik.Windows.Documents.Flow for .NET Framework and .NET (Target OS: Windows).

Supported Document Elements

The MarkdownFormatProvider supports the following document elements during import and export:

Block-level Elements

ElementNotes
Headings (H1–H6)ATX (# Heading) and Setext (=== / ---) styles configurable via ExportSettings.HeadingStyle
ParagraphsStandard CommonMark paragraphs
Thematic break / horizontal rule---, ***, ___
Fenced code blocksWith optional language info string; fence char configurable via ExportSettings.CodeFenceStyle
Indented code blocksFour-space or tab-indented content
Block quotesNested block quotes supported up to 21 levels
Bullet listsTight and loose lists
Ordered listsBoth . and ) terminators
Task lists (GFM)[ ] unchecked / [x] checked
GFM pipe tablesWith column alignment; configurable via ExportSettings.TableExport (GfmPipe or Skip)
Raw HTML blocksPreserved verbatim on round-trip
YAML frontmatterDelimited by --- at document start; preserved verbatim

Inline Elements

ElementNotes
Plain texttext
Bold**text**
Italic*text*
Bold italic***text***
Strikethrough (GFM)~~text~~
Inline code spanBacktick delimited; also applied to Runs using monospace fonts (configurable via ExportSettings.MonospaceFontNames)
Hyperlinks[text](url) inline links
Inline images![alt](src) configurable via ExportSettings.ImageExport (Inline or Skip)
Floating imagesExported as inline ![alt](src)
Hard line breakTwo trailing spaces or \ at end of line

Markdown is a plain-text format. Document elements with no Markdown equivalent, such as fonts, colors, page size, margins, and headers and footers, are not preserved during export.

Import

To import a Markdown file, create a MarkdownFormatProvider instance and call its Import method with a Stream to the .md file.

Example 1: Import from a File

C#
Telerik.Windows.Documents.Flow.Model.RadFlowDocument document;
Telerik.Windows.Documents.Flow.FormatProviders.Md.MarkdownFormatProvider provider = new Telerik.Windows.Documents.Flow.FormatProviders.Md.MarkdownFormatProvider();

using (Stream input = File.OpenRead("input.md"))
{
    document = provider.Import(input, TimeSpan.FromSeconds(10));
}

The provider parses the Markdown content and builds a RadFlowDocument with the corresponding paragraphs, headings, tables, and inline formatting. Inline elements such as bold, italic, code, and strikethrough are mapped to the equivalent character properties in the document model.

Export

To export a RadFlowDocument to Markdown, create a MarkdownFormatProvider instance and call Export, passing the document and an output stream.

Example 2: Export to a File

C#
Telerik.Windows.Documents.Flow.FormatProviders.Md.MarkdownFormatProvider provider = new Telerik.Windows.Documents.Flow.FormatProviders.Md.MarkdownFormatProvider();
RadFlowDocument document = CreateRadFlowDocument(); // CreateRadFlowDocument() is a custom method that creates a simple instance of RadFlowDocument. You can replace it with the instance you would like to export.

using (Stream output = File.OpenWrite("output.md"))
{
    provider.Export(document, output, TimeSpan.FromSeconds(10));
}

The exporter traverses the document structure and writes the equivalent Markdown constructs. Heading styles are mapped to ATX-style heading markers (#######), tables are rendered as GitHub-Flavored Markdown pipe tables, and lists are written with the appropriate indentation.

See Also