Sphinx inline code highlight

前端 未结 6 1605
暖寄归人
暖寄归人 2021-02-07 11:03

I use Sphinx to make a website that contains code samples. I\'m successful using the .. code-block directive to get syntax highlighting. But I can\'t get inline syn

6条回答
  •  栀梦
    栀梦 (楼主)
    2021-02-07 11:54

    This can be fixed by adding 'sphinxcontrib.inlinesyntaxhighlight' extension in conf.py:

    extensions = [ 'sphinxcontrib.inlinesyntaxhighlight' ]
    
    # use language set by highlight directive if no language is set by role
    inline_highlight_respect_highlight = False
    
    # use language set by highlight directive if no role is set
    inline_highlight_literals = False
    

    Extension documentation

    The extension is available here and on PyPi.

提交回复
热议问题