Table of Contents

Class MarkdownExtractor

Namespace
Qavren.Edge.Ingestion
Assembly
Qavren.Edge.Ingestion.dll

Spec 7.3's Markdown extractor, over Markdig. Blocks come from the top-level Markdig.Syntax.MarkdownDocument children, and because every MarkdownObject carries a SourceSpan, a block's [Start, End) is the VERBATIM source range — fences, tables and links survive intact instead of being re-rendered.

public sealed class MarkdownExtractor : IDocumentExtractor
Inheritance
MarkdownExtractor
Implements
Inherited Members

Remarks

Spec 17 item 9's gate, resolved by measurement on Markdig 1.3.2: block spans index the string handed to Markdown.Parse, character for character (SourceSpan.End is INCLUSIVE, so the half-open end is End + 1). So this extractor normalises FIRST and parses the normalised buffer — the first of the two branches the plan allows — and Text is exactly the string that was parsed. No re-parse is needed and no offset is translated.

DEVIATION from spec 7.3 and plan step 6, recorded here until they are amended: blocks come from the top-level children EXCEPT for Table and ListBlock, which are descended ONE level so a table yields one TableRow per row and a list one ListItem per top-level item. Taken literally, the top-level rule leaves both of those kinds dead vocabulary and leaves Task 4.1's RepeatTableHeaderRow with no granularity to repeat. Spans stay verbatim source ranges either way.

The pipeline is built explicitly and never with UseAdvancedExtensions(), which pulls in roughly eighteen. Markdig earns its place by being a parser: a ## line inside a fenced or indented code block is a code line, a four-backtick fence containing three backticks is one block, and raw HTML is one HtmlBlock rather than prose to be split.

Constructors

MarkdownExtractor()
MarkdownExtractor(MarkdownExtractorOptions)

Properties

Extensions

Lower-case, dotted.

Id

Stable; feeds the recipe hash.

MediaTypes

The media types this extractor claims.

Version

Bump when output changes for identical input.

Methods

CanExtract(DocumentSourceItem)

A last word over the registry's media-type and extension match.

ExtractAsync(DocumentSourceItem, ExtractionContext, CancellationToken)

Extracts one document. The stream is opened here, not by the caller, and the returned document's block offsets index Text.