Fix paragraph_close collapsing paragraph spacing (#15)#17
Merged
Conversation
paragraph_close returned a single \n, so two paragraphs in the source markdown rendered as adjacent lines in Slack instead of separated by a blank line. This diverged from the JS reference slackify-markdown, which separates paragraphs with \n\n. Changes: - paragraph_close now returns \n\n for normal paragraphs and \n for tight-list paragraphs (markdown-it marks those with token.hidden). - render() trims trailing newlines and re-adds a single \n so the document ends with exactly one trailing \n, matching the JS lib. This also fixes a sibling divergence where headings at end of document trailed with \n\n. - Tests updated to assert the JS-reference outputs; test_complex_markdown regenerated from actual output.
3 tasks
thesmallstar
added a commit
that referenced
this pull request
May 24, 2026
* Bump to 0.2.3, refresh uv.lock, add Python 3.14 support - version: 0.2.2 -> 0.2.3 to release the paragraph spacing fix from #17 - uv.lock: regenerate to current lockfile schema (revision 1 -> 3); same dependency graph, just metadata refresh from a newer uv - classifiers: add Python 3.14 (released Oct 2025) Tests pass on the default toolchain and on Python 3.14 explicitly (verified via `uv run --python 3.14 pytest`). Note: requires-python is still ">=3.8" to avoid breaking existing installs, though Python 3.8 (EOL Oct 2024) and 3.9 (EOL Oct 2025) are past upstream support. Dropping them is a follow-up. * Add Python 3.14 to CI test matrix Mirrors the classifier addition in pyproject.toml so CI actually exercises tests against Python 3.14 on every PR.
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.
Summary
paragraph_closereturned a single\n, so two markdown paragraphs rendered as adjacent lines in Slack instead of separated by a blank line. This diverged from the JS referenceslackify-markdown, which separates paragraphs with\n\n.\n\nfromparagraph_closefor normal paragraphs, keep\nfor tight-list paragraphs (markdown-it tags those withtoken.hidden).render()now normalizes trailing whitespace once (rstrip("\n") + "\n"), so the document always ends with exactly one trailing\nregardless of which token last emitted. This also fixes a sibling divergence where a heading at end of document trailed with\n\nwhile JS produces\n.Closes #15.
Verified against JS reference
Built and ran the upstream JS
slackify-markdownagainst the same inputs; outputs for paragraphs, headings, tight lists, loose lists, and definitions now match. Pre-existing divergences for zero-width-space inline markers, hard-break\preservation, and list→heading block separation are out of scope for this issue.Test plan
uv run pytest tests/test_convert.py— 49 passedtest_definitions,test_headings,test_heading_with_bold,test_heading_with_italic, two loose-list tests)test_complex_markdownregenerated from actual output