通过 --no-highlight
选项解决了问题,pandoc -f gfm -t html --no-highlight
的转换结果如下:
<pre class="cs"><code>static void Main(string[] args)
{
Console.WriteLine("Hello World!");
}
</code></pre>
不使用 --no-highlight
时的转换结果:
<div class="sourceCode" id="cb1"><pre class="sourceCode cs"><code class="sourceCode cs"><a class="sourceLine" id="cb1-1" data-line-number="1"><span class="kw">static</span> <span class="dt">void</span> <span class="fu">Main</span>(<span class="dt">string</span>[] args)</a>
<a class="sourceLine" id="cb1-2" data-line-number="2">{</a>
<a class="sourceLine" id="cb1-3" data-line-number="3"> Console.<span class="fu">WriteLine</span>(<span class="st">"Hello World!"</span>);</a>
<a class="sourceLine" id="cb1-4" data-line-number="4">}</a></code></pre></div>