-
Notifications
You must be signed in to change notification settings - Fork 392
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
Support codebraid #545
Comments
Hello @teucer, that is an interesting suggestion! And yes, I would be happy to take a PR that integrates The first question I'll ask you is: how safe is the round trip from a codebraid document to a Jupyter Notebook? Is the conversion implemented in If the answer is positive, then it should not be too difficult to plug |
|
Codebraid just uses regular pandoc markdown but a user can specify different methods of running a code block using The codebraid repo doesn't have examples with pandoc divs for cells, but based on some quick testing it works fine (presumably passed through to pandoc). e.g. this:
becomes this:
and if a jupyter kernel spec is specified in the meta it could also be specified in the first code block:
|
I have written a small pandoc filter to covert pandoc ast to a codebraid "notebook"). I have briefly tested it on a jupytext markdown file and a ipynb and it seems to work fine with both. Converting directly from an ipynb using the script obviously creates the same verbose pandoc-markdown output as jupytext (with the additional code block data). |
That's great, thank you @timothymillar! The next step will be to add the
That's a good start! The next step will be to test on our collection of test notebooks, see e.g. Lines 133 to 139 in bc1b159
|
@mwouts I forgot to link the related codebraid issue. I personally think integration with codebraid could be really nice, some thing like I'm not sure that a specific codebraid backend for jupytext would add much in terms of jupytexts goals. I initially though it would be a big convenience to be able to convert a script directly to pandoc markdown with codebraid classes (my main use case) but this can be achieved with a one liner (using the filter): jupytext script.py --to pandoc -o - | pandoc --filter cbnb.filter.py --to markdown ... Currently it seems to be possible to convert 'regular' pandoc/codebraid markdown file (i.e. no divs) to jupytext via github flavored markdown, but this looses metadata and may not work well with more complex examples: pandoc codebraid.md --to gfm | jupytext - --to ipynb ... If anything an additional 'simplified' pandoc backend might be useful for jupytext users. @teucer seemed to be suggesting more specific translation of cell level metadata between formats so I'd be interested to here more detail on that. |
codebraid is a Python program that enables executable code in Pandoc Markdown documents.
It is similar to rmarkdown and claims certain advantages over it.
It would be beneficial to support it as well.
The text was updated successfully, but these errors were encountered: