mirror of
https://github.com/rasbt/python_reference.git
synced 2024-11-27 14:01:15 +00:00
26 lines
1.6 KiB
HTML
26 lines
1.6 KiB
HTML
<h2>This is a test</h2>
|
|
<p>Code blocks must be indented by 4 whitespaces.
|
|
Python-Markdown has a auto-guess function which works
|
|
pretty well:</p>
|
|
<div class="codehilite"><pre><span class="n">print</span><span class="p">(</span><span class="s">"Hello, World"</span><span class="p">)</span>
|
|
<span class="cp"># some comment</span>
|
|
<span class="k">for</span> <span class="n">letter</span> <span class="n">in</span> <span class="s">"this is a test"</span><span class="o">:</span>
|
|
<span class="n">print</span><span class="p">(</span><span class="n">letter</span><span class="p">)</span>
|
|
</pre></div>
|
|
|
|
|
|
<p>In cases where Python-Markdown has problems figuring out which
|
|
programming language we use, we can also add the language-tag
|
|
explicitly. One way to do this would be:</p>
|
|
<div class="codehilite"><pre><span class="k">print</span><span class="p">(</span><span class="s">"Hello, World"</span><span class="p">)</span>
|
|
</pre></div>
|
|
|
|
|
|
<p>or we can highlight certain lines to
|
|
draw the reader's attention:</p>
|
|
<div class="codehilite"><pre><span class="hll"><span class="k">print</span><span class="p">(</span><span class="s">"highlight me!"</span><span class="p">)</span>
|
|
</span><span class="c"># but not me!</span>
|
|
<span class="k">for</span> <span class="n">letter</span> <span class="ow">in</span> <span class="s">"this is a test"</span><span class="p">:</span>
|
|
<span class="k">print</span><span class="p">(</span><span class="n">letter</span><span class="p">)</span>
|
|
<span class="hll"><span class="c"># I want to be highlighted, too!</span>
|
|
</span></pre></div> |