Attachment 'modified-text_markdown.py'
Download 1 """
2 MoinMoin - Parser for Markdown
3
4 Syntax:
5
6 To use in a code block:
7
8 {{{{#!text_markdown
9 <add markdown text here>
10 }}}}
11
12 To use for an entire page:
13
14 #format text_markdown
15 <add markdown text here>
16
17 @copyright: 2009 by Jason Fruit (JasonFruit at g mail dot com)
18 Modified by rupi AT devlol DOT org
19 @license: GNU GPL, see http://www.gnu.org/licenses/gpl for details
20
21 """
22
23 from markdown import markdown
24
25 Dependencies = ['user']
26
27 class Parser:
28 """
29 A thin wrapper around a Python implementation
30 (http://www.freewisdom.org/projects/python-markdown/) of John
31 Gruber's Markdown (http://daringfireball.net/projects/markdown/)
32 to make it suitable for use with MoinMoin.
33 """
34
35 extensions = ['.md']
36
37 def __init__(self, raw, request, **kw):
38 self.raw = raw
39 self.request = request
40
41 try:
42 self.args = request.cfg.markdownargs
43 except AttributeError:
44 self.args = { 'safe_mode': 'replace' }
45
46 def format(self, formatter):
47 output_html = markdown(self.raw, **self.args)
48 try:
49 self.request.write(formatter.rawHTML(output_html))
50 except:
51 self.request.write(formatter.escapedText(output_html))
Attached Files
To refer to attachments on a page, use attachment:filename, as shown below in the list of files. Do NOT use the URL of the [get] link, since this is subject to change and can break easily.You are not allowed to attach a file to this page.