API Reference

Class

HtmlOptions

Namespace OfficeIMO.Markdown
Assembly OfficeIMO.Markdown
Modifiers sealed

Options controlling HTML rendering style and asset delivery.

Inheritance

  • Object
  • HtmlOptions

Usage

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

Accepted by parameters

Constructors

Methods

public static HtmlOptions CreateGitHubFlavoredMarkdownProfile() #
Returns: HtmlOptions

Creates a fragment-oriented HTML rendering profile for GitHub Flavored Markdown comparison/output. This enables cmark-gfm-style task-list HTML, footnote HTML, and the GFM raw HTML tag filter while leaving raw HTML otherwise allowed. Use a stricter RawHtmlHandling value for untrusted hosts.

Properties

public HtmlKind Kind { get; set; } #

Fragment vs full document. Default: Document when used with HtmlOptions).

public HtmlStyle Style { get; set; } #

Built-in style preset. Default: Clean.

public CssDelivery CssDelivery { get; set; } #

How to deliver CSS. Default: Inline.

public AssetMode AssetMode { get; set; } #

Connectivity mode for external assets (CDNs). Default: Online.

public String CssHref { get; set; } #

Optional explicit CSS URL for LinkHref.

public List<String> AdditionalCssHrefs { get; } #

Additional CSS URLs to include (link or inline depending on AssetMode).

public List<String> AdditionalJsHrefs { get; } #

Additional JS URLs to include (script src or inline depending on AssetMode).

public MarkdownExternalTextResolver ExternalTextResolver { get; set; } #

Optional caller-owned resolver used to inline HTTP or HTTPS CSS and JavaScript in offline mode. OfficeIMO never performs hidden synchronous network requests; return null to omit a resource.

public String Title { get; set; } #

Page title for full document rendering. Default: "Document".

public String BodyClass { get; set; } #

Wrap content in <article> with this CSS class. Set to null to avoid wrapper. Default: "markdown-body".

public Boolean AutoHeadingIdentifiers { get; set; } #

When true, headings render automatic id attributes. Default: true to preserve OfficeIMO's existing HTML output behavior.

public MarkdownHeadingIdentifierStyle HeadingIdentifierStyle { get; set; } #

Controls the slug algorithm used for automatic heading identifiers.

public Boolean ShowAnchorIcons { get; set; } #

When true, show a small anchor icon next to headings (on hover by default).

public String AnchorIcon { get; set; } #

Glyph or text for the anchor icon (e.g., "🔗", "¶"). Default: "🔗".

public Boolean CopyHeadingLinkOnClick { get; set; } #

When true, clicking the anchor icon copies a deep link to the clipboard.

public Int32 BackToTopMinLevel { get; set; } #

Heading level threshold for BackToTopLinks. Default: 2 (H2+).

public String BackToTopText { get; set; } #

Text for the back-to-top link.

public Boolean ThemeToggle { get; set; } #

When true, writes a small theme toggle control if Style supports it. Default: false.

public AssetEmitMode EmitMode { get; set; } #

Emit tags vs manifest-only. Default: Emit.

public PrismOptions Prism { get; set; } #

Optional Prism highlighting configuration.

public MarkdownCodeBlockHtmlRenderer CodeBlockHtmlRenderer { get; set; } #

Optional callback that can replace HTML emitted for individual code blocks. Returning null falls back to the default <pre><code> rendering.

public MarkdownSemanticFencedBlockHtmlRenderer SemanticFencedBlockHtmlRenderer { get; set; } #

Optional callback that can replace HTML emitted for semantic fenced blocks. Returning null falls back to standard fenced-code presentation.

public MarkdownTocHtmlRenderer TocHtmlRenderer { get; set; } #

Optional callback that can replace HTML emitted for realized TOC placeholders. Returning null falls back to the built-in enhanced TOC rendering.

public MarkdownFootnoteSectionHtmlRenderer FootnoteSectionHtmlRenderer { get; set; } #

Optional callback that can replace HTML emitted for the aggregated footnote section. Returning null falls back to the built-in section/ordered-list rendering.

public Boolean GitHubTaskListHtml { get; set; } #

When true, task lists render using GitHub/cmark-gfm style HTML without OfficeIMO task-list CSS classes. Default: false.

public Boolean GitHubFootnoteHtml { get; set; } #

When true, footnote references and sections render using GitHub/cmark-gfm style ids, data attributes, numbering by reference order, and omission of undefined/unused footnotes. Default: false.

public Boolean GitHubHtmlTagFilter { get; set; } #

When true, raw HTML rendering applies cmark-gfm's tag filter by escaping the leading < on dangerous raw HTML tags such as script, style, textarea, and xmp. Default: false.

public Boolean NormalizeUrlHostsToIdn { get; set; } #

When true, non-ASCII authority host labels in rendered URL attributes are normalized to IDNA. Disable this for cmark-gfm-style output, which percent-encodes those host characters instead.

public Boolean PercentEncodeTildeInUrlAttributes { get; set; } #

When true, rendered URL attributes percent-encode the ASCII tilde character (~). Default: false; enable for Markdig-compatible URL attribute output.

public Boolean EscapeNonAsciiText { get; set; } #

When true, HTML text rendering uses the historical .NET encoder behavior that may emit numeric character references for non-ASCII text. Set to false for Markdig/cmark-style output that keeps non-ASCII text literal while still escaping HTML-sensitive characters such as &, <, >, quotes, and apostrophes.

public List<MarkdownBlockHtmlRenderExtension> BlockRenderExtensions { get; } #

Optional block render extensions that can override HTML emitted for specific block types. Later registrations win when block types overlap.

public List<MarkdownInlineHtmlRenderExtension> InlineRenderExtensions { get; } #

Optional inline render extensions that can override HTML emitted for specific inline types. Later registrations win when inline types overlap.

public List<MarkdownSyntaxBlockHtmlRenderExtension> SyntaxBlockRenderExtensions { get; } #

Optional block render extensions that can override HTML emitted for parsed blocks with specific final syntax kinds. Later registrations win when syntax kinds overlap. These extensions run before type-based block extensions.

public List<MarkdownSyntaxInlineHtmlRenderExtension> SyntaxInlineRenderExtensions { get; } #

Optional inline render extensions that can override HTML emitted for parsed inlines with specific final syntax kinds. Later registrations win when syntax kinds overlap. These extensions run before type-based inline extensions.

public String CssScopeSelector { get; set; } #

Prefix selectors in emitted CSS with this scope selector to avoid collisions. Default: "article.markdown-body".

public RawHtmlHandling RawHtmlHandling { get; set; } #

Controls how raw HTML blocks and inline fragments are emitted. Default: Allow. For untrusted chat scenarios, prefer Strip or Escape.

public Boolean ExternalLinksTargetBlank { get; set; } #

When true, external HTTP(S) links are rendered with target="_blank". Default: false.

public String ExternalLinksRel { get; set; } #

Optional rel attribute value to apply to external HTTP(S) links. Common safe value: noopener noreferrer. Default: empty (no rel attribute added).

public String ExternalLinksReferrerPolicy { get; set; } #

Optional referrerpolicy value to apply to external HTTP(S) links. Common privacy value: no-referrer. Default: empty (no referrerpolicy attribute added).

public Uri BaseUri { get; set; } #

Optional base URI used for origin-based restrictions during HTML rendering. When set and RestrictHttpLinksToBaseOrigin/RestrictHttpImagesToBaseOrigin are enabled, absolute HTTP(S) links/images that are cross-origin are suppressed. Default: null.

public Boolean RestrictHttpLinksToBaseOrigin { get; set; } #

When true and BaseUri is an absolute HTTP(S) URI, suppresses cross-origin absolute HTTP(S) links. Relative links and non-HTTP schemes (e.g., mailto) are not affected. Default: false.

public Boolean RestrictHttpImagesToBaseOrigin { get; set; } #

When true and BaseUri is an absolute HTTP(S) URI, suppresses cross-origin absolute HTTP(S) images. Relative image URLs are not affected. Default: false.

public Boolean BlockExternalHttpImages { get; set; } #

When true, suppresses absolute external HTTP(S) images regardless of BaseUri. Useful for privacy-sensitive/untrusted content. Default: false.

public Boolean ImagesLoadingLazy { get; set; } #

When true, emits loading="lazy" on rendered <img> tags. Default: false.

public Boolean ImagesDecodingAsync { get; set; } #

When true, emits decoding="async" on rendered <img> tags. Default: false.

public String ImagesReferrerPolicy { get; set; } #

Optional referrerpolicy value to apply to rendered <img> tags. Common privacy value: no-referrer. Default: empty (no referrerpolicy attribute added).

public List<String> AllowedHttpLinkHosts { get; } #

Optional allowlist of host patterns for absolute HTTP(S) links during HTML rendering. When non-empty, absolute HTTP(S) links are suppressed unless their host matches an entry. Supported patterns: - example.com: exact host match - .example.com: example.com and any subdomain - *.example.com: any subdomain only (not the apex) Default: empty (allow all hosts).

public List<String> AdditionalAllowedLinkSchemes { get; } #

Additional URL schemes permitted for rendered hyperlinks beyond the built-in http, https, mailto, tel, ftp, and urn schemes. Keep this list empty for untrusted Markdown. Add only application-specific schemes whose protocol handlers are safe for the rendering host.

public List<String> AllowedHttpImageHosts { get; } #

Optional allowlist of host patterns for absolute HTTP(S) images during HTML rendering. When non-empty, absolute HTTP(S) images are suppressed unless their host matches an entry. Pattern rules match AllowedHttpLinkHosts. Default: empty (allow all hosts).

public MarkdownVisualTheme Theme { get; set; } #

Shared visual theme used to keep Markdown HTML, PDF, and Word exports visually aligned.

public Boolean ApplyDefaultTheme { get; set; } #

Applies the shared default visual theme when Theme is omitted and the selected HTML style supports document theming.

public MarkdownHtmlColorOverrides ColorOverrides { get; set; } #

Optional additional color overrides for links, headings, and TOC. Values set here override colors derived from Theme.

public Boolean InjectTocAtTop { get; set; } #

When true, injects a Table of Contents at the top of the document before rendering HTML. This is applied by host pipelines that have access to the MarkdownDoc model.

public String InjectTocTitle { get; set; } #

Title for the injected TOC. Default: "Contents".

public Int32 InjectTocMinLevel { get; set; } #

Minimum heading level to include in injected TOC. Default: 1.

public Int32 InjectTocMaxLevel { get; set; } #

Maximum heading level to include in injected TOC. Default: 3.

public Boolean InjectTocOrdered { get; set; } #

Whether the injected TOC should be ordered (true) or unordered (false). Default: false.

public Int32 InjectTocTitleLevel { get; set; } #

Heading level used for the TOC title. Default: 2.