Skip to content

Commit

Permalink
docs: treat common sphinx syntax as rst
Browse files Browse the repository at this point in the history
Summary:

Test Plan:

Reviewers:

Subscribers:

Tasks:

Tags:
  • Loading branch information
zsol committed Jun 1, 2024
1 parent fbfb2a7 commit 6671692
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
3 changes: 3 additions & 0 deletions py_wtf/indexer/documentation.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@
r"|((^|\n)\.\. )" # definitions
r"|([^`]``[^`]+``[^`])" # inline literal
r"|((^|\n)>>> )" # python console snippet
r"|(:(param|type|raises) \S+:)" # Sphinx docstring format
r"|(:(return|rtype): \S+)" # Sphinx docstring format
r"|(^\s*:Example:\s*$)" # Sphinx docstring format
)


Expand Down
7 changes: 7 additions & 0 deletions tests/indexer/test_documentation.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,13 @@ def test_is_rst() -> None:
1
"""
)
assert is_rst("foo\n:param blah:")
assert is_rst("foo\n:param blah: blahblah")
assert is_rst("foo\n:type blah: blahblah")
assert is_rst("foo\n :raises blah: blahblah")
assert is_rst(" :Example:")
assert is_rst("foo\n :return: something")
assert is_rst("foo\n :rtype: something")


def test_description_content_type_md() -> None:
Expand Down

0 comments on commit 6671692

Please sign in to comment.