2012-09-01 40 views
1

我在使用Markdown一段時間來格式化豐富的內容。然後我需要一些額外的東西,比如我們的StackOverflow如何。所以,我想讓GeSHi與Markdown合作。使用GeSHi降價使用

我試過markdown_extra_geshi,但是我無法工作。那一刻,我看到一個項目BeautifyGitHub)。

Markdown工作正常,但有一些問題。語法突出顯示不起作用。 SmartyPants也在轉換代碼中的引號。

降價片段,我給了作爲輸入是:

#Checking Codes! 
The `inline code` and **big code**: 

    {{lang:php}} 
    echo "string"; 

###Same way! 

    #!php 
    echo "string"; 

我得到的HTML輸出:

<h1>Checking Codes!</h1> 

<p>The <code>inline code</code> and <strong>big code</strong>:</p> 

<pre><code>{{lang:php}} 
echo &amp;#8220;string&amp;#8221;; 
</code></pre> 

<h3>Same way!</h3> 

<pre><code>#!php 
echo &amp;#8220;string&amp;#8221;; 
</code></pre> 

其實這不應該轉換的報價爲智能引號和我不能找不到語法高亮顯示。我做錯了嗎?這個測試文件的源代碼是:

PHP代碼:

<?php 
    include("beautify.php"); 
    echo beautify('#Checking Codes! 
The `inline code` and **big code**: 

    {{lang:php}} 
    echo "string"; 

###Same way! 

    #!php 
    echo "string"; 
'); 
?> 

任何幫助表示讚賞。

+2

請不要**隨機**粗體**格式**,這會讓您的問題更難閱讀。 – Charles

回答

4

最後我從作者自己得到了答案。

你應該把你的代碼在~~~之間。

像這樣:

~~~ php 
echo "here's PHP code"; 
~~~ 
Here's normal text. 

未來遊客可以從該得到幫助。 :)