Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

A way to quickly add a jupytext header to a text file? #485

Closed
choldgraf opened this issue Apr 9, 2020 · 3 comments · Fixed by #486
Closed

A way to quickly add a jupytext header to a text file? #485

choldgraf opened this issue Apr 9, 2020 · 3 comments · Fixed by #486
Milestone

Comments

@choldgraf
Copy link
Contributor

I was wondering if there's a quick way to add the jupytext header to a file without needing to round-trip it to ipynb first. I find myself writing jupytext-ready markdown files, and then I need to go find another file and copy/paste its jupytext header so that readers will know what kind of jupytext format it is in.

Is there a way to quickly add a header with the default Jupyter kernels available? Something like jupytext init myfild.md <formatname>

@mwouts
Copy link
Owner

mwouts commented Apr 10, 2020

Hello @choldgraf , you can do one of the below:

jupytext --set-formats md:pandoc notebook.md      # set jupytext format to md:pandoc
jupytext --set-kernel - notebook.md               # current python executable
jupytext --set-kernel <kernelname> notebook.md    # explicit kernel name

You may want to use these as well:

jupytext --set-formats md:myst notebook.md
jupytext --set-formats md:pandoc --set-kernel - notebook.md

but unfortunately they don't seem to work at the moment... I will have a look!

@choldgraf
Copy link
Contributor Author

ah great - OK cool I think we might build in a short-hand for this into jupyter-book, something like jupyter-book init-myst myfile.md. Let me know if the kernel name issue gets fixed

@mwouts
Copy link
Owner

mwouts commented Apr 11, 2020

Apparently all the commands above seem to work fine... I have tested them on a broad range of configurations thanks to #488 .

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants