在Python中用prettyprint类包装降价代码块

2024-04-28 16:43:03 发布

您现在位置:Python中文网/ 问答频道 /正文

在python中有一个markdown扩展,它突出显示代码hilite。此扩展将代码段包装在codehilite类中。我怎样才能得到这样一个函数,但是只在每个片段上加上class='prettyprint',而不使用codehilite进行处理呢。

基本上将markdown生成的每个<pre></pre>标记转换为<pre class='prettyprint'></pre>


Tags: 函数代码标记代码段preclassmarkdownprettyprint