MarkdownLoadOptions
OfficeIMO.Markdown
Options for the Markdown reader. Profiles and feature toggles shape the generic markdown core, while MarkdownLoadOptions.BlockParserExtensions and MarkdownLoadOptions.InlineParserExtensions control opt-in syntax such as OfficeIMO callouts, TOC placeholders, footnotes, or custom inline tokens.
Inheritance
- object
- MarkdownLoadOptions
Usage
Explore 28 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.
Returned or exposed by 15
- Property MarkdownBlockParserContext.Options
- Property MarkdownBlockParserExtension.IsEnabled
- Property MarkdownDocumentTransformContext.ReaderOptions
- Property MarkdownInlineParserContext.Options
- Property MarkdownInlineParserExtension.IsEnabled
- Property MarkdownInlineTransformContext.Options
- Property MarkdownInlineTransformExtension.IsEnabled
- Method MarkdownLoadOptions.Clone
- Method MarkdownLoadOptions.CreateCommonMarkProfile
- Method MarkdownLoadOptions.CreateGitHubFlavoredMarkdownProfile
- Method MarkdownLoadOptions.CreateOfficeIMOProfile
- Method MarkdownLoadOptions.CreatePortableProfile
- Method MarkdownLoadOptions.CreateProfile
- Property MarkdownLoadOptions.UntrustedDefaults
- Method MarkdownTranscriptPreparation.CreateIntelligenceXTranscriptReaderOptions
Accepted by parameters 13
- Method IMarkdownBlockParser.TryParse
- Constructor MarkdownBlockParserExtension.MarkdownBlockParserExtension
- Method MarkdownBlockParserExtension.AppliesTo
- Method MarkdownDocument.Load
- Method MarkdownDocument.LoadAsync
- Method MarkdownDocument.Parse
- Constructor MarkdownDocumentTransformContext.MarkdownDocumentTransformContext
- Constructor MarkdownInlineParserExtension.MarkdownInlineParserExtension
- Method MarkdownInlineParserExtension.AppliesTo
- Constructor MarkdownInlineTransformExtension.MarkdownInlineTransformExtension
- Method MarkdownInlineTransformExtension.AppliesTo
- Method MarkdownNativeDocument.Parse
- Method MarkdownTranscriptPreparation.ApplyIntelligenceXTranscriptReaderContract
Constructors
public MarkdownLoadOptions() #Creates a new OfficeIMO-flavored reader configuration with the built-in block syntax extensions registered.
Methods
public MarkdownLoadOptions Clone() #Creates an independent copy of the current reader configuration, including profile toggles and extension registrations.
Returns
MarkdownLoadOptionspublic static MarkdownLoadOptions CreateCommonMarkProfile() #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.
Returns
MarkdownLoadOptionspublic static MarkdownLoadOptions CreateGitHubFlavoredMarkdownProfile() #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.
Returns
MarkdownLoadOptionspublic static MarkdownLoadOptions CreateOfficeIMOProfile() #Creates the explicit OfficeIMO profile. This mirrors the library defaults and keeps host-oriented extensions such as callouts, TOC placeholders, and footnotes enabled.
Returns
MarkdownLoadOptionspublic static MarkdownLoadOptions CreatePortableProfile() #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.
Returns
MarkdownLoadOptionspublic static MarkdownLoadOptions CreateProfile(MarkdownDialectProfile profile) #Creates a reader configuration for the requested dialect/profile.
Parameters
- profile OfficeIMO.Markdown.MarkdownLoadOptions.MarkdownDialectProfile
Returns
MarkdownLoadOptionsInherited Methods
Properties
public bool CaptureSyntaxTree { get; set; } #Retains syntax and source bindings. False selects semantic-only parsing for large reads.
public static MarkdownLoadOptions UntrustedDefaults { get; } #Creates bounded parser settings for documents from outside.
public long? MaxInputBytes { get; set; } #Maximum buffered source bytes, or null for an explicitly unbounded source.
public Encoding? Encoding { get; set; } #Source encoding. A byte-order mark takes precedence; null uses UTF-8.
public bool FrontMatter { get; set; } #Enable YAML front matter parsing at the very top of the file.
public bool 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 bool FencedCode { get; set; } #Enable fenced code blocks (```lang ... ```), including caption on the following _line_ if present.
public bool IndentedCodeBlocks { get; set; } #Enable indented code blocks (lines indented by 4 spaces).
public bool Images { get; set; } #Enable images (standalone lines) with optional caption on the next _italic_ line.
public bool 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 bool UnorderedLists { get; set; } #Enable unordered lists and task lists.
public bool TaskLists { get; set; } #Enable task list checkbox parsing inside unordered and ordered list items.
public bool OrderedLists { get; set; } #Enable ordered (numbered) lists.
public bool 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 bool 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 bool Tables { get; set; } #Enable pipe tables with optional header + alignment row.
public bool 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 bool 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 bool 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 bool DefinitionLists { get; set; } #Enable definition lists (Term: Definition lines).
public bool TocPlaceholders { get; set; } #Enable placeholder TOC markers such as [TOC] and {:toc}.
public bool Footnotes { get; set; } #Enable footnote references and footnote definition blocks.
public bool 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 bool 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 bool CustomContainers { get; set; } #Enable Markdig-style colon-fenced custom containers such as ::: note. Default: false; opt in when mirroring Markdig's UseCustomContainers extension.
public bool SingleTildeStrikethrough { get; set; } #When true, GitHub Flavored Markdown-style single-tilde strikethrough (~text~) is enabled. Default: false.
public bool 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 bool 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 bool 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 bool 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 bool 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 bool 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 bool 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 bool 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 bool 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 bool Paragraphs { get; set; } #Enable paragraph parsing and basic inlines.
public bool AutolinkUrls { get; set; } #When true, auto-detects plain http(s)://... URLs in text and turns them into links. Default: true.
public bool 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 bool 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 bool 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 bool 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 bool 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 bool 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 bool 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 bool 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 bool 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 bool 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 bool AutolinkRejectUserInfoAuthority { get; set; } #When true, bare URL autolinks reject authority/user-info forms containing @, such as https://[email protected]/path. Markdig UseAutoLinks leaves those tokens as literal text; OfficeIMO's legacy behavior can still link them.
public bool 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 bool 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 bool AutolinkRequireLowercaseBareSchemePrefix { get; set; } #When true, bare scheme autolinks such as mailto:, ftp://, and tel: require the scheme prefix itself to be lowercase.
public bool AutolinkBareMailtoDisplayAddressOnly { get; set; } #When true, a bare mailto:[email protected] autolink displays only [email protected] while keeping the link target as mailto:[email protected]. Markdig UseAutoLinks uses the address-only display; cmark-gfm keeps the full mailto: source text as the display label.
public bool 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 bool AutolinkBareSchemeUrls { get; set; } #When true, auto-detects selected bare URI schemes such as mailto:, ftp://, tel:, and xmpp:. Use MarkdownLoadOptions.AutolinkBareSchemePrefixes to narrow the scheme set for a compatibility profile. Default: false; enabled by MarkdownLoadOptions.CreateGitHubFlavoredMarkdownProfile.
public string[]? AutolinkBareSchemePrefixes { get; set; } #Optional bare-scheme prefix allow-list used when MarkdownLoadOptions.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 bool 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 MarkdownLoadOptions.AutolinkWwwUrls (for example https://). Default: https://.
public bool AutolinkEmails { get; set; } #When true, auto-detects plain emails in text (for example [email protected]) and turns them into mailto: links. Default: true.
public bool 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 bool 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 bool 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 MarkdownLoadOptions {
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 bool 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 bool 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 bool AllowMailtoUrls { get; set; } #When false, mailto: links are treated as plain text. Default: true.
public bool AllowDataUrls { get; set; } #When false, data: URLs are treated as plain text. Default: true.
public bool AllowProtocolRelativeUrls { get; set; } #When false, protocol-relative URLs (//example.com) are treated as plain text. Default: true.
public bool RestrictUrlSchemes { get; set; } #When true, only URL schemes listed in MarkdownLoadOptions.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 MarkdownLoadOptions.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 bool 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 MarkdownDocument.ToMarkdown output remains normalized markdown generation.
public int? MaxInputCharacters { get; set; } #Optional maximum input length, in characters, accepted by MarkdownReader. When set and exceeded, parsing fails fast with an ArgumentOutOfRangeException.
public int MaxNestingDepth { get; set; } #Maximum recursive block-container depth accepted while parsing nested lists, quotes, details, callouts, footnotes, and similar constructs. Default: 64.
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 = MarkdownLoadOptions.CreatePortableProfile();
options.DocumentTransforms.Add(
new MarkdownJsonVisualCodeBlockTransform(MarkdownVisualFenceLanguageMode.GenericSemanticFence));
var document = MarkdownDocument.Parse(markdown, options);