A library for Delphi that converts Markdown and PukiWiki text to HTML.
Convert the following text to HTML:
- Markdown: Most of GitHub Flavored Markdown (GFM) is supported
- PukiWiki: Some PukiWiki formatting rules are supported
Delphi 12.1
If you want to run tests you need DUnitX.
Add the files under the MyWiki folder to your project.
Uses WikiConverter and the Converter that corresponds to the type of text you want to convert.
uses
MyWiki.WikiConverter, MyWiki.MarkdownConverter;Create a Converter.
var
Converter: TWikiConverter
begin
Converter := TMarkdownConverter.Create;The WikiToHtml method takes the text you want to convert and returns HTML.
Html := Converter.WikiToHtml(Markdown);GFM support status:
- Thematic breaks
- ATX headings
- Setext headings
- Indented code blocks
- Fenced code blocks
- HTML blocks
- Link reference definitions
- Paragraphs
- Blank lines
- Tables
- Block quotes
- List items
- Task list items
- Backslash escapes
- Entity and numeric character references
- Code spans
- Emphasis and strong emphasis
- Strikethrough
- Links
- Images
- Autolinks
- < > link
- extended www autolink
- extended url autolink
- extended email autolink
- extended protocol autolink
- Raw HTML
- Disallowed Raw HTML
- Hard line breaks
- Soft line breaks
- Textual content
Footnotes:
You can use footnotes by using the GitHub format.
This is a sample footnote[^1].
[^1]: This sentence will appear in the footnote.
Page link:
Enclosing it in [[ and ]] will create a page link. The page name and link destination must be set in advance.
PageList := TWikiPages.Create;
PageList.Add('Example', 'https://example.com');
Converter := TMarkdownConverter.Create;
Converter.SetPageList(FPageList);Example site is [[Example]].
Give ID to the header:
Assigning True to the GiveIdToHeader property will give the header an ID. The assigned ID can be obtained from the Header.HeaderList property.
Converter.GiveIdToHeader := True;You can check the conversion operation with the following applications.
- myWiki - Memo app that supports Markdown
- myMarkdownViewer - Markdown File Viewer
MASUDA Takashi https://mas3lab.net/