如何使用Pandoc为Markdown内联代码启用语法突出显示? [英] How to enable syntax highlighting for Markdown inline code with Pandoc?

查看:109
本文介绍了如何使用Pandoc为Markdown内联代码启用语法突出显示?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Pandoc手册说:

--no-highlight

即使给定了语言属性,也禁用了代码块和内联的语法高亮显示.

Disables syntax highlighting for code blocks and inlines, even when a language attribute is given.

这听起来似乎应该突出显示内联代码的语法.但是每当我使用Markdown内联代码

This sounds like there should be syntax highlighting for inline code. But whenever I use Markdown inline code like

This is `print("Hello world")` inline code.

没有语法高亮显示.

推荐答案

好的,应该再读一点……找到了解决方案.它称为扩展名:inline_code_attributes :

Okay, should have read a little bit further... found the solution. It's called Extension: inline_code_attributes:

属性可以附加到逐字记录文本,就像带围栏的代码块一样:

Attributes can be attached to verbatim text, just as with fenced code blocks:

`<$>`{.haskell}

因此上面的示例变为:

This is `print("Hello world")`{.python} inline code.

如果您考虑一下,就可以理解...如果其他人有此问题,我仍然会保留.

Makes sense if you think about it... I'll still leave this up in case someone else has this problem.

这篇关于如何使用Pandoc为Markdown内联代码启用语法突出显示?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆