#1627·jupytext

py:percent: option to keep true blank lines in markdown cells (writer forces `#`)

Author: BordaCreated Aug 17, 2026Updated Sep 15, 2026

Description

Reader (jupytext.reads) accepts true blank lines or # for a markdown-cell paragraph break, same parsed result either way. Writer (jupytext.writes) always emits #, never a true blank. So a hand-edited .py using true blanks fails --test-strict / gets auto-rewritten, even though nothing is broken.

Motivation: Kaggle's own notebook export uses true blank lines in markdown cells. Round-tripping through jupytext to keep a .py source paired with a Kaggle-uploaded .ipynb means every blank line gets turned into #, fighting the Kaggle format on every sync.

Reproduce

python
import jupytext

src = """# %% [markdown]
# ## Title

# Para one.

# Para two.

# %%
x = 1
"""
nb = jupytext.reads(src, fmt="py:percent")
print(jupytext.writes(nb, fmt="py:percent") == src)  # False — writer inserted '#' on each blank

jupytext==1.19.1

Request

Not asking to flip the default — an opt-in arg/metadata flag (e.g. --markdown-blank-lines or a jupytext.text_representation option) to keep true blank lines on write would be enough.