matthewwithanm / matthewwithanm/python-markdownify
Whitespace between comments is no longer removed
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 2.2k
- Forks
- 203
- PR merge metrics
- No merged PRs in 30d
Description
In #184, processing was updated to be non-destructive. A side effect of this code change is that whitespace between comments is no longer removed:
import markdownify
md = markdownify.MarkdownConverter().convert
md("""
<p>line 1</p>
<!-- comment -->
<!-- comment -->
<!-- comment -->
<!-- comment -->
<p>line 2</p>""")
# 'line 1\n\n\n\n\n\nline 2'
This occurs because the code that conditionally omits whitespace looks at the adjacent siblings on both sides to check if they are block elements. Because comments are no longer deleted, this check sees comments instead of block elements.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the whitespace-handling logic that checks adjacent siblings, using the MarkdownConverter().convert example in the issue to reproduce the extra newlines between comments. Compare the behavior introduced by #184 and verify that the converted output no longer contains the unwanted whitespace between the comment nodes.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100