pull_request(list): prevent extra p tags inside list items#9
Open
Kristinita wants to merge 1 commit intoryneeverett:masterfrom
Open
pull_request(list): prevent extra p tags inside list items#9Kristinita wants to merge 1 commit intoryneeverett:masterfrom
Kristinita wants to merge 1 commit intoryneeverett:masterfrom
Conversation
ryneeverett
reviewed
Feb 16, 2025
|
|
||
| # Remove unwanted <p> tags around list items. | ||
| # See issue #8 for details. | ||
| text = re.sub(r'<li>\s*<p>(.*?)</p>\s*</li>', r'<li>\1</li>', text) |
Owner
There was a problem hiding this comment.
Per discussion in #8, the thing that makes me uncomfortable with this solution is that I believe this will "correct" undesirable output caused by blank lines and not just by comments. IMO that would not be a great side-effect because it would encourage people to write bad markdown by hiding their mistakes from them.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
1. Summary
I’ve fixed issue #8. python-markdown-comments will now remove unwanted
<p>tags inside the list.2. Explanation
I added the deletion of unwanted
<p>tags with a regular expression.Also, I added 3 tests from my issue. They work successfully after running the
python -m unittest test/test_comments.pycommand and don’t break existing tests.3. Issue #2 possible problem
Difficulties arose with how to leave the
test_comments_in_htmltest asserted. With my pull request, this test remains asserted, but I didn’t really understand everything written in issue #2, and I admit that I might have missed something. If so, I think it would be a nice idea to add other tests for issue #2.Thanks.