Trailing spaces and tabs are preserved at the end of paragraphs

Open
#323 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

@rahul05ranjan is already working on this.

Since Nov 12, 2026.

  • #324 by @rahul05ranjan — open

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
25/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Stale
Tech stack
markdown, python
Domain
backend

Research direction

Start by checking how Marko parses paragraph raw content before inline parsing, then compare that behavior with CommonMark 0.31.2 section 4.8. Use the reproducer in the issue to check both trailing spaces and tabs; done means both are absent from the converted paragraph output. Pull request #324 is already open for this issue.

Written by the indexing model from the issue text.

Description

Description

Marko preserves trailing spaces and tabs at the end of a paragraph,
although CommonMark requires these characters to be removed before
inline parsing.

Reproducer
import marko

print(repr(marko.convert("a ")))
print(repr(marko.convert("a\t")))

Actual output:

'<p>a </p>\n'
'<p>a\t</p>\n'

Expected output:

'<p>a</p>\n'
'<p>a</p>\n'
Expected behavior

Trailing spaces and tabs should be removed from the paragraph's raw
content before inline parsing, as specified in CommonMark 0.31.2,
section 4.8:

https://spec.commonmark.org/0.31.2/#paragraphs

Versions tested
  • Marko 2.2.5
  • Master commit bff68422520dd21e3f789c7266665a1cdbae47c1

Found through differential testing.

Dominant language
Python
Stars
470
Forks
72
Avg merge
1d 18h
Merged PRs (30d)
34

Getting set up

This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from frostming/marko

All issues in frostming/marko

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.