0
在python中有一個markdown擴展,它突出顯示codehilite的代碼。該擴展將代碼片段包裝在codehilite類中。我怎樣才能得到這樣的功能,但只在每個片段上放置class ='prettyprint'而不用codehilite處理。在Python中使用prettyprint類包裝markdown代碼塊
基本上爲什麼不使用str.replace()
或 're.subn()' 每<pre></pre>
標記,降價使得進入<pre class='prettyprint'></pre>
因爲我使用的模板 – Supremekhaoz
如果meen Django的模板,那就沒辦法那麼這是沒有問題的。只需使用'render_to_string()'https://docs.djangoproject.com/en/1.5/ref/templates/api/#the-render-to-string-shortcut – twil