python_reference/tutorials/markdown_syntax_highlighting/final.html

40 lines
1.7 KiB
HTML

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<link rel="stylesheet" type="text/css" href="./codehilite.css">
</head>
<body>
<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">&quot;Hello, World&quot;</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">&quot;this is a test&quot;</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">&quot;Hello, World&quot;</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">&quot;highlight me!&quot;</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">&quot;this is a test&quot;</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>
</body>
</html>