# Refine syntax highlighting for Python docstrings \(\#20898\) · gitcafe/zed

[View on GitCafe](https://git.cafe/gitcafe/zed/commit/bb59e7f217c0bdf74ecd3bba9df6b99c94381d8a)

Repository: [gitcafe/zed](https://git.cafe/gitcafe/zed)

Visibility: public

Requested revision: bb59e7f217c0bdf74ecd3bba9df6b99c94381d8a

Requested commit: bb59e7f217c0bdf74ecd3bba9df6b99c94381d8a

Commit: bb59e7f217c0bdf74ecd3bba9df6b99c94381d8a

Tree: 46451973d08ddd4dc0bd7130d57e1803adf68728

Author: jfmontanaro

Committer: GitHub

## Message

```
Refine syntax highlighting for Python docstrings (#20898)

Following up on #20763, this PR adds support for module- and class-level
docstrings, adds "additional docstrings" as described in [PEP
257](https://peps.python.org/pep-0257/), and fixes function-level
docstrings so that only the first string literal in a function gets
treated as a docstring.

One question that occurs to me is: Would it be good to capture attribute
and additional docstrings differently from regular docstrings? E.g.
`@string.doc.attribute`, `@string.doc.additional`? PEP 257 mentions that
unlike regular docstrings, these docstrings are ignored by the
interpreter (regular docstrings get added as the `__doc__` property of
the object they document), so I can see someone potentially wanting to
style them a little differently.

Release notes:

* Added Python syntax highlighting for class- and module-level
docstrings, additional docstrings, and improved recognition of
function-level docstrings.

Co-authored-by: Piotr Osiewicz <24362066+osiewicz@users.noreply.github.com>
```

## Parents

- [b643080117d44f86a68d86a5baa178b4b2867ecb](https://git.cafe/gitcafe/zed/commit/b643080117d44f86a68d86a5baa178b4b2867ecb?format=markdown)

[Source at this commit](https://git.cafe/gitcafe/zed/tree/bb59e7f217c0bdf74ecd3bba9df6b99c94381d8a?format=markdown)
