我使用pandoc@0.2.0与节点和以下命令
pandoc -f markdown -t html5 -o test.html test.md
我的开始标记是
## Code Example
This example shows how to invoke the about dialog on demand, passing in some content, version info and the product name and product line.
```javascript
$('body').about({
appName: 'My App Name',
productName: 'My Product line',
version: 'ver. 1.0.0',
content: '<p>Fashionable application for fashionable customers.</p>'
});
```
然而,问题是这样呈现:
$('body').about({
appName: 'My App Name',
productName: 'My Product line',
version: 'ver. 1.0.0',
content: '<p>Fashionable application for fashionable customers.</p>'
});
是否有一个技巧可以让它像这样渲染?
$('body').about({
appName: 'My App Name',
productName: 'My Product line',
version: 'ver. 1.0.0',
content: '<p>Fashionable application for fashionable customers.</p>'
});
问题似乎是空白/标签的用户。它添加了额外的制表符。有没有办法控制它?这是生成的html
<code class="sourceCode javascript">
<span class="fu">$</span>(<span class="st">'body'</span>).<span class="fu">about</span>({
<span class="dt">appName</span>: <span class="st">'My App Name'</span>,
<span class="dt">productName</span>: <span class="st">'My Product line'</span>,
<span class="dt">version</span>: <span class="st">'ver. 1.0.0'</span>,
<span class="dt">content</span>: <span class="st">'<p>Fashionable application for fashionable customers.</p>'</span>
});
</code>
答案 0 :(得分:1)
我遇到了同样的问题。基本上,问题似乎是 pandoc 在某个时候开始在 pre 块内缩进;对我来说,这看起来像是他们漂亮的打印逻辑中的一个错误。
我用两个丑陋的 sed 命令修复了它:
pandoc --from markdown+smart+yaml_metadata_block+auto_identifiers \
"foo.md" \
-o "foo.html"
# pandoc indenting causing issues, so remove it
sed -i 's/^\s*<span/<span/g' "foo.html"
sed -i 's/^\s*\([^<]\)/\1/g' "foo.html"