InlineProcessor Class
The inline parser state used by all InlineParser.
public class InlineProcessorConstructors
| Name | Description |
|---|---|
| InlineProcessor(MarkdownDocument, InlineParserList, bool, MarkdownParserContext?, bool) | Initializes a new instance of the InlineProcessor class. |
InlineProcessor(MarkdownDocument, InlineParserList, bool, MarkdownParserContext?, bool)
InlineProcessor.csInitializes a new instance of the InlineProcessor class.
public InlineProcessor(MarkdownDocument document, InlineParserList parsers, bool preciseSourcelocation, MarkdownParserContext? context, bool trackTrivia = false)Parameters
documentMarkdownDocument- The document.
parsersInlineParserList- The parsers.
preciseSourcelocationbool- A value indicating whether to provide precise source location.
contextMarkdownParserContext?- A parser context used for the parsing.
trackTriviabool- Whether to parse trivia such as whitespace, extra heading characters and unescaped string values.
Exceptions
Properties
| Name | Description |
|---|---|
| Block | Gets the current block being processed. |
| BlockNew | Gets or sets the new block to replace the block being processed. |
| Context | Gets the parser context or null if none is available. |
| DebugLog | Gets or sets the debug log writer. No log if null. |
| Document | Gets the root document. |
| Inline | Gets or sets the current inline. Used by InlineParser to return a new inline if match was successfull |
| LineIndex | Gets or sets the index of the line from the begining of the document being processed. |
| LiteralInlineParser | Gets the literal inline parser. |
| ParserStates | Gets the parser states that can be used by InlineParser using their ParserBase<TProcessor>.Index property. |
| Parsers | Gets the list of inline parsers. |
| PreciseSourceLocation | Gets a value indicating whether to provide precise source location. |
| Root | Gets the root container of the current InlineProcessor.Block. |
| TrackTrivia | True to parse trivia such as whitespace, extra heading characters and unescaped string values. |
Block
InlineProcessor.csBlockNew
InlineProcessor.csContext
InlineProcessor.csGets the parser context or null if none is available.
public MarkdownParserContext? Context { get; }Property value
DebugLog
InlineProcessor.csGets or sets the debug log writer. No log if null.
public TextWriter? DebugLog { get; set; }Property value
Document
InlineProcessor.csInline
InlineProcessor.csGets or sets the current inline. Used by InlineParser to return a new inline if match was successfull
public Inline? Inline { get; set; }Property value
LineIndex
InlineProcessor.csLiteralInlineParser
InlineProcessor.csGets the literal inline parser.
public LiteralInlineParser LiteralInlineParser { get; }Property value
ParserStates
InlineProcessor.csGets the parser states that can be used by InlineParser using their ParserBase<TProcessor>.Index property.
public object[] ParserStates { get; }Property value
object[]
Parsers
InlineProcessor.csPreciseSourceLocation
InlineProcessor.csGets the root container of the current InlineProcessor.Block.
public ContainerInline? Root { get; }Property value
TrackTrivia
InlineProcessor.csMethods
| Name | Description |
|---|---|
| Emit(Inline) | Emits an inline into the deepest open inline container for the current leaf. |
| GetParserState<TState>(InlineParser) | Gets or creates a parser state instance scoped to the current leaf processing pass. |
| GetParserState<TState>(InlineParser, Func<TState>) | Gets or creates a parser state instance scoped to the current leaf processing pass. |
| GetSourcePosition(int) | Gets the source position for the specified offset within the current slice. |
| GetSourcePosition(int, int, int) | Gets the source position for the specified offset within the current slice. |
| GetSourcePositionFromLocalSpan(SourceSpan) | Gets source position from local span. |
| PostProcessInlines(int, Inline?, Inline?, bool) | Performs the post process inlines operation. |
| ProcessInlineLeaf(LeafBlock) | Processes the inline of the specified LeafBlock. |
| ReplaceParentContainer(ContainerBlock, ContainerBlock) | Requests a replacement for a parent container while processing the current leaf block. |
Emit(Inline)
InlineProcessor.csEmits an inline into the deepest open inline container for the current leaf.
Parameters
inlineInline- The inline to emit.
Exceptions
ArgumentNullException- Thrown when
inlineis null. ArgumentException- Thrown when
inlineis already attached to a parent.
GetParserState overloads
GetParserState<TState>(InlineParser)
InlineProcessor.csGets or creates a parser state instance scoped to the current leaf processing pass.
public TState GetParserState<TState>(InlineParser parser) where TState : class, new()Type parameters
TState- The type of state to get or create.
Parameters
parserInlineParser- The parser requesting the state.
Returns
TState The existing or newly created state instance.
GetParserState<TState>(InlineParser, Func<TState>)
InlineProcessor.csGets or creates a parser state instance scoped to the current leaf processing pass.
public TState GetParserState<TState>(InlineParser parser, Func<TState> factory) where TState : classType parameters
TState- The type of state to get or create.
Parameters
parserInlineParser- The parser requesting the state.
factoryFunc<TState>- A factory used to create a state instance when none exists yet.
Returns
TState The existing or newly created state instance.
Exceptions
ArgumentNullException- Thrown when
parserorfactoryis null. InvalidOperationException- Thrown if
factoryreturnsnull.
GetSourcePosition overloads
GetSourcePosition(int)
InlineProcessor.csGetSourcePosition(int, int, int)
InlineProcessor.csGetSourcePositionFromLocalSpan(SourceSpan)
InlineProcessor.csGets source position from local span.
public SourceSpan GetSourcePositionFromLocalSpan(SourceSpan span)PostProcessInlines(int, Inline?, Inline?, bool)
InlineProcessor.csProcessInlineLeaf(LeafBlock)
InlineProcessor.csReplaceParentContainer(ContainerBlock, ContainerBlock)
InlineProcessor.csRequests a replacement for a parent container while processing the current leaf block.
public void ReplaceParentContainer(ContainerBlock previousParentContainer, ContainerBlock newParentContainer)Parameters
previousParentContainerContainerBlock- The parent container that has already been replaced in the block tree.
newParentContainerContainerBlock- The replacement parent container.
Exceptions
ArgumentNullException- Thrown if
previousParentContainerornewParentContaineris null. InvalidOperationException- Thrown if a replacement has already been requested for this leaf processing pass.
Remarks
This method does not perform the replacement in the block tree. Callers must already update the AST (replace the parent block and transfer children as needed). This method only synchronizes the traversal state used by MarkdownParser.ProcessInlines.