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
Fix code block indentation in lists #455
Fix code block indentation in lists #455
Conversation
…highlighting into it's own method
This creates issues for fenced code blocks with syntax highlighting. When a fenced code block is passed to python-markdown2/lib/markdown2.py Lines 1874 to 1877 in d28bd1f
This section will remove the fenced code block's leading indent, as intended. The code block then reaches this section: python-markdown2/lib/markdown2.py Lines 1892 to 1895 in d28bd1f
Where the syntax highlighted fenced code block will get passed to the new _code_block_with_lexer_sub function. This function is unaware that the code block has already been un-indented and therefore will not add back that initial indentation.
The code block needs to have that initial indentation restored before it is returned. |
Good catch, I can make a revision to fix this. And I’ll add a test for this case too. Thanks @Crozzers. |
I think the |
@Crozzers any last opinions on this, besides the possibly dupe test? |
@nicholasserra No last opinions, looks good to me |
I think it would help developers if it was more clear in testing that tests are being skipped when the pygments library is not installed. I thought all tests were passing until they were ran via the CI/CD pipeline. @Crozzers or @nicholasserra, what do you think would be a good option here? Could list tested passed, failed, and skipped. Or could show a warning that not al tests were run because certain modules were missing. |
For me, I don't have pygments installed on Python 3.8 and lower and when I run
A similar warning is printed for each python version missing pygments. I agree with @momja. I think perhaps changing when the warning is printed would help, maybe if it were printed at the end of the long scrolling block of test results of each python version? |
Tracking test warnings in #458 |
Thank you for this patch @momja |
This is a fix for issue #276. There's a failure in converting markdown lists that have fenced code blocks in them, because the indentation of the fenced code block is not accounted for unless syntax highlighting is enabled.
I also pulled out the code for substituting code blocks with a lexer into its own method so it is a little easier to read.