Beispiel #1
0
def chart_renderer(text):
    '''
        This function matches the chart tag in the
        text and replaces it with the chart container
    '''
    matchedObject = re.finditer(CUSTOM_CHART_RE, text)
    if matchedObject is not None:
        for mo in matchedObject:
            chart_html = makeHtml(CHART_CONTAINER_TMPL, mo)
            text = re.sub(CUSTOM_CHART_RE, chart_html, text, 1)
        return pygmented_markdown(text)
    return pygmented_markdown(text)
Beispiel #2
0
def jinjamarkdown_renderer(text):
    """
    A custom renderer that runs pygmented markdown through jinja2 first.
    I actually wish to be able to include some markup in my flat files.

    """

    jinja_body = render_template_string(text)
    return pygmented_markdown(jinja_body)
Beispiel #3
0
def my_renderer(text):
    prerendered_body = render_template_string(text)
    return pygmented_markdown(prerendered_body)
Beispiel #4
0
 def html_content(self):
     rendered_content = pygmented_markdown(self.content)
     return Markup(rendered_content)
Beispiel #5
0
def my_renderer(text):
    prerendered_body = render_template_string(text)
    #return pygmented_markdown(prerendered_body)  # Fails to use extensions listed in FLATPAGES_MARKDOWN_EXTENSIONS
    return pygmented_markdown(prerendered_body, flatpages=pages)  # Correctly finds and uses FLATPAGES_MARKDOWN_EXTENSIONS
Beispiel #6
0
def flatpages_renderer(text):
    '''Enable Jinja2 interpretation within flatpages md file'''
    prerendered_body = render_template_string(text)
    return pygmented_markdown(prerendered_body)
def convert_org_to_html(text):
    md = pypandoc.convert_text(text, to="markdown_strict", format='org')
    output = pygmented_markdown(md)
    return output