MarkdownMarkupExtension

Summary: Use Markdown markup with PmWiki
Version: 0.2
Prerequisites: pmwiki-2.0
Last-tested-with: pmwiki-2.2.102
Status: stable
Maintainer:
Categories: Markup PHP72
Votes:

Question

How to use John Grubers Markdown markup?

Answer

Installation

  • download markdownpmw.phpΔ and put it into your cookbook/ folder
  • include this file with include_once("$FarmD/cookbook/markdownpmw.php"); in your config.php

For the translation itself we use Michel Fortin's PHP Markdown library.

Configuration

Several config options are available. Each of these must be set in config.php, before including markdownpmw.php.

$MarkdownMarkupUseClassicParser (default: false)
If set to true, the Classic version of the parser is used. (PHP Markdown Classic must be installed.)
$MarkdownMarkupMarkdownExtraEnabled (default: false)
If set to true, Markdown Extra is enabled.
$MarkdownMarkupParserOptions (default: empty)
An array of parser configuration options.

Usage

The Markdown markup can be used by enclosing it in (:markdown:) and (:markdownend:):

 (:markdown:)

 Test
 ====

 (:markdownend:)

If you want to use it on many pages without PmWiki markup maybe you want to put these into your GroupHeader/GroupFooter.

Notes

See Also

Contributors

Comments

- I updated this recipe to work with PHP 5.5 and PHP 7.2, and tested it with the latest (as of 2018-01-06) versions of PHP Markdown (1.7.0) and PHP Markdown Classic (1.0.2). It works with both; by default the script is set to use the newer (1.7.0) version, but if you want to use classic just comment/uncomment the appropriate lines in the script. Said Achmiz October 14, 2017, at 01:12 AM

- (05/01/2017 ) Here is an example to add the MarkdownExtra syntaxe to a new fresh pmwiki-2.2.106 installation.

1. download the required files in the cookbook sub directory.

  wget http://www.pmwiki.org/pmwiki/uploads/Cookbook/markdownpmw.php
  wget https://littoral.michelf.ca/code/php-markdown/php-markdown-lib-1.7.0.zip
  unzip php-markdown-lib-1.7.0.zip
  ln -s "PHP Markdown Lib 1.7.0/Michelf" .
  # rm php-markdown-lib-1.7.0.zip # only if place is needed

2. Set $MarkdownMarkupMarkdownExtraEnabled = true; in config.php

See discussion at MarkdownMarkupExtension-Talk

User notes -1: If you use, used or reviewed this recipe, you can add your name. These statistics appear in the Cookbook listings and will help newcomers browsing through the wiki.