Skip to content
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

Python docstrings are mis-treated as code block fences. #287

Closed
wamserma opened this issue Feb 15, 2022 · 2 comments · Fixed by #291
Closed

Python docstrings are mis-treated as code block fences. #287

wamserma opened this issue Feb 15, 2022 · 2 comments · Fixed by #291

Comments

@wamserma
Copy link
Contributor

Minimal example:

# Minimal test

1. Item
2. Item with code. The multi-line docstring is interpreted as code block fencing.

    ```python
    def foo_fun():
       """ 
       Does nothing. 

       Really.
       """
       pass
    ```

3. Another Item

yields:

$pymarkdownlnt scan test.md
test.md:8:4: MD031: Fenced code blocks should be surrounded by blank lines (blanks-around-fences)
test.md:8:8: MD046: Code block style [Expected: fenced; Actual: indented] (code-block-style)
test.md:14:5: MD031: Fenced code blocks should be surrounded by blank lines (blanks-around-fences)
test.md:14:5: MD040: Fenced code blocks should have a language specified (fenced-code-language)
test.md:16:4: MD031: Fenced code blocks should be surrounded by blank lines (blanks-around-fences)

using pymarkdownlnt==0.9.5

@wamserma wamserma changed the title Pthon docstrings are mis-treated and code block fences. Python docstrings are mis-treated and code block fences. Feb 16, 2022
@wamserma wamserma changed the title Python docstrings are mis-treated and code block fences. Python docstrings are mis-treated as code block fences. Feb 16, 2022
@jackdewinter
Copy link
Owner

jackdewinter commented Feb 19, 2022

Working on the issue. A fast fix for you is to remove one space in front of each line of the fenced block. because it is in an ordered list with a single digit count, it only needs 3 spaces.

@jackdewinter
Copy link
Owner

This was a parser error. The extra spaces within the fenced code block were triggering the indented code block code.
Fixed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants