API Reference
MarkdownNativeDocument
Native, AST-backed projection of a parsed markdown document for UI hosts that need structured blocks and source spans.
Inheritance
- Object
- MarkdownNativeDocument
Usage
This type appears in these public API surfaces even when no hand-authored example is attached directly to the page.
Returned or exposed by
Methods
public IEnumerable<TBlock> BlocksOfType<TBlock>() #IEnumerable<TBlock>Type Parameters
- TBlock
BlocksOfType``1() #Enumerates top-level native blocks of the requested projection type.
public MarkdownNativeSourceEdit CreateReplaceEdit(MarkdownNativeInline inline, String replacementMarkdown) #MarkdownNativeSourceEditCreates a non-mutating source edit that replaces a source span.
Parameters
- sourceSpan OfficeIMO.Markdown.MarkdownSourceSpan
- replacementMarkdown System.String
CreateReplaceEdit(OfficeIMO.Markdown.MarkdownNativeBlock block, System.String replacementMarkdown) #Creates a non-mutating source edit that replaces a native block.
Parameters
- block OfficeIMO.Markdown.MarkdownNativeBlock
- replacementMarkdown System.String
CreateReplaceEdit(OfficeIMO.Markdown.MarkdownNativeInline inline, System.String replacementMarkdown) #Creates a non-mutating source edit that replaces a native inline.
Parameters
- inline OfficeIMO.Markdown.MarkdownNativeInline
- replacementMarkdown System.String
public IEnumerable<MarkdownNativeBlock> DescendantBlocksAndSelf() #IEnumerable<MarkdownNativeBlock>Enumerates all native blocks in document order, including nested blocks.
public IEnumerable<MarkdownNativeInline> EnumerateInlines() #IEnumerable<MarkdownNativeInline>Enumerates all native inline runs in document order.
public MarkdownNativeBlock FindBlockAtLine(Int32 lineNumber) #MarkdownNativeBlockFinds the first native block whose source span contains the supplied 1-based line.
Parameters
- lineNumber System.Int32
public MarkdownNativeBlock FindBlockAtPosition(Int32 lineNumber, Int32 columnNumber) #MarkdownNativeBlockFinds the first native block whose source span contains the supplied 1-based line and column.
Parameters
- lineNumber System.Int32
- columnNumber System.Int32
public MarkdownNativeBlock FindBlockById(String id) #MarkdownNativeBlockFinds a native block by deterministic id.
Parameters
- id System.String
public MarkdownNativeInline FindInlineAtPosition(Int32 lineNumber, Int32 columnNumber) #MarkdownNativeInlineFinds the first native inline whose source span contains the supplied 1-based line and column.
Parameters
- lineNumber System.Int32
- columnNumber System.Int32
public MarkdownNativeInline FindInlineById(String id) #MarkdownNativeInlineFinds a native inline by deterministic id.
Parameters
- id System.String
public static MarkdownNativeDocument FromParseResult(MarkdownParseResult parseResult, String sourceMarkdown = null, MarkdownNativeDocumentSourceKind sourceKind = ReaderInput) #MarkdownNativeDocumentBuilds a native projection from an existing syntax-backed parse result.
Parameters
- parseResult OfficeIMO.Markdown.MarkdownParseResult
- sourceMarkdown System.String = null
- sourceKind OfficeIMO.Markdown.MarkdownNativeDocumentSourceKind = ReaderInput
public IReadOnlyList<MarkdownNativeBlock> GetBlockPath(String id) #IReadOnlyList<MarkdownNativeBlock>Returns the top-level-to-target block path for a block id.
Parameters
- id System.String
public static MarkdownNativeDocument Parse(String markdown, MarkdownReaderOptions options = null) #MarkdownNativeDocumentParses markdown into the typed object model, syntax tree, diagnostics, and native block projection.
Parameters
- markdown System.String
- options OfficeIMO.Markdown.MarkdownReaderOptions = null
public MarkdownNativeDocumentSnapshot ToSnapshot() #MarkdownNativeDocumentSnapshotCreates a UI-safe snapshot of this document without parser object references.
Inherited Methods
public override Boolean Equals(Object obj) #BooleanParameters
- obj Object
Properties
public MarkdownParseResult ParseResult { get; } #Underlying parse result, including original/final syntax trees and diagnostics.
public MarkdownDoc Document { get; } #Parsed OfficeIMO markdown document.
public MarkdownSyntaxNode SyntaxTree { get; } #Original syntax tree produced before document transforms were applied.
public MarkdownSyntaxNode FinalSyntaxTree { get; } #Final syntax tree aligned with Document.
public IReadOnlyList<MarkdownDocumentTransformDiagnostic> TransformDiagnostics { get; } #Document-transform diagnostics captured during parsing.
public String SourceMarkdown { get; } #Markdown source text whose source spans back this projection.
public MarkdownNativeDocumentSourceKind SourceKind { get; } #Identifies whether SourceMarkdown is direct reader input or renderer-preprocessed markdown.
public IReadOnlyList<MarkdownNativeBlock> Blocks { get; } #Top-level native block projection in document order.
public IReadOnlyList<MarkdownNativeDiagnostic> Diagnostics { get; } #Projection diagnostics including transform notices and unsupported block fallbacks.