Class MarkdownReader
Reads Markdown into the mutable DocWright document model.
public sealed class MarkdownReader : IDocumentReader
- Inheritance
-
MarkdownReader
- Implements
- Inherited Members
Remarks
The dialect is CommonMark 0.31.2, optionally with the three GitHub-flavored extensions DocWright implements — tables, strikethrough and task list items. Which one is in force is Flavor, and it is named rather than implied because "Markdown" is not a specification and a reader that will not say which one it follows cannot be reasoned about.
No network or file-system access happens on a document's behalf. An image whose
reference is a path or a URL is reported and rendered as its alternative text; only a
data: URI, whose bytes the caller already handed over, is imported. A document-driven
fetch would be an SSRF surface.
Raw HTML is matched but not interpreted, because the Word document model has no HTML
surface. By default it is kept as literal text and reported; a caller who wants HTML
interpreted wants DocWright.Formats.Html, which is a different reader.
Instances are stateless and safe for concurrent use; one read allocates one parse.
Constructors
- MarkdownReader()
Initializes a reader with default options.
- MarkdownReader(MarkdownReadOptions)
Initializes a reader with format-specific options.
Properties
- Format
Gets the format this reader handles.
Methods
- CanRead(Stream)
Sniffs whether a stream looks like Markdown, restoring its position before returning.
- Read(Stream, DocumentReadOptions, IConversionDiagnostics)
Reads a document from the stream.