MarkdownKit
Description
A 100% CommonMark compliant Markdown parser.
MarkdownKit
takes Markdown as input and generates a MKDocument
which is essentially an
abstract syntax tree (AST). From the AST, it is then able to render the input as HTML.
Classes
Interfaces
Name |
---|
MKRenderer |
Properties
Name | Type | Read-Only |
---|---|---|
CharacterReferences | XUIDictionary |
✔ |
EscapableCharacters | Dictionary |
✔ |
HTMLTagNames | Dictionary |
✔ |
mParser | MarkdownKit.MKParser |
|
Version | XUISemanticVersion |
✔ |
Methods
Name | Parameters | Returns |
---|---|---|
CollapseInternalWhitespace | s As String |
String |
FromMKCharacterArray | chars() As String , start As Integer , length As Integer |
String |
IsEscapable | char As String |
Boolean |
IsEscaped | chars() As MKCharacter , position As Integer |
Boolean |
IsMarkdownEscaped | chars() As MKCharacter , pos As Integer |
Boolean |
IsMarkdownEscaped | chars() As String , pos As Integer |
Boolean |
IsMarkdownWhitespace | char As MKCharacter , lineEndingIsWhitespace As Boolean |
Boolean |
IsMarkdownWhitespace | char As String |
Boolean |
IsPunctuation | char As MKCharacter |
Boolean |
MKCharacters | s As String , line As XUITextLine , localStartOffset As Integer |
MKCharacter() |
ReplaceEntities | chars() As String |
|
ReplaceEntities | s As String |
String |
ToDocument | markdown As String |
MarkdownKit.MKDocument |
ToHTML | markdown As String |
String |
ToString | type As MKBlockTypes |
String |
ToString | chars() As MKCharacter |
String |
ToString | chars() As MKCharacter , start As Integer , length As Integer |
String |
Unescape | s As String |
|
Unescape | chars() As String |
Constants
Name | Type |
---|---|
MAX_REFERENCE_LABEL_LENGTH | Double |
VERSION_MAJOR | Double |
VERSION_MINOR | Double |
VERSION_PATCH | Double |
MAX_REFERENCE_LABEL_LENGTH As Double The maximum number of characters permitted within the square brackets of a link label.
VERSION_MAJOR As Double The current major version.
VERSION_MINOR As Double The current minor version.
VERSION_PATCH As Double The current patch version.
Enumerations
MKBlockTypes
The supported block types.
Name |
---|
AtxHeading |
Block |
BlockQuote |
CodeSpan |
Document |
Emphasis |
FencedCode |
Html |
IndentedCode |
InlineHTML |
InlineImage |
InlineLink |
InlineText |
List |
ListItem |
Paragraph |
ReferenceDefinition |
SetextHeading |
SoftBreak |
StrongEmphasis |
TextBlock |
ThematicBreak |
MKHTMLBlockTypes
The different HTML block types.
Name |
---|
None |
InterruptingBlockWithEmptyLines |
Comment |
ProcessingInstruction |
Document |
CData |
InterruptingBlock |
NonInterruptingBlock |
MKLinkTypes
The various types of Markdown links.
Name |
---|
CollapsedReference |
FullReference |
ShortcutReference |
Standard |
MKListDelimiters
Defines the delimiter used in the source for ordered lists.
Name |
---|
Period |
Parenthesis |
MKListTypes
Defines the type of a list block element.
Name |
---|
Bullet |
Ordered |
Property Descriptions
CharacterReferences As XUIDictionary
A case-sensitive dictionary containing the HTML entity references and their corresponding unicode codepoints. Key = entity, Value = codepoint.
EscapableCharacters As Dictionary
A dictionary containing characters that can be escaped with a preceding backslash.
HTMLTagNames As Dictionary
A dictionary of HTML tag names.
mParser As MarkdownKit.MKParser
An internal parser used for convenience methods such as ToHTML()
.
Version As XUISemanticVersion
The current version.
Method Descriptions
CollapseInternalWhitespace(s As String) As String
Reduces consecutive internal whitespace to a single space.
FromMKCharacterArray(chars() As String, start As Integer, length As Integer) As String
Returns a string from chars
beginning at index start
for length
characters.
Assumes chars
is an array of individual characters.
If start + length
> the number of remaining characters then all characters from start
to the
end of chars
are returned.
If length
= -1
then all characters from start
to the end of chars
are returned.
IsEscapable(char As String) As Boolean
True if char
is a backslash-escapable character.
IsEscaped(chars() As MKCharacter, position As Integer) As Boolean
True if the character at position
is escaped (preceded by a non-escaped backslash character).
IsMarkdownEscaped(chars() As MKCharacter, pos As Integer) As Boolean
True if the character at pos
is escaped (preceded by a non-escaped backslash character).
IsMarkdownEscaped(chars() As String, pos As Integer) As Boolean
True if the character at pos
is escaped (preceded by a non-escaped backslash character).
IsMarkdownWhitespace(char As MKCharacter, lineEndingIsWhitespace As Boolean) As Boolean
True if char
is considered Markdown whitespace.
If the optional lineEndingIsWhitespace
is True then we also consider a line ending to be whitespace.
IsMarkdownWhitespace(char As String) As Boolean
True if char
is considered Markdown whitespace.
IsPunctuation(char As MKCharacter) As Boolean
True if char
is Markdown punctuation.
MKCharacters(s As String, line As XUITextLine, localStartOffset As Integer) As MKCharacter()
Returns s
as an array of MKCharacter instances.
ReplaceEntities(chars() As String)
Replaces any HTML entities defined in chars
with their corresponding unicode character.
This document is used as the authoritative source for the valid entity references and their corresponding code points.
Entity reference:
"&"
, a valid HTML5 entity name, ";"
Decimal numeric character reference:
&#[0-9]{1–7};
Hexadecimal numeric character reference:
&#[Xx][a-fA-F0-9]{1-6};
ReplaceEntities(s As String) As String
Replaces any HTML entities in s
with their corresponding unicode character.
ToDocument(markdown As String) As MarkdownKit.MKDocument
Returns the markdown
string as a Markdown document (abstract syntax tree).
ToHTML(markdown As String) As String
Returns the markdown
string as HTML.
ToString(type As MKBlockTypes) As String
Returns a String representation of the passed block type.
ToString(chars() As MKCharacter) As String
Convert an array of MKCharacter instances to a string.
ToString(chars() As MKCharacter, start As Integer, length As Integer) As String
Returns a string from chars
beginning at index start
for length
characters.
If start + length
> the number of remaining characters then all characters from start
to the
end of chars
are returned.
If length
= -1
then all characters from start
to the end of chars
are returned.
Unescape(s As String)
Converts backslash escaped characters in s
to their literal character value. Mutates s
.
Unescape(chars() As String)
Converts backslash escaped characters to their literal character value. Mutates chars
.