Skip to content

Fix STRIP_ONE trailing newline handling#266

Open
oiahoon wants to merge 1 commit into
matthewwithanm:developfrom
oiahoon:fix/strip-one-trailing-newline
Open

Fix STRIP_ONE trailing newline handling#266
oiahoon wants to merge 1 commit into
matthewwithanm:developfrom
oiahoon:fix/strip-one-trailing-newline

Conversation

@oiahoon

@oiahoon oiahoon commented Jul 12, 2026

Copy link
Copy Markdown

Summary

  • make strip_pre=STRIP_ONE anchor its trailing-newline match at the true end of the input
  • add regression coverage for two and three trailing bare newlines
  • preserve the existing behavior for space-padded blank lines

Fixes #255.

Verification

  • pytest tests/test_args.py -q
  • pytest -q
  • flake8 --ignore=E501,W503 markdownify tests
  • restructuredtext-lint README.rst
  • mypy .
  • mypy --strict tests/types.py
  • python -m build -nwsx .
  • git diff --check

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 this pull request may close these issues.

Behavior with strip_pre=mdfy.STRIP_ONE seems incorrect with trailing newlines within the pre

1 participant