[bug] empty markdown lines cause incorrect comment syntax in q when writing percent notebook
In q, a line with / as the content starts a block comment. Jupytext produces these when converting to percent format and there's an empty line in a markdown cell.
{
"cells": [
{
"cell_type": "markdown",
"id": "c261d244",
"metadata": {},
"source": [
"This is a markdown cell\n",
"\n",
"With a blank line ^"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "ba870045",
"metadata": {},
"outputs": [],
"source": [
"\n",
"show \"this is some code now\";"
]
}
],
"metadata": {},
"nbformat": 4,
"nbformat_minor": 5
}jupytext --to q:percent -o - that.ipynb yeilds:
/ %% [markdown]
/ This is a markdown cell
/
/ With a blank line ^
/ %%
show "this is some code now";The code is commented out though due to the opening block comment on line 3.
The easiest solution (though ugly) is to add a single whitespace after the /. Alternatively, we
could change the comment string to //, but this is backwards incompatible.
Another potential solution would be to implement the suggestion from #1627. (Even though that issue was written by an LLM lol), implementing and enabling it by default for q I think would be sufficient to fix my problem.
Anyway, I'll create an MR with my proposed fix, and we can discuss.
Source: jupytext/jupytext