nuget server logo nuget api documents
↑

API Docs / Microsoft.VisualBasic.Runtime / BlockParser

BlockParser

Full name Microsoft.VisualBasic.ApplicationServices.Terminal.BlockParser Assembly Microsoft.VisualBasic.Runtime Members 9

The block level markdown parser: it splits the document into the block elements and then delegates the text of each block to the InlineParser or the TableRenderer.

00 Remarks

The block elements that are supported here:

  • the # atx header
  • the ``` fenced code block, of which the content is never parsed
  • the pipe table
  • the > block quote
  • the -/+/*/1. list item
  • the ---/***/___ horizontal rule
  • the normal paragraph

Note that the setext header(the ===/--- underlined header) is not supported, as the --- underline is ambiguous with the horizontal rule, and the horizontal rule always wins here.

01 Syntax

Microsoft.VisualBasic.ApplicationServices.Terminal.BlockParser

02 Methods

NameOverloadsSummary
Parse 1 parse the whole markdown document
ParseFencedCode 1 the fenced code block is emitted as the plain text, its content is never parsed by the inline parser.
AppendSpans 1 appends the inline spans of one line and then terminates the line
IsHorizontalRule 1 the ---/*/_ horizontal rule line
IsTableStart 1 a table is started by a pipe line that is followed by the --|--- delimiter row, this rule is much more reliable than just testing the leading pipe char of the line.
HeaderLevel 1 gets the atx header level of the given line, or ZERO if it is not a header
StripListItem 1 strips the -/+/*/1. list marker from the line
StripQuoteMarker 1 strips the leading > marker and its following space

03 Fields

NameOverloadsSummary
LF 1 the line feed of the rendered result, the cr-lf pair is never used in this module to keep the output consistent on all platforms.

04 Members

method Parse #
Parse(String())

parse the whole markdown document

Parameters
NameTypeDescription
linesString()

the document lines, without the line feed char

method ParseFencedCode #
ParseFencedCode(String(), Int32)

the fenced code block is emitted as the plain text, its content is never parsed by the inline parser.

Parameters
NameTypeDescription
linesString()

-

fromInt32

the index of the opening fence line

Returns

the index of the next line after the closing fence

method AppendSpans #

appends the inline spans of one line and then terminates the line

Parameters
NameTypeDescription
spansList(Of TextSpan)

-

fallbackStyleConsoleFormat

the style of the line feed char, which is required when the line has no content at all.

method IsHorizontalRule #
IsHorizontalRule(String)

the ---/***/___ horizontal rule line

Parameters
NameTypeDescription
lineString

-

method IsTableStart #
IsTableStart(String(), Int32)

a table is started by a pipe line that is followed by the --|--- delimiter row, this rule is much more reliable than just testing the leading pipe char of the line.

Parameters
NameTypeDescription
linesString()

-

iInt32

-

method HeaderLevel #
HeaderLevel(String)

gets the atx header level of the given line, or ZERO if it is not a header

Parameters
NameTypeDescription
lineString

-

Returns

a value between 1 and 6

method StripListItem #
StripListItem(String, String)

strips the -/+/*/1. list marker from the line

Parameters
NameTypeDescription
lineString

-

markerString

the stripped marker text

Returns

the content of the list item, or a null reference if the given line is not a list item at all.

method StripQuoteMarker #
StripQuoteMarker(String)

strips the leading > marker and its following space

Parameters
NameTypeDescription
lineString

-

field LF #
LF

the line feed of the rendered result, the cr-lf pair is never used in this module to keep the output consistent on all platforms.