zestedesavoir / zmarkdown

Live demo: https://zestedesavoir.github.io/zmarkdown/
MIT License
226 stars 52 forks source link

hl_lines: LaTeX does not support space syntax #417

Closed AmauryCarrade closed 3 years ago

AmauryCarrade commented 3 years ago

If we use the space-separated syntax in hl_lines, the LaTeX export breaks.

Steps to reproduce

Let there be the following input.

```python hl_lines="1-2 4"
def true():
    return False

True = true()

We expect the following LaTeX output:

```latex
\begin{CodeBlock}[][1-2 4]{python}
def true():
    return False

True = true()
\end{CodeBlock}

Instead, we get:

\begin{CodeBlock}[]["2-1]{python}
def true():
    return False

True = true()
\end{CodeBlock}

You can reproduce this bug here.

Analysis

It looks like this is caused by this parameters separation based on spaces, without taking into account quotes (line 29).

https://github.com/zestedesavoir/zmarkdown/blob/0dde7e4bc207cd5a34fe73da4cf9bb90c8ad745d/packages/rebber/src/types/code.js#L23-L30

StaloneLab commented 3 years ago

Was fixed with the refactoring of meta attributes on code blocks, will be included in ZMd 10.0.