Skip to content

mas3/WikiConverter

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

WikiConverter

A library for Delphi that converts Markdown and PukiWiki text to HTML.

Overview

Convert the following text to HTML:

  • Markdown: Most of GitHub Flavored Markdown (GFM) is supported
  • PukiWiki: Some PukiWiki formatting rules are supported

Requirement

Delphi 12.1

If you want to run tests you need DUnitX.

Usage

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);

Supported notations

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;

Related apps

You can check the conversion operation with the following applications.

Author

MASUDA Takashi https://mas3lab.net/

About

A library for Delphi that converts Markdown and PukiWiki text to HTML.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages