-
Notifications
You must be signed in to change notification settings - Fork 9
WordMarkdown.cs
suncloudsmoon edited this page Dec 8, 2024
·
1 revision
The WordMarkdown class is a utility class designed to convert Markdown syntax into corresponding formatting in Microsoft Word documents. It provides methods to parse and apply various Markdown elements, including headings, lists, quotes, code blocks, links, images, and more. The class also includes functionality to handle syntax highlighting for code blocks based on the specified programming language.
- None
- RemoveMarkdownSyntax(string markdownText): Removes all Markdown syntax from the input text, preserving the plain text content.
- ApplyAllMarkdownFormatting(Word.Range commentRange, string rawMarkdown): Applies all Markdown formatting to the specified Word range based on the provided Markdown text.
- Keywords: Same as public member.
- MaskCodeBlocks(string markdownText, List codeBlockMask): Masks code blocks in the Markdown text to prevent interference with other syntax removal operations.
-
-
RemoveBoldMarkdownSyntax(string markdownText): Removes bold markdown syntax (
**
or__
) from the input text.
-
RemoveBoldMarkdownSyntax(string markdownText): Removes bold markdown syntax (
-
RemoveItalicMarkdownSyntax(string markdownText): Removes italic markdown syntax (
*
or_
) from the input text. -
RemoveUnderlineMarkdownSyntax(string markdownText): Removes underline markdown syntax (
__
) from the input text. -
RemoveStrikeThroughMarkdownSyntax(string markdownText): Removes strike-through markdown syntax (
~~
) from the input text. -
RemoveBlockQuoteMarkdownSyntax(string markdownText): Recursively removes blockquote syntax (
>
) from the input text. -
RemoveHeadingMarkdownSyntax(string markdownText): Removes heading syntax (
#
followed by title) from the input text. -
RemoveUnorderedListMarkdownSyntax(string markdownText): Removes unordered list syntax (
-
,*
,+
) from the input text. -
RemoveHorizontalRuleMarkdownSyntax(string markdownText): Removes horizontal rule syntax (
---
,___
,***
) from the input text. -
RemoveInlineCodeMarkdownSyntax(string markdownText): Removes inline code syntax (
-
RemoveCodeBlockMarkdownSyntax(string markdownText): Removes code block syntax (`` `
code
```) from the input text. -
RemoveLinkMarkdownSyntax(string markdownText): Removes link syntax (
[text](url)
) from the input text. -
RemoveBoldItalicMarkdownSyntax(string markdownText): Removes bold italic syntax (
***
or___
) from the input text. -
RemoveImageMarkdownSyntax(string markdownText): Removes image syntax (

) from the input text. -
RemoveInlineMathMarkdownSyntax(string markdownText): Removes inline math syntax (
$math$
) from the input text. -
RemoveDisplayMathMarkdownSyntax(string markdownText): Removes display math syntax (
$$math$$
) from the input text. -
RemoveAlternateHeadingMarkdownSyntax(string markdownText): Removes alternate heading syntax (title followed by
===
or---
) from the input text. - RemoveAllMarkdownSyntaxExcept(RegexSyntaxFilter.Number num, string markdownText): Removes all Markdown syntax except for the specified type.
- ApplyMarkdownFormatting(Word.Range commentRange, string fullMarkdownText, RegexSyntaxFilter.Number formatType): Applies specific Markdown formatting to the Word range based on the specified format type.
- ApplyFormatting(Word.Range formatRange, int searchIndex, int offset, int length, int formatType, ref int offsetIncrement, int offsetValue, int level = 1): Applies Word formatting options based on the format type.
- ApplyAlternateHeadingFormatting(Word.Range formatRange, int searchIndex, int offset, Match match, string insideContent, ref int offsetIncrement): Applies alternate heading formatting to the Word range.
- ApplyImageFormatting(Word.Range formatRange, string imageUrl): Inserts an image from a URL into the Word document at the specified range.
-
ApplyHeadingFormatting(Word.Range formatRange, int searchIndex, int offset, Match match, string insideContent, ref int offsetIncrement): Applies heading formatting to the Word range based on the number of
#
characters. - ApplyCodeBlockFormatting(Word.Range formatRange, int searchIndex, int offset, Match match, ref int offsetIncrement): Applies syntax highlighting and border formatting for code blocks in the Word document.
- ApplyLinkFormatting(Word.Range formatRange, int searchIndex, int offset, Match match, ref int offsetIncrement): Applies hyperlink formatting to the Word range.
- FormatAsBlockquote(Word.Range range, int level): Formats the specified range as a blockquote with indentation and border.
- ApplySyntaxHighlighting(Word.Range range, string language, string code): Applies syntax highlighting to code blocks based on the specified programming language.