简体   繁体   English

用emacs突出显示python文档字符串作为注释

[英]highlight python docstrings as comments with emacs

Is it possible to customise emacs such that python docstrings are highlighted the same way as comments are? 是否可以自定义emacs,以便以与注释相同的方式突出显示python文档字符串? Here is an example of a python docstring 这是python文档字符串的示例

def python_function(argument):
    """
    doc string here

    may be multiline
    """
    return some_func(argument)

With python-mode.el, customize font-lock-doc-face accordingly. 使用python-mode.el,相应地自定义font-lock-doc-face This needs also py-use-font-lock-doc-face-p set to t . 这还需要将py-use-font-lock-doc-face-p设置为t

Besides all faces are customizable. 此外,所有面孔都是可定制的。 Mx customize-face RET font-lock-string-face RET and set it to the value wanted. Mx customize-face RET font-lock-string-face RET并将其设置为所需的值。 However this would affect all modes. 但是,这会影响所有模式。

从Emacs 25.1开始,Emacs内置的python.el显示带有font-lock-doc-face文档字符串。

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

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