突出显示Python块的语法无效 [英] Syntax highlighting for Python chunks does not work

查看:149
本文介绍了突出显示Python块的语法无效的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试创建一个笔记本,在其中我展示了用R和Python编写的相同算法.我可以轻松地将R和Python代码集成到Rmd文件中,然后使用RStudio中的编织HTML"按钮创建HTML输出.但是,Python代码始终显示时不会突出显示语法(与 https://github.com/yihui/knitr-examples/blob/master/023-engine-python.md ).我在计算机(MacBook Pro Retina,MacOS X 10.9)上安装并运行了安德烈·西蒙(Andre Simon)的重要软件.

I'm trying to create notebooks in which I present the same algorithm written in R and Python. I can easily integrate the R and Python code in a Rmd file and then create a HTML output using the 'Knit HTML' button in RStudio. However the Python code is always displayed without syntax highlighting (not like in the example at https://github.com/yihui/knitr-examples/blob/master/023-engine-python.md). I have Andre Simon's highlight software installed and functioning on my computer (MacBook Pro Retina, MacOS X 10.9).

当前,我在R中安装了以下库:markdown 0.6.4,knitr 1.5.15,higher 0.3.1.

Currently, I have the following libraries installed in R: markdown 0.6.4, knitr 1.5.15, highr 0.3.1.

任何想法可能是什么问题?谢谢你的帮助!.

Any idea what could be the problem? Thanks for your help!.

推荐答案

RStudio Markdown渲染特定于RStudio Markdown渲染,该渲染没有为非R或C ++的代码块启用语法突出显示. RStudio使用 highlight.js ,并且您可以使用自己的Highlight.js版本来突出显示Python代码.或使用其他Markdown转换器,例如 Pandoc .

That is specific to the RStudio Markdown render, which did not enable syntax highlighting for code blocks that are not R or C++. RStudio uses highlight.js, and you can use your own version of highlight.js to highlight Python code. Or use other Markdown converters such as Pandoc.

这篇关于突出显示Python块的语法无效的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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