Skip to content
Fetching contributors…
Cannot retrieve contributors at this time
28 lines (19 sloc) 538 Bytes
from markdown import markdown
import docutils.core
class Renderer(object):
extensions = []
@classmethod
def render(cls, plain):
return plain
class Markdown(Renderer):
extensions = ['markdown', 'mkd']
@classmethod
def render(cls, plain):
return markdown(plain, ['def_list', 'footnotes'])
class ReStructuredText(Renderer):
extensions = ['rst']
@classmethod
def render(cls, plain):
return docutils.core.publish_parts(plain)['body']
Plain = Renderer
all = [Plain, Markdown]
Jump to Line
Something went wrong with that request. Please try again.