python highlighting in Rmarkdown in RStudio

前端 未结 2 1285
南方客
南方客 2021-02-09 21:53

I\'m using RStudio 0.98.1103. It is said in release notes that they\'ve added \"Syntax highlighting modes for XML, YAML, SQL, Python, and shell scripts.\" But when I write somet

相关标签:
2条回答
  • 2021-02-09 22:08

    The engine option tells knitr which language to use to actually run the code chunk.

    What they are referring to in the release notes is syntax highlighting in the source code editor. Open an existing Python source file in the editor and you will see it is correctly highlighted.

    Language-dependent syntax highlighting is usually selected based on the underlying language of the file you are editing (often simply based on the filename extension). In your example, you are editing a .RMd file, so the editor uses the syntax rules for r-markdown.

    0 讨论(0)
  • 2021-02-09 22:10
    output: 
      html_document:
        highlight: pygments
    

    in the head did the trick.

    0 讨论(0)
提交回复
热议问题