ConvertOptions
Contents
[
Hide
]
ConvertOptions class
Provides options for customizing the document conversion process to Markdown format.
public class ConvertOptions
Constructors
| Name | Description |
|---|---|
| ConvertOptions() | Initializes a new instance of the ConvertOptions class. |
Properties
| Name | Description |
|---|---|
| Flavor { get; set; } | Gets or sets the target Markdown dialect. |
| HeadingLevelOffset { get; set; } | Gets or sets the offset to apply to all heading levels in the Markdown output. A value of 2 turns # into ###, ## into ####, etc. Heading levels are clamped to the range 1-6. |
| ImageExportStrategy { get; set; } | Gets or sets the strategy for handling images during conversion. |
| IncludeFrontMatter { get; set; } | Gets or sets a value indicating whether to prepend YAML front matter to the Markdown output. When enabled, document metadata (title, author, format, page count) is extracted and written as a YAML block at the beginning of the output. |
| IncludeHiddenSheets { get; set; } | Gets or sets whether hidden worksheets are included in spreadsheet conversions. |
| MaxColumns { get; set; } | Gets or sets the maximum number of columns to include per table when converting spreadsheets. Columns beyond this limit are truncated with an ellipsis indicator. |
| MaxRows { get; set; } | Gets or sets the maximum number of data rows to include per worksheet when converting spreadsheets. Rows beyond this limit are truncated with an ellipsis indicator. |
| PageNumbers { get; set; } | Gets or sets an array of page or worksheet numbers to convert. Numbering starts from 1. |
| SheetSeparator { get; set; } | Gets or sets the separator inserted between worksheets in spreadsheet conversions. |
| UriExportStrategy { get; set; } | Gets or sets the strategy for customizing resource URIs written to Markdown output. |
Remarks
This class allows you to configure how documents are converted to Markdown, including how images are exported, how resource URIs are written, which pages to convert, and how heading levels are adjusted.
By default, images are embedded as Base64 strings in the Markdown output.
Examples
The following examples show different ways to configure conversion options:
// Example 1: Using default options (images embedded as Base64)
var options = new ConvertOptions();
// Example 2: Saving images to a folder
var options = new ConvertOptions
{
ImageExportStrategy = new ExportImagesToFileSystemStrategy("output/images")
};
// Example 3: Skipping image export
var options = new ConvertOptions
{
ImageExportStrategy = new SkipImagesStrategy()
};
// Example 4: Converting only the first 3 pages
var options = new ConvertOptions
{
PageNumbers = new[] { 1, 2, 3 }
};
// Example 5: Shifting headings down by 2 levels (# becomes ###)
var options = new ConvertOptions
{
HeadingLevelOffset = 2
};
// Example 6: Generating YAML front matter from document metadata
var options = new ConvertOptions
{
IncludeFrontMatter = true
};
// Example 7: Combining multiple options
var options = new ConvertOptions
{
ImageExportStrategy = new ExportImagesToFileSystemStrategy("images"),
HeadingLevelOffset = 1,
IncludeFrontMatter = true,
PageNumbers = new[] { 1, 2 }
};
See Also
- namespace GroupDocs.Markdown
- assembly GroupDocs.Markdown