code-block rendering does not work as expected
code-block rendering should support line numbers and highlighting.
JupyterLab Preview:
Output of similar code block with latexpdf in Sphinx:
For VsCodium preview see related issue ticket:
https://github.com/executablebooks/myst-vs-code/issues/57
(My preffered IDE would be PyCharm but it does not seem to support MyST directives.)
Thanks for opening your first issue here! Engagement like this is essential for open source projects! :hugs:
If you haven't done so already, check out EBP's Code of Conduct. Also, please try to follow the issue template as it helps other community members to contribute more effectively.
If your issue is a feature request, others may react to it, to raise its prominence (see Feature Voting).
Welcome to the EBP community! :tada:
This feature does work, but it differs between MyST-JS and Sphinx. We should ensure that they behave the same, although Sphinx has quirks.
@rowanc1 the following code blocks look different in Sphinx and MyST-JS:
```{code-block}
:lineno-start: 10
:linenos:
:emphasize-lines: 12,13
1, 2, 3
4
5
6
7
```
```{code-block}
:lineno-start: 10
:emphasize-lines: 12,13
1, 2, 3
4
5
6
7
```
```{code-block}
:lineno-start: 10
:emphasize-lines: 2,3
1, 2, 3
4
5
6
7
```
Sphinx:
jupyterlab-myst:
It looks like Sphinx doesn't use lineno-start as a programmatic offset (only visually). Also, Sphinx uses the presence of lineno-start to activate line numbers . Do you think we can bring these into alignment?
I'm running out of cycles to do this right now, but it looks simple enough:
Ha, I remember explicitly testing that the offset worked properly and the lines we were highlighting were the same!! Happy to take that out and revert to how sphinx works here. Adding a warning about highlighting lines outside the visible region could also be good!
Right - I personally think our implementation is the right one, but I know that we won't change sphinx on this 😅
I have fixed the first portion of the bug lineno-start turning on showLineNumbers in:
- https://github.com/executablebooks/mystmd/pull/610