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 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 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 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 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 SingleTildeStrikethrough { get; set; } #

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

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 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 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 [email protected]) 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 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 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<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);