API Reference

Class

MarkdownReaderOptions

Namespace OfficeIMO.Markdown
Assembly OfficeIMO.Markdown
Modifiers sealed

Options for the Markdown reader. Profiles and feature toggles shape the generic markdown core, while BlockParserExtensions and InlineParserExtensions control opt-in syntax such as OfficeIMO callouts, TOC placeholders, footnotes, or custom inline tokens.

Inheritance

  • Object
  • MarkdownReaderOptions

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

public MarkdownReaderOptions() #

Creates a new OfficeIMO-flavored reader configuration with the built-in block syntax extensions registered.

Methods

public MarkdownReaderOptions Clone() #
Returns: MarkdownReaderOptions

Creates an independent copy of the current reader configuration, including profile toggles and extension registrations.

public static MarkdownReaderOptions CreateCommonMarkProfile() #
Returns: MarkdownReaderOptions

Creates a CommonMark-style core profile. This disables OfficeIMO-only and GFM-style extensions such as front matter, task lists, tables, definition lists, TOC placeholders, and footnotes.

public static MarkdownReaderOptions CreateGitHubFlavoredMarkdownProfile() #
Returns: MarkdownReaderOptions

Creates a GitHub Flavored Markdown-style profile. This keeps CommonMark core behavior plus tables, task lists, and footnotes, while disabling OfficeIMO-only callouts and TOC placeholders.

public static MarkdownReaderOptions CreateOfficeIMOProfile() #
Returns: MarkdownReaderOptions

Creates the explicit OfficeIMO profile. This mirrors the library defaults and keeps host-oriented extensions such as callouts, TOC placeholders, and footnotes enabled.

public static MarkdownReaderOptions CreatePortableProfile() #
Returns: MarkdownReaderOptions

Creates a reader configuration for portable Markdown behavior across stricter hosts. Bare http(s)://..., www.*, and plain email tokens remain literal text, and OfficeIMO-specific extensions such as Docs-style callouts, TOC placeholders, and footnotes are disabled. Explicit Markdown links, angle-bracket autolinks, and plain unordered lists continue to work.

public static MarkdownReaderOptions CreateProfile(MarkdownDialectProfile profile) #
Returns: MarkdownReaderOptions

Creates a reader configuration for the requested dialect/profile.

Parameters

profile OfficeIMO.Markdown.MarkdownReaderOptions.MarkdownDialectProfile requiredposition: 0

Properties

public Boolean FrontMatter { get; set; } #

Enable YAML front matter parsing at the very top of the file.

public Boolean Callouts { get; set; } #

Enable recognition of Docs-style callouts ("> [!KIND] Title" blocks).

public MarkdownCalloutTitleMode CalloutTitleMode { get; set; } #

Controls whether trailing callout header text is parsed as an OfficeIMO title or left as ordinary blockquote text for Markdig-compatible alert parsing.

public Boolean Headings { get; set; } #

Enable ATX headings (#, ##, ...).

public Boolean FencedCode { get; set; } #

Enable fenced code blocks (```lang ... ```), including caption on the following _line_ if present.

public Boolean IndentedCodeBlocks { get; set; } #

Enable indented code blocks (lines indented by 4 spaces).

public Boolean Images { get; set; } #

Enable images (standalone lines) with optional caption on the next _italic_ line.

public Boolean StandaloneImageBlocks { get; set; } #

When true, a line containing only markdown image syntax (optionally with a following caption line) is promoted into a typed ImageBlock instead of remaining a paragraph with inline image content. Default: true for OfficeIMO-oriented parsing.

public Boolean UnorderedLists { get; set; } #

Enable unordered lists and task lists.

public Boolean TaskLists { get; set; } #

Enable task list checkbox parsing inside unordered and ordered list items.

public Boolean OrderedLists { get; set; } #

Enable ordered (numbered) lists.

public Boolean ListExtras { get; set; } #

Enable Markdig-style extra ordered-list markers such as alphabetic a./A. and lower/upper roman markers up to xxxix. Default: false; opt in when mirroring Markdig's UseListExtras extension.

public Boolean StrictListIndentation { get; set; } #

When true, nested list levels are derived from continuation-indent rules instead of the library's more permissive legacy indentation heuristic. Enabled by stricter compatibility profiles.

public Boolean Tables { get; set; } #

Enable pipe tables with optional header + alignment row.

public Boolean AllowHeaderlessTables { get; set; } #

When true, pipe rows without a GFM delimiter/alignment row can be parsed as OfficeIMO headerless tables. Disable this for stricter GitHub Flavored Markdown compatibility, where a delimiter row is required.

public Boolean RequireTableBodyRowPipes { get; set; } #

When true, rows after a table delimiter row must still contain a pipe character. OfficeIMO defaults to the conservative form so ordinary paragraphs after a table are not consumed as body rows; the GFM profile disables this to match cmark-gfm pipe-table fixtures.

public Boolean ParseTableCellBlocks { get; set; } #

When true, table cells that look like nested markdown can be upgraded to structured block content. Disable this for GitHub Flavored Markdown compatibility, where table cells contain inline content only.

public Boolean DefinitionLists { get; set; } #

Enable definition lists (Term: Definition lines).

public Boolean TocPlaceholders { get; set; } #

Enable placeholder TOC markers such as [TOC] and {:toc}.

public Boolean Footnotes { get; set; } #

Enable footnote references and footnote definition blocks.

public Boolean Abbreviations { get; set; } #

Enable Markdig-style abbreviation definitions and inline expansion, e.g. *[HTML]: Hyper Text Markup Language followed by HTML. Default: false; opt in when mirroring Markdig's UseAbbreviations extension.

public Boolean GenericAttributes { get; set; } #

Enable Markdig-style generic trailing attribute blocks on supported Markdown elements, for example # Heading {#id .wide key="value"}. Default: false; opt in when mirroring Markdig's UseGenericAttributes extension.

public Boolean CustomContainers { get; set; } #

Enable Markdig-style colon-fenced custom containers such as ::: note. Default: false; opt in when mirroring Markdig's UseCustomContainers extension.

public Boolean SingleTildeStrikethrough { get; set; } #

When true, GitHub Flavored Markdown-style single-tilde strikethrough (~text~) is enabled. Default: false.

public Boolean Highlight { get; set; } #

When true, Markdig emphasis-extra highlight/mark delimiters (==text==) are enabled. This is disabled by strict CommonMark, GFM, and portable profiles unless explicitly opted in.

public Boolean Inserted { get; set; } #

When true, Markdig emphasis-extra inserted-text delimiters (++text++) are enabled. This is disabled by strict CommonMark, GFM, and portable profiles unless explicitly opted in.

public Boolean Superscript { get; set; } #

When true, Markdig emphasis-extra superscript delimiters (^text^) are enabled. This is disabled by strict CommonMark, GFM, and portable profiles unless explicitly opted in.

public Boolean Subscript { get; set; } #

When true, Markdig emphasis-extra subscript (~text~) is enabled. This is disabled by strict CommonMark and GFM profiles because GFM can use the same delimiter for single-tilde strikethrough.

public Boolean CjkFriendlyEmphasis { get; set; } #

When true, star emphasis uses Markdig's CJK-friendly delimiter behavior so emphasis can open or close next to CJK text and CJK punctuation without relaxing underscore intraword rules. This mirrors Markdig's UseCjkFriendlyEmphasis pipeline option.

public Boolean PreferNarrativeSingleLineDefinitions { get; set; } #

When true, isolated single-line Term: Definition patterns stay as narrative paragraphs. Consecutive definition-like lines still parse as a definition list.

public Boolean HtmlBlocks { get; set; } #

Enable raw HTML blocks. When set to false, block-level HTML is preserved as plain text so that readers can postprocess or render it verbatim.

public Boolean AllowLooseHtmlBlockStartTags { get; set; } #

When true, CommonMark type-6 HTML block starts follow the spec's loose tag-name condition and do not require the opening tag to be syntactically complete. Strict OfficeIMO parsing keeps this disabled so malformed block tags do not consume following parseable Markdown content.

public Boolean PreserveHtmlBlockBlankLineContent { get; set; } #

When true, selected OfficeIMO-friendly raw HTML containers such as table and details can continue across blank lines until their matching closing tag. Strict CommonMark/GFM profiles disable this because CommonMark HTML block types 6 and 7 end at the next blank line.

public Boolean Paragraphs { get; set; } #

Enable paragraph parsing and basic inlines.

public Boolean AutolinkUrls { get; set; } #

When true, auto-detects plain http(s)://... URLs in text and turns them into links. Default: true.

public Boolean AutolinkAllowDomainWithoutPeriod { get; set; } #

When true, bare URL autolinks may target hosts without a period, such as https://localhost or www.local. OfficeIMO defaults to true for compatibility with existing documents; stricter Markdig/GFM-style profiles can set this to false.

public Boolean AutolinkAllowQueryAndFragmentSpecialCharacters { get; set; } #

When true, bare URL autolinks may keep balanced parentheses and ampersands inside query strings or fragments. OfficeIMO defaults to false for compatibility with existing conservative parsing; the GitHub Flavored Markdown profile enables this to match Markdig/GFM autolink behavior.

public Boolean AutolinkAllowBalancedParenthesesWithTrailingPunctuation { get; set; } #

When true, bare URL autolinks may keep a balanced parenthesized segment inside the link while leaving an extra closing parenthesis or trailing punctuation outside the link. OfficeIMO defaults to false for compatibility with its older conservative parser; the GitHub Flavored Markdown profile enables this for Markdig/GFM-style autolinks.

public Boolean AutolinkAllowTrailingPunctuationBeforeClosingParenthesis { get; set; } #

When true, bare URL autolinks may keep final punctuation such as ., ,, ;, !, or ? inside the link when the next source character is a closing parenthesis outside the URL. Markdig UseAutoLinks keeps that punctuation; cmark-gfm trims at least the period in the comparable GFM case, so this remains opt-in.

public Boolean AutolinkTrimSingleTrailingPunctuationOrUnderscore { get; set; } #

When true, bare URL autolinks trim at most one final punctuation character or underscore from the parsed target. Markdig UseAutoLinks keeps earlier repeated punctuation inside the link; OfficeIMO's legacy behavior trims the full trailing run.

public Boolean AutolinkKeepTrailingSemicolonPunctuation { get; set; } #

When true, bare URL autolinks keep trailing semicolons inside the consumed URL target. Markdig UseAutoLinks keeps semicolons while still trimming other single trailing punctuation such as periods and commas.

public Boolean AutolinkRequireLowercaseWwwPrefix { get; set; } #

When true, bare www. autolinks require the prefix itself to be lowercase. The host portion after the prefix may still use mixed case.

public Boolean AutolinkRejectUnderscoreInWwwHost { get; set; } #

When true, bare www. autolinks reject host labels containing underscores. This mirrors Markdig UseAutoLinks while leaving OfficeIMO's older permissive behavior available for existing consumers.

public Boolean AutolinkRejectUnderscoreInWwwSubdomainLabels { get; set; } #

When true, bare www. autolinks reject underscores in labels after the first host label. This mirrors cmark-gfm's extension fixture boundary while allowing www._first.example.

public Boolean AutolinkRejectUnderscoreInUrlHost { get; set; } #

When true, bare URL autolinks with an authority such as https:// or ftp:// reject host labels containing underscores. Markdig UseAutoLinks leaves those URL-shaped tokens as literal text; OfficeIMO's legacy behavior can still link them.

public Boolean AutolinkRejectUserInfoAuthority { get; set; } #

When true, bare URL autolinks reject authority/user-info forms containing @, such as https://user@example.com/path. Markdig UseAutoLinks leaves those tokens as literal text; OfficeIMO's legacy behavior can still link them.

public Boolean AutolinkAllowClosingBracketInUrl { get; set; } #

When true, bare URL autolinks may include a closing square bracket ] in the consumed URL target. Markdig UseAutoLinks keeps this character inside the link; OfficeIMO's legacy behavior stops before it to avoid crossing bracketed text.

public Boolean AutolinkKeepTrailingQuotePunctuation { get; set; } #

When true, bare URL autolinks keep trailing single or double quote characters inside the consumed URL target. Markdig UseAutoLinks keeps these quote characters when no matching opening quote prevents the autolink.

public Boolean AutolinkRequireLowercaseBareSchemePrefix { get; set; } #

When true, bare scheme autolinks such as mailto:, ftp://, and tel: require the scheme prefix itself to be lowercase.

public Boolean AutolinkBareMailtoDisplayAddressOnly { get; set; } #

When true, a bare mailto:user@example.com autolink displays only user@example.com while keeping the link target as mailto:user@example.com. Markdig UseAutoLinks uses the address-only display; cmark-gfm keeps the full mailto: source text as the display label.

public Boolean AutolinkBareMailtoMarkdigSemicolonHandling { get; set; } #

When true, bare mailto: autolinks use Markdig-style semicolon handling: address-only tokens followed by a semicolon remain literal, while path, query, or fragment targets keep trailing semicolons inside the link.

public String AutolinkValidPreviousCharacters { get; set; } #

Optional previous-character allow-list for bare URL/email autolinks. When set, a bare autolink may start at the beginning of text, after whitespace, or after one of these characters. When null, OfficeIMO's legacy boundary heuristic is used.

public Boolean AutolinkBareSchemeUrls { get; set; } #

When true, auto-detects selected bare URI schemes such as mailto:, ftp://, tel:, and xmpp:. Use AutolinkBareSchemePrefixes to narrow the scheme set for a compatibility profile. Default: false; enabled by CreateGitHubFlavoredMarkdownProfile.

public String[] AutolinkBareSchemePrefixes { get; set; } #

Optional bare-scheme prefix allow-list used when AutolinkBareSchemeUrls is enabled. Prefixes should include their punctuation, for example mailto:, ftp://, or tel:. When null, OfficeIMO's built-in selected scheme set is used.

public Boolean AutolinkWwwUrls { get; set; } #

When true, auto-detects plain www.example.com URLs in text and turns them into links. Default: true.

public String AutolinkWwwScheme { get; set; } #

Scheme prefix to use for AutolinkWwwUrls (for example https://). Default: https://.

public Boolean AutolinkEmails { get; set; } #

When true, auto-detects plain emails in text (for example user@example.com) and turns them into mailto: links. Default: true.

public Boolean BackslashHardBreaks { get; set; } #

When true, a trailing backslash at the end of a paragraph line is treated as a hard line break (like GitHub/CommonMark). This is in addition to the "two trailing spaces" hard break form. Default: true.

public Boolean SoftLineBreaksAsHardLineBreaks { get; set; } #

When true, ordinary soft line breaks inside paragraphs are parsed as hard line breaks. This mirrors Markdig's UseSoftlineBreakAsHardlineBreak pipeline option without changing the default CommonMark/GFM soft-break behavior.

public Boolean InlineHtml { get; set; } #

Enable inline HTML interpretations (e.g. <br>, <u>...</u>). When disabled, HTML tags remain literal text and no HTML decoding is performed.

Examples


var options = new MarkdownReaderOptions {
    HtmlBlocks = false,
    InlineHtml = false,
};
// MarkdownReader.Read("hello", options) keeps the HTML tokens inside text runs.
            
public String BaseUri { get; set; } #

Optional base URI used to resolve relative links/images. When set, relative URLs (not starting with http/https,//,#,mailto:,data:) are converted to absolute using this base during parsing.

public Boolean DisallowScriptUrls { get; set; } #

When true, blocks scriptable URL schemes (e.g. javascript:, vbscript:) during parsing. If a link/image uses a blocked scheme, it is treated as plain text instead of producing a clickable/linkable node. Default: true.

public Boolean DisallowFileUrls { get; set; } #

When true, blocks file: URLs (and Windows drive-like C:\ paths) during parsing. Default: false to preserve legacy behavior for local/offline documents.

public Boolean AllowMailtoUrls { get; set; } #

When false, mailto: links are treated as plain text. Default: true.

public Boolean AllowDataUrls { get; set; } #

When false, data: URLs are treated as plain text. Default: true.

public Boolean AllowProtocolRelativeUrls { get; set; } #

When false, protocol-relative URLs (//example.com) are treated as plain text. Default: true.

public Boolean RestrictUrlSchemes { get; set; } #

When true, only URL schemes listed in AllowedUrlSchemes are allowed. Relative URLs and fragments are still allowed. Default: false to preserve legacy behavior.

public String[] AllowedUrlSchemes { get; set; } #

List of allowed URL schemes when RestrictUrlSchemes is enabled. Values are compared case-insensitively and should not include the trailing colon. Default: http, https, mailto.

public MarkdownInputNormalizationOptions InputNormalization { get; set; } #

Optional markdown input normalization before parsing. Defaults are conservative (no transformations).

public Boolean PreserveTrivia { get; set; } #

When true, syntax-backed parse results retain the raw markdown input beside the normalized source text used for source spans. This is groundwork for lossless trivia/roundtrip support; semantic MarkdownWriteOptions) output remains normalized markdown generation.

public Nullable<Int32> MaxInputCharacters { get; set; } #

Optional maximum input length, in characters, accepted by MarkdownReader. When set and exceeded, parsing fails fast with an ArgumentOutOfRangeException.

public List<MarkdownFencedBlockExtension> FencedBlockExtensions { get; } #

Optional language-based fenced block factories that can produce specialized AST nodes instead of plain CodeBlock instances. Later registrations win when languages overlap.

public List<MarkdownBlockParserExtension> BlockParserExtensions { get; } #

Optional block parser extensions layered into the default reader pipeline at named placement anchors. Profiles use this to opt into OfficeIMO/GFM-style non-core block syntax such as callouts, TOC placeholders, and footnotes.

public List<MarkdownInlineParserExtension> InlineParserExtensions { get; } #

Optional ordered inline parser extensions that get a chance to recognize custom inline tokens before the built-in inline parser handles the current position.

public List<MarkdownInlineTransformExtension> InlineTransformExtensions { get; } #

Optional ordered post-parse inline AST transforms. These run after built-in inline parsing and input normalization, before document-level transforms.

public List<IMarkdownDocumentTransform> DocumentTransforms { get; } #

Optional ordered post-parse document transforms. Use these for AST-level upgrades and host-specific semantic rewrites after markdown has been parsed.

Examples


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

var document = MarkdownReader.Parse(markdown, options);