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

howto produce a myst/markdown format #556

Closed
parmentelat opened this issue Jul 5, 2020 · 9 comments
Closed

howto produce a myst/markdown format #556

parmentelat opened this issue Jul 5, 2020 · 9 comments
Milestone

Comments

@parmentelat
Copy link
Contributor

Hi, I'd like to give the myst markdown variant a try

https://jupytext.readthedocs.io/en/latest/formats.html?highlight=myst#myst-markdown

but have not been able to find the right syntax, here's what I tried

$ jupytext --set-formats markdown:myst  my-notebook.md
[jupytext] Reading w9-s2-c1-decorateurs.md
[jupytext] Updating notebook metadata with '{"jupytext": {"formats": "markdown:myst"}}'
<stack-trace>
jupytext.formats.JupytextFormatError: myst is not a valid format name. Please choose one of light, pandoc, spin, hydrogen, markdown, nomarker, sphinx, rmarkdown, percent

as a side question, I have just obtained this my-notebook.md by running

$ jupytext --to markdown my-notebook.ipynb

and am a little confused as to which specific markdown variant is being used; the .md file reads like this

---
jupyter:
  jupytext:
    formats: md
    text_representation:
      extension: .md
      format_name: markdown

thanks again for the awesome tool !

@mwouts
Copy link
Owner

mwouts commented Jul 5, 2020

Hi @parmentelat , if you want to convert a given notebook to the myst format, then you can do:

jupytext --to md:myst notebook.ipynb

If you want to pair the two files, then you can either use the extension (Jupytext Menu, or Jupytext commands in JLab), or:

jupytext --set-formats md:myst,ipynb notebook.ipynb

and am a little confused as to which specific markdown variant is being used; the .md file reads like this

format_name: markdown is Jupytext's default Markdown format (sorry the name is a big generic, I did not imagine at that time that we were going to have multiple Markdown formats... 😄 ). For Myst-Markdown instead you will get format_name: myst.

thanks again for the awesome tool !

My pleasure! I hope the above helps. If you don't mind, can you tell me where you would have expected to find the information that was missing here? Would you recommend updating the doc / jupytext --help, or both?

@parmentelat
Copy link
Contributor Author

parmentelat commented Jul 5, 2020

Hi again; it looks like my installation is off, because typing your exact sentence gives me the same

$ jupytext --to md:myst w9-s2-c1-decorateurs.ipynb
Traceback (most recent call last):
<>
jupytext.formats.JupytextFormatError: myst is not a valid format name. Please choose one of pandoc, spin, percent, nomarker, light, markdown, sphinx, rmarkdown, hydrogen

I had already upgraded to the latest, and I am using this version

$ jupytext --version
1.5.1

is there a specific variant that I need to pass to
pip install jupytext[something]
?

@mwouts
Copy link
Owner

mwouts commented Jul 5, 2020

Oh sure! It's pip install jupytext[myst] - this will install myst-parser.
Sorry the error message is misleading, I'll see how I can improve that.

@parmentelat
Copy link
Contributor Author

parmentelat commented Jul 6, 2020

ah <mental slap on the forehead> !
stupid me then :)

@mwouts mwouts added this to the 1.6.0 milestone Jul 6, 2020
@chrisjsewell
Copy link
Contributor

yes this is something that maybe I'd like to remove the need for in the future actually: if I can get the conversion done without any dependencies, it wouldn't add this extra hassle.
Out of interest @mwouts, if the only dependency was markdown-it-py, which itself only has a dependency on the widely used attrs, would you consider allowing it to be added to the required installs, rather than in the extras?

@mwouts
Copy link
Owner

mwouts commented Jul 11, 2020

Hi @chrisjsewell, sure I will think about it (and ask the IT department at work how easy for them it is to install markdown-it-py...). And at the very least, I will make sure that the error message says explicitly that one just needs to install myst.

@mwouts mwouts reopened this Jul 11, 2020
@chrisjsewell
Copy link
Contributor

thanks @mwouts

@mwouts
Copy link
Owner

mwouts commented Jul 30, 2020

I will make sure that the error message says explicitly that one just needs to install myst.

Hi @chrisjsewell , I have a PR for that at #584 , do you want to have a look at it?

@mwouts mwouts closed this as completed Aug 20, 2020
@mwouts
Copy link
Owner

mwouts commented Aug 20, 2020

Closing as #584 was merged - the error message will be much more informative now.

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

No branches or pull requests

3 participants