Extension of the Cebe's Markdown library for parsing Mrkdown into WikiText syntax.
It's used as backend library for MediaWiki MarkdownWiki parser.
The parser render links and tables in wiki format.
- bold
- italc
- code highlit
- links
- images
- blockquote
- headlines
- horizontal ruler
- ordered and unordered lists
- paragraphs
- preformatted text
- tables
Example:
---
template: temaplate name
myparam1: content of my param1
myparam2: content of my param2
---
first 2 lines are mandatory. Other lines are optional. Code check if :
is present.
End of parsing is on the end of the template or on first empty line.
Double underscored behavior switches for MediaWiki parser has the same format as markdown bold text. To avoid issues with that words new format is introduced.
{{__NOTOC__}}
instread of simple __NOTOC__
. The markdown-wiki parser is removing curly brackets and magic word is applyed during wiki parsing.
The installation is following the reccomandation of the original Cebe's Markdown library.
Installation is recommended to be done via composer) by running:
composer require paveld/markdown-wiki "*"
and then
composer update paveld/markdown-wiki
If you don't need to parse some of the elements it's possible to remove parsing by following directive.
$m = new MarkdownWiki();\
$m->disableParsingRule('headline');
$wikTextb = $m->parse($MarkdownText);
Some elements are idetified by by several rules.
- Code block by
code
andfencedcode
- Headline by
headline
- Horizontal ruler by
ahr
andhr
- HTML elements by
html
- Markdown table by
table
- Ordered list by
ol
- Quote block by
quote
- Template by
aaatemplate
andtemplate
- Unordered list by
bul
andul
- Escape by
parseEscape
- Greater-than sign by
parseGt
- HTML entities by
parseEntity
- Image by
parseImage
- Inline code by
parseInlineCode
- Links by
parseLink
- Magic word by
parseMagicWord
- Special attributes by
parseSpecialAttributes
- Strong and intalic by
parseEmphStrong
MIT