(Go: >> BACK << -|- >> HOME <<)

Jump to content

Extension:WikiMarkdown

From mediawiki.org
Revision as of 17:34, 2 June 2022 by Kuenzign (talk | contribs)
MediaWiki extensions manual
WikiMarkdown
Release status: stable
Implementation Tag , ContentHandler
Description Allows for markdown syntax to be used on wiki pages
Author(s) Nathan Kuenzig (kuenzigntalk)
Latest version 1.0.0
Compatibility policy Master maintains backward compatibility.
MediaWiki 1.35+
Database changes No
License MIT License
Download
README on GitHub
  • $wgAllowMarkdownExtra
‎<markdown>

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

  • Download and move the extracted WikiMarkdown folder to your extensions/ directory.
    Developers and code contributors should install the extension from Git instead, using:cd extensions/
    git clone https://gerrit.wikimedia.org/r/mediawiki/extensions/WikiMarkdown
  • Only when installing from Git, run Composer to install PHP dependencies, by issuing composer install --no-dev in the extension directory. (See task T173141 for potential complications.)
  • Add the following code at the bottom of your LocalSettings.php file:
    wfLoadExtension( 'WikiMarkdown' );
    $wgAllowMarkdownExtra = true; // allows usage of Parsedown Extra
    
  • Configure as required.
  • Yes Done – Navigate to Special:Version on your wiki to verify that the extension is successfully installed.

Configuration

$wgAllowMarkdownExtra
To enable Parsedown Extra support, set $wgAllowMarkdownExtra = true; (default is "false")

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.

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