Open mmcky opened 1 year ago
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:
Hmm, I won't speak for @rowanc1 but I think this would be out of scope for the Jupyter integration. IIRC our integration in JupyterLab sits at the notebook level, so we customise the view but use the same model :/
Previously @agoose77 you were mentioning how to transform the markdown into a notebook. And that is a custom something in JupyterLab (not the view), i.e. something similar to jupytext.
Is that the right place to do this transformation?
I have put together a quick video (1.5min) of how things are working for me, can you describe the workflow a bit more that you are expecting if this isn't what you are wanting @mmcky?!
@rowanc1 that would work well and is a good solution.
I was suggesting that if you copy and paste some myst
markdown into a markdown cell that it might be able to split the cell on code-cell
directives but the solution you propose by opening the original md
file is a great approach.
I have put together a quick video (1.5min) of how things are working for me, can you describe the workflow a bit more that you are expecting if this isn't what you are wanting @mmcky?!
Will this solution require the jupytext
headers in the md
file such as
---
jupytext:
text_representation:
extension: .md
format_name: myst
kernelspec:
display_name: Python 3 (ipykernel)
language: python
name: python3
---
I think if you have jupytext enabled, it actually does cut the cell on the code cell, but only on save/re-open, not as you are working in the notebook. It is a bit strange! :)
At this point the frontmatter is the only way I know how to get it working. After testing, it looks like at least this is needed:
---
jupytext:
formats: ipynb,md:myst
---
I am sure there are other ways to do it that I don't know about, but at the least letting jupytext know that you are working with myst seems important.
How were you working before with these markdown notebooks? Did you open them in JupyterLab or use Jupytext at all?
@rowanc1 I just updated our QuantEcon manual to document the header requirement for markdown files. I don't think this is a big issue (particularly in the beginning). It makes sense that jupytext
needs some metadata to know about the contents of the markdown and which kernel to connect to.
How were you working before with these markdown notebooks? Did you open them in JupyterLab or use Jupytext at all?
To be honest the most common way is for folks to go from ipynb
to myst:md
and the headers are there in that conversion process automatically. It only became an issue yesterday for us as someone was converting a raw markdown file.
It would be amazing though to be able to use myst:md
files directly with jupyterlab
+ jupyterlab-mystjs
as we will only commit md
files in the GitHub repo context.
You can work exclusively on a myst:md
file using jupytext without creating any ipynb. I think you do need the headers though
This has been updated a bit in the v1.1.3
release, which now parses and renders code-cell
directives in the markdown cells, these are not executed, and if they are flat, round-tripping them through jupytext will result in a new code cell being created. I think this is ok for now - but still something to keep an eye on.
@mmcky would love your feedback on the latest release at some point. :)
Describe the bug
The
code-cell
directive from jupyter-book will be rendered as an executable component inJupyterBook
when usingmyst:markdown
files.However in the
jupyterlab-mystjs
context these blocks become syntax highlighted code blocks within the markdown cells.Example:
It might be nice for consistency if
jupyerlab-mystjs
was able to transform acode-cell
such aswhich we can now use in our notebook