Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Respect directive regex flags #30

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Mar 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,14 @@ on:

jobs:
build:

runs-on: ubuntu-latest
strategy:
matrix:
python-version: [3.6, 3.7, 3.8, 3.9, '3.10', '3.11']

os: [ubuntu-latest]
python-version: [3.7, 3.8, 3.9, '3.10', '3.11']
include:
- os: ubuntu-20.04
python-version: 3.6
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
Expand Down
2 changes: 1 addition & 1 deletion docstring_to_markdown/rst.py
Original file line number Diff line number Diff line change
Expand Up @@ -339,7 +339,7 @@ def looks_like_rst(value: str) -> bool:
if (section + '\n' + '-' * len(section) + '\n') in value:
return True
for directive in RST_DIRECTIVES:
if re.search(directive.pattern, value):
if re.search(directive.pattern, value, directive.flags):
return True
# allow "text::" or "text ::" but not "^::$" or "^:::$"
return bool(re.search(r'(\s|\w)::\n', value) or '\n>>> ' in value)
Expand Down
1 change: 1 addition & 0 deletions tests/test_rst.py
Original file line number Diff line number Diff line change
Expand Up @@ -837,6 +837,7 @@ def test_looks_like_rst_recognises_rst():
assert looks_like_rst('the following code::\n\n\tcode')
assert looks_like_rst('See Also\n--------\n')
assert looks_like_rst('.. versionadded:: 0.1')
assert looks_like_rst('Description.\n\n:param spam: eggs.\n')


def test_looks_like_rst_ignores_plain_text():
Expand Down