Skip to content

Instantly share code, notes, and snippets.

@piyonishi
Created June 28, 2013 13:32
Show Gist options
  • Save piyonishi/5884670 to your computer and use it in GitHub Desktop.
Save piyonishi/5884670 to your computer and use it in GitHub Desktop.
import markdown
md = markdown.Markdown(extensions=['codehilite'])
sample = """
sample text
:::python
import sys
def sample():
print 'sample'
"""
sample_html = md.convert(sample)
print(sample_html)
#<p>sample text</p>
#<div class="codehilite"><pre><span class="kn">import</span> <span class="nn">sys</span>
#<span class="k">def</span> <span class="nf">sample</span><span class="p">():</span>
# <span class="k">print</span> <span class="s">&#39;sample&#39;</span>
#</pre></div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment