matthewwithanm / matthewwithanm/python-markdownify
Behavior with strip_pre=mdfy.STRIP_ONE seems incorrect with trailing newlines within the pre
Open
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 2.2k
- Forks
- 203
- PR merge metrics
- No merged PRs in 30d
Description
In [1]: import markdownify as mdfy
In [2]: converter = mdfy.MarkdownConverter(strip_pre=mdfy.STRIP_ONE)
In [3]: print(converter.convert('<pre>\n\nabc\n\n</pre>'))
```
abc
```
Only one trailing newline should be stripped, not both. right?
In [4]: print(converter.convert('<pre>\n\nabc\n\n\n</pre>'))
```
abc
```
In the above, 2 of the 3 newlines are trimmed instead of just 1.
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 by reproducing the two examples from the issue with MarkdownConverter(strip_pre=mdfy.STRIP_ONE). Inspect the pre-conversion behavior and verify that the resulting Markdown preserves all but one trailing newline in each case; done means both examples match the expected output.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- content
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 50/100