jupytext.write doesn't error if `fmt` is unknown, but the output file has a known extension
See original GitHub issueJust playing around with MyST -> ipynb -> MyST right now. The ipynb syncing works beautifully! I love it
I am having a hard time getting MyST code cells to render as ipynb
code cells.
E.g., this markdown:
---
jupytext:
formats: ipynb,md:myst
text_representation:
extension: .md
format_name: myst
format_version: '0.6'
jupytext_version: 1.4.1
kernelspec:
display_name: Python 3
language: python
name: python3
---
```{code-cell} python3
print('hi')
```
```{code-cell} python3
print('hi')
```
has its ```{code-cell} ```
read in as markdown instead of being converted to Python code cells.
I tried adding double-spaces between them but that didn’t do the trick. Anything I am missing?
(I also noticed a weird thing where the YAML header of the MyST markdown file would be read into the notebook as a raw
cell at the top, rather than in the notebook metadata…is that expected behavior?)
Issue Analytics
- State:
- Created 4 years ago
- Comments:6 (6 by maintainers)
Top Results From Across the Web
Jupytext documentation
When Jupytext is installed, .py and .md files have a notebook icon. ... The Jupytext extension for JupyterLab is bundled with Jupytext.
Read more >nbsphinx - Read the Docs
If you don't know how to create a PDF file from the LaTeX output, you should have ... The nbsphinx extension does not...
Read more >Release 0.21.7 ploomber
In a Ploomber pipeline, outputs (also known as products) from one task become inputs of “downstream” tasks. Hence,.
Read more >Executables in CoCalc
On CoCalc, you can also install or compile your own executable binaries. You have a lot of control about your own project, which...
Read more >Supplement of EUREC A's HALO - ESSD
Later on, we want to plot all flights on an interactive map. Currently the dataset is rather large as the aircraft location has...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Thanks @choldgraf , that is a good point… I agree that
jupytext.write
should raise an error in that case. I’ll see how to add a test and fix that.ahhh yes, I believe that myst-parser was a key issue here. I’ve upgraded it and it now works much better! Amazing 😃
One thing that I think exacerbated my problem, if I write the notebook to markdown and give a
fmt=
value that jupytext doesn’t have, then jupytext still writes the format just fine. E.g., this works:I think what it is doing is inferring the output type from the
.md
extension of teh output, because if I remove the.md
then it throws an error. However, I think jupytext should throw a warning if it doesn’t understand thefmt=
value, and instead is going to infer from the file extension. This was confusing me, because I was writingjupytext.write(ntbk, "out.md", fmt="myst")
, when I should have been writingjupytext.write(ntbk, "out.md", fmt="md:myst")
, but because no error or warning was thrown, it was just defaulting to “regular” markdown.