# MarkdownOutput Summary: Presents a wiki page in Markdown format instead of HTML Version: 2008-02-15 Prerequisites: PmWiki 2.2.0-beta series, untested on 2.1.27 and earlier Status: beta Maintainer: [EemeliAro][1] Categories: [Markup][2], [Layout][3], [SystemTools][4], [WikiConversion][5] ## Questions answered by this recipe * How can I generate "pretty" plain text from a wiki page? ## Description MarkdownOutput uses [Milian Wolff's Markdownify][6] HTML to Markdown converter to convert a page's HTML to the Markdown syntax. As an example, take a look at what this page (`Cookbook.MarkdownOutput`) [looks like][7][Δ][8] in Markdown. ### To install this recipe: * download [markdown-output.zip][9][Δ][10] and extract it to your cookbook directory * you should end up with a folder named 'markdown-output' * add the following line to your config file: `include_once("$FarmD/cookbook/markdown-output/markdown-output.php");` * To test, use the provided action "**`markdown`**" to view a page of your wiki (by adding `?action=markdown` to the end of the page's url) ## Configuration The following variables may be set in your config file to configure the way MarkdownOutput works. The values shown are the defaults and the descriptions are mostly taken from [Milian Wolff's page][6]. : **`$MarkdownExtra`** ` = TRUE;` : Support for PHP Markdown Extra[(approve links)][11] output, which implements some features currently not available with the plain Markdown syntax (tables, definition lists, etc.). **`$MarkdownLinksAfterEachParagraph`** ` = FALSE;` : A boolean which decides whether link definitions shall be displayed after each block element. **`$MarkdownBodyWidth`** ` = FALSE;` : An integer or `FALSE` and sets the width to which the outputted Markdown text shall be wordwrapped. This feature is not yet finished! **`$MarkdownKeepHTML`** ` = FALSE;` : A boolean which tells Markdownify whether to keep non-markdownable HTML tags or to discard them. ## Usage Add `?action=markdown` to the end of the url of the page you wish to see in Markdown format. ## Notes MarkdownOutput first parses the page's wikimarkup into HTML, then passes it to Markdownify to convert to Markdown. All of the page permissions, `(:if:)` statements and everything else is processed as normal. Only the actual page contents are included in the output. If you have any comments or criticisms about how the output is formatted, you should direct those to Markdownify's author -- MarkdownOutput is really just a shell. ## Release Notes * 2008-02-14 -- first release ## See Also * [Cookbook.Markdown][12] * [Cookbook.MarkdownMarkupExtension][13] * [Jan Erik Moström's post][14] on the pmwiki-users list that started this idea * [Milian Wolff's Markdownify][6] * [Markdown syntax documentation][15] * PHP Markdown Extra[(approve links)][11] additions to plain Markdown syntax ## Contributors * [EemeliAro][1] ## Comments [1]: http://www.pmwiki.org/wiki/Profiles/EemeliAro [2]: http://www.pmwiki.org/wiki/Category/Markup [3]: http://www.pmwiki.org/wiki/Category/Layout [4]: http://www.pmwiki.org/wiki/Category/SystemTools [5]: http://www.pmwiki.org/wiki/Category/WikiConversion [6]: http://milianw.de/projects/markdownify/ [7]: /pmwiki/uploads/Cookbook/markdown-output-sample.txt [8]: http://www.pmwiki.org/wiki/Cookbook/MarkdownOutput?action=upload&upname=markdown-output-sample.txt [9]: /pmwiki/uploads/Cookbook/markdown-output.zip [10]: http://www.pmwiki.org/wiki/Cookbook/MarkdownOutput?action=upload&upname=markdown-output.zip [11]: http://www.pmwiki.org/wiki/Cookbook/MarkdownOutput?action=approvesites [12]: http://www.pmwiki.org/wiki/Cookbook/Markdown [13]: http://www.pmwiki.org/wiki/Cookbook/MarkdownMarkupExtension [14]: http://pmichaud.com/pipermail/pmwiki-users/2008-February/049136.html [15]: http://daringfireball.net/projects/markdown/