简体   繁体   English

Pandoc,markdown 到 html,如何在代码区域使用制表符缩进?

[英]Pandoc, markdown to html, how to use tab indentation in code area?

My source code is indented with Tab.我的源代码用 Tab 缩进。 But in the html generated by pandoc, the code is indented by 4 spaces.但是在pandoc生成的html中,代码缩进了4个空格。

Is there any options to control how to indent?是否有任何选项来控制如何缩进? Or is it possible to let pandoc just copy the code?或者是否可以让 pandoc 只复制代码?

(Because the code with tab indentation is changed into spaecs in stack overflow, so the example is shown as images.) (因为有制表符缩进的代码在栈溢出时变成了空格,所以示例如图所示。)

Markdown: Markdown:

降价 , ,

HTML: HTML:

html . .

Yes, this is possible.是的,这是可能的。

From the pandoc documentation available at: https://pandoc.org/MANUAL.html来自 pandoc 文档: https://pandoc.org/MANUAL.html

-p , --preserve-tabs -p , --preserve-tabs

Preserve tabs instead of converting them to spaces.保留制表符而不是将它们转换为空格。 (By default, pandoc converts tabs to spaces before parsing its input.) Note that this will only affect tabs in literal code spans and code blocks. (默认情况下,pandoc 在解析其输入之前将制表符转换为空格。)请注意,这只会影响文字代码跨度和代码块中的制表符。 Tabs in regular text are always treated as spaces.常规文本中的制表符始终被视为空格。

Just pass pandoc this argument.只需传递 pandoc 这个论点。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM