Open johngodlee opened 3 years ago
This would be a nice feature indeed. Not sure how easy it would be to implement
Hi, I just wanted to point out that one can use the auto extension for this in Jupytext, cf https://jupytext.readthedocs.io/en/latest/config.html?highlight=auto#per-notebook-configuration
This function may help.
function s:get_language_name(ipynb_path)
try
" https://nbformat.readthedocs.io/en/latest/format_description.html#top-level-structure
" only the `name` field always exists in the `language_info` (if `language_info` is defined).
return a:ipynb_path->readfile()->join("")->json_decode()["metadata"]["language_info"]["name"]
catch
" failed to detect language name
return ""
endtry
endfunction
echo s:get_language_name("Untitled.ipynb")
I know that it's possible to set
jupytext_fmt
to convert the .ipynb to a given format, either,py
,jl
,md
, etc. But I use both Julia and Python Jupyter Notebooks in my work. Is it possible to detect the notebook language and dynamically convert to.py
or.jl
?I could convert to
.md
, but this would prevent me using [https://github.com/jalvesaq/vimcmdline]() to run code in a repl.I thought it might be possible to add support for reading
metadata:language
in the Notebook JSON, e.g.:Is this a feature that already exists? Or could it be implemented?