Skip to main content

Search OfficeIMO

Enter a topic, API type, or PowerShell command.

Documentation Search all OfficeIMO/
Class

HtmlMarkdownExportOptions

OfficeIMO.Markdown.Html

Namespace
OfficeIMO.Markdown.Html
Assembly
OfficeIMO.Markdown.Html
Source revision
e163ccb36643 with working tree changes
Modifiers
sealed

Options controlling HTML to Markdown conversion.

Inheritance

  • object
  • HtmlMarkdownExportOptions

Usage

Explore 12 API references to this type

This type appears in these public API surfaces even when no hand-authored example is attached directly to the page.

Accepted by parameters 4

Constructors

public HtmlMarkdownExportOptions() #

Methods

public HtmlMarkdownExportOptions Clone() #

Creates a copy of the current options instance so callers can reuse option templates safely.

Returns

HtmlMarkdownExportOptions A new HtmlMarkdownExportOptions with the same option values.
public static HtmlMarkdownExportOptions CreateCommonMarkProfile() #

Creates a CommonMark-oriented conversion profile. The intermediate OfficeIMO document model is preserved, while markdown serialization avoids GitHub-only output where practical.

public static HtmlMarkdownExportOptions CreateGitHubFlavoredMarkdownProfile() #

Creates a GitHub Flavored Markdown-oriented conversion profile for README and GitHub documentation output.

public static HtmlMarkdownExportOptions CreateOfficeIMOProfile() #

Creates the default OfficeIMO-flavored conversion profile.

public static HtmlMarkdownExportOptions CreatePortableProfile() #

Creates a portable conversion profile that serializes the converted document with portable markdown fallbacks.

public static HtmlMarkdownExportOptions CreateProfile(MarkdownOutputProfile profile) #

Creates conversion options for the requested Markdown output profile.

Parameters

profile OfficeIMO.Markdown.MarkdownOutputProfile required

Properties

public bool FailOnLoss { get; set; } #

Rejects converted content when its report contains fidelity loss.

public Encoding Encoding { get; set; } #

Text encoding used by Markdown file and stream exports.

public Uri? BaseUri { get; set; } #

Optional base URI used to resolve relative links and image sources.

public bool UseBodyContentsOnly { get; set; } #

When true, only the body contents are converted when a body element is present.

public bool RemoveScriptsAndStyles { get; set; } #

When true, script/style/noscript/template elements are ignored.

public bool PreserveUnsupportedBlocks { get; set; } #

When true, unsupported block elements are emitted as raw HTML blocks instead of being dropped.

public bool PreserveUnsupportedInlineHtml { get; set; } #

When true, unsupported inline elements are emitted as raw HTML inside inline Markdown.

public bool SmartHref { get; set; } #

When true, links whose label already represents the target are emitted as plain text.

public MarkdownHtmlUnknownTagHandling UnknownBlockHandling { get; set; } #

Controls how unsupported block-level elements are converted.

public MarkdownHtmlUnknownTagHandling UnknownInlineHandling { get; set; } #

Controls how unsupported inline elements are converted.

public bool EscapeMarkdownLineStarts { get; set; } #

When true, plain text imported from HTML is escaped when it could be interpreted as a Markdown block marker.

public HtmlUrlPolicy UrlPolicy { get; set; } #

Shared URL policy applied before hyperlink URLs are materialized into the Markdown model.

public HtmlUrlPolicy? ResourceUrlPolicy { get; set; } #

Optional separate policy for image and media sources. When omitted, HtmlMarkdownExportOptions.UrlPolicy is used so existing callers retain their single-policy behavior.

public MarkdownHtmlBase64ImageHandling Base64Images { get; set; } #

Controls how base64 data-URI images are represented in the converted image model.

public string? Base64ImageOutputDirectory { get; set; } #

Output directory used when HtmlMarkdownExportOptions.Base64Images is MarkdownHtmlBase64ImageHandling.SaveToFile.

public Func<int, string, string>? Base64ImageFileNameGenerator { get; set; } #

Optional file name factory used when saving base64 image data. Arguments are the zero-based image index and MIME type.

public MarkdownHtmlListingCardMetadataMode ListingCardMetadataMode { get; set; } #

Controls whether low-value metadata inside repeated listing cards should be preserved or suppressed.

public MarkdownSaveOptions? MarkdownWriteOptions { get; set; } #

Optional markdown writer options used when the converter serializes the intermediate MarkdownDocument back to markdown text.

public int? MaxInputCharacters { get; set; } #

Optional maximum input length, in characters, accepted by HTML-to-markdown conversion. When set and exceeded, conversion fails fast with an ArgumentOutOfRangeException.

public int MaxTableExpandedColumns { get; set; } #

Maximum logical columns produced by expanding HTML table colspan attributes. Values must be between 1 and 4096.

public int MaxDefinitionListEntryExpansions { get; set; } #

Maximum number of term/definition entry pairs materialized while converting HTML definition lists. Values must be between 1 and 1,000,000.

public List<IMarkdownDocumentTransform> DocumentTransforms { get; } #

Optional ordered post-conversion document transforms applied to the intermediate MarkdownDocument.

Examples

var options = HtmlMarkdownExportOptions.CreatePortableProfile();
options.DocumentTransforms.Add(
    new MarkdownJsonVisualCodeBlockTransform(MarkdownVisualFenceLanguageMode.GenericSemanticFence));

var document = HtmlConversionDocument.Parse(html).ToMarkdown(options);
public List<MarkdownHtmlBlockConverter> ElementBlockConverters { get; } #

Optional ordered custom HTML element block converters used before the base converter falls back to generic block handling.

public List<MarkdownHtmlInlineConverter> InlineElementConverters { get; } #

Optional ordered custom HTML inline element converters used before the base converter falls back to generic inline handling.

public List<MarkdownVisualElementRoundTripHint> VisualElementRoundTripHints { get; } #

Optional ordered visual-host round-trip hints used when shared data-omd-* elements should recover richer semantic fenced blocks than the default visual-contract mapping.

public HashSet<string> ExcludeSelectors { get; } #

CSS selectors for elements that should be removed before conversion.

public List<Func<HtmlElement, bool>> ElementFilters { get; } #

Predicates for elements that should be removed before conversion. Return true to remove an element.

public Dictionary<string, string> TagAliases { get; } #

Maps an HTML tag name to another tag name before built-in conversion is selected.

public HashSet<string> PassThroughTags { get; } #

Tag names that should be emitted as raw HTML without converting their children.