Markdown Class

Namespace
Kampute.DocToolkit.Support
Assembly
  • Kampute.DocToolkit.dll

Definition

Provides utility methods for encoding and decoding Markdown special characters.
public static class Markdown
Inheritance

Methods

Decode(string)Decodes escaped Markdown special characters in the given text.
Decode(ReadOnlySpan<char>, TextWriter)Decodes escaped Markdown special characters in the given text and writes the result to the specified TextWriter.
Encode(string, bool)Encodes Markdown special characters in the given text.
Encode(ReadOnlySpan<char>, TextWriter, bool)Encodes Markdown special characters in the given text and writes the result to the specified TextWriter.
EnumerateHeadings(string)Enumerates all ATX-style headings in the given Markdown content, returning their text and corresponding levels.
GetMinimumFenceBackticks(ReadOnlySpan<char>)Determines the minimum number of backticks required to fence code in Markdown.
IsAsciiPunctuation(char)Determines whether the specified character is an ASCII punctuation character, which is the only kind of character that can be backslash-escaped in Markdown.
IsOrderedListDelimiter(char, bool, ref int)Tracks the leading digits of a line to detect the delimiter of an ordered list marker (e.g., "1." or "1)").
NeedsEncoding(char, bool)Determines whether the specified character is a Markdown special character that requires escaping.
ToHeadingAnchor(string)Converts the specified heading text to the anchor that GitHub and GitLab generate for a Markdown heading.
TryExtractFrontMatter(ReadOnlySpan<char>, out IReadOnlyDictionary<string, object>, out int)Attempts to extract and parse the front matter block from Markdown content.
TryGetFirstHeading(ReadOnlySpan<char>, out string)Attempts to find the first ATX-style heading that appears before any non-heading content in the given Markdown text.
TryParseCodeFence(ReadOnlySpan<char>, out char, out int, out ReadOnlySpan<char>)Attempts to parse a line of Markdown as a code fence, which opens or closes a fenced code block.