Extension:WikiMarkdown

From Linux Web Expert

MediaWiki extensions manual
WikiMarkdown
Release status: stable
File:Markdown.png
Implementation Tag , ContentHandler
Description Allows for markdown syntax to be used on wiki pages
Author(s) Nathan Kuenzig (kuenzigntalk)
Latest version 1.1.3
Compatibility policy Master maintains backward compatibility.
MediaWiki 1.35+
Database changes No
License MIT License
Download
README on GitHub
  • $wgAllowMarkdownExtra
‎<markdown>
Quarterly downloads Lua error in Module:Extension at line 172: bad argument #1 to 'inNamespace' (unrecognized namespace name 'skin').
Public wikis using Lua error in Module:Extension at line 172: bad argument #1 to 'inNamespace' (unrecognized namespace name 'skin').

The WikiMarkdown extension allows for markdown syntax to be used on wiki pages using the ‎<markdown> tag. It is powered by the Parsedown library.

Usage

Once installed, you can use ‎<markdown> tags on wiki pages. For example,

Emphasis

This is bold text

This is bold text

This is italic text

This is italic text

Strikethrough

is the result of the following wikitext markup:

<markdown>
## Emphasis

**This is bold text**

__This is bold text__

*This is italic text*

_This is italic text_

~~Strikethrough~~
</markdown>

Markdown content handler

The extension adds a content handler for markdown pages, which can be edited using a markdown editor when CodeEditor is installed.

Markdown error category

The extension adds pages that encountered errors during markdown parsing to a tracking category.

Parameters

inline

The attribute indicates that the markdown should be inline as part of a paragraph (as opposed to being its own block).

Installation

Install Dependencies

Make sure your OS has Composer 2.0+ . Installation guide

Add the line "extensions/WikiMarkdown/composer.json" to the "composer.local.json" file in the root directory of your wiki, e.g.

{
	"extra": {
		"merge-plugin": {
			"include": [
				"extensions/WikiMarkdown/composer.json"
			]
		}
	}
}

Then run composer update in the root directory of your wiki. This will install any dependencies (i.e. the Parsedown, Parsedown Extra, and Parsedown Extended libraries).

Install the extension

  • Download extension from github and unpack it into 'extensions' folder.
  • <translate> <tvar name=1>Download the GitHub repo</tvar> and place the file(s) in a directory called <tvar name=name>WikiMarkdown</tvar> in your <tvar name=ext>extensions/</tvar> folder.</translate>
  • <translate> Only when installing from Git, run <tvar name=composer>Composer</tvar> to install PHP dependencies, by issuing <tvar name=code>composer install --no-dev</tvar> in the extension directory.</translate> <translate> (See <tvar name=phab><translate> task <tvar name=1>T173141</tvar></translate></tvar> for potential complications.)</translate>
  • <translate> Add the following code at the bottom of your <tvar name=1>LocalSettings.php </tvar> file:</translate>
    wfLoadExtension( 'WikiMarkdown' );
    $wgAllowMarkdownExtra = true; // allows usage of Parsedown Extra
    $wgAllowMarkdownExtended = true; // allows usage of Parsedown Extended
    
  • Configure as required.
  • File:OOjs UI icon check-constructive.svg <translate> Done</translate> – <translate> Navigate to <tvar name=special>Special:Version</tvar> on your wiki to verify that the extension is successfully installed.</translate>

Configuration

$wgAllowMarkdownExtra
To enable Parsedown Extra support, set $wgAllowMarkdownExtra = true; (default is "false")
$wgAllowMarkdownExtended
To enable Parsedown Extended support, set $wgAllowMarkdownExtended = true; (default is "false")
$wgParsedownExtendedParameters
Optionally change which parameters are used with Parsedown Extended. Look at the documentation for what options you can turn on or off. This defaults to:
[
    'math' => [
        'single_dollar' => true
    ],
    'sup' => true,
    'sub' => true
]

SyntaxHighlight integration

When SyntaxHighlight is installed, the extension will automatically apply its highlighting to markdown code blocks. The code blocks will render the same as the SyntaxHighlight code blocks and will support all the same languages.

Math integration

When Math is installed and Parsedown Extended with the math option is available, the extension will automatically use the Math extension to render mathematical equations.

VisualEditor integration

The extension enables direct editing with VisualEditor. A popup is opened when a user wants to edit ‎<markdown> sections. For this to work, VisualEditor must be installed and configured from the latest Git version, same for Parsoid.

See also