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

some (markdown) page <-> Jupyter notebooks conversion? #692

Closed
Datseris opened this issue Mar 29, 2018 · 11 comments
Closed

some (markdown) page <-> Jupyter notebooks conversion? #692

Datseris opened this issue Mar 29, 2018 · 11 comments
Labels
Status: Available Type: Feature Type: Plugin A feature that should be implemented as a separate package.

Comments

@Datseris
Copy link
Contributor

Datseris commented Mar 29, 2018

(Consider this as a very far fetched feature request)

Would it be possible to create pages out of Jupyter notebooks? This would allow having an all-in-one documentation but still run some notebooks on e.g. JuliaBox without having to duplicate the effort of:

  • creating a notebook
  • creating a very similar documentation page

Maybe there is some simple way to convert a notebook into markdown that already exists somewhere?


Answer: yes, here https://nbconvert.readthedocs.io/en/latest/ is a way to convert notebooks to markdown files. Then, when running Travis, you can also install this, do the procedure for all notebooks, copy the notebooks to a specific folder and then run the make docs command.

I am leaving this open because I think it is cool and you (or I) could add it to the documentation. When (and If) I get it working I try to do a PR!


EDIT: As pointed out by Kristoffer, it is better to convert from markdown to Jupyter. As showed by Evizero, this is actually possible.

@KristofferC
Copy link
Member

FWIW, I think rendering to notebooks from markdown is a better strategy since notebooks are not very version control friendly.

@Datseris
Copy link
Contributor Author

@KristofferC I am not familiar on how to do this, can you please point me to a tutorial/example?

@KristofferC
Copy link
Member

You could look at https://github.com/mpastell/Weave.jl or https://github.com/aaren/notedown. My point is, notebooks are a more "rich" target so it is likely simpler to to have them as output targets than as "source code".

@Evizero
Copy link
Contributor

Evizero commented Mar 29, 2018

I implemented a hacky way of creating documentation pages as well as pre-executed jupyter notebooks from .jl scripts of the examples/ folder.

code: https://github.com/Evizero/Augmentor.jl/tree/master/docs

Feel free to just copy and change whatever, if you feel like it. That said, I am unsure if you want to go through the trouble of making this work for your use-case though as its not a clean solution.

Pretty happy with the result though. even have a link to the jupyter notebook from the docs

here is an example to see what the result is:
the source script: https://github.com/Evizero/Augmentor.jl/blob/master/examples/mnist_knet.jl
generated docs: https://evizero.github.io/Augmentor.jl/generated/mnist_knet/
generated notebook: (see button in docs in the top right corner)

@Datseris
Copy link
Contributor Author

My point is, notebooks are a more "rich" target so it is likely simpler to to have them as output targets than as "source code".

Yes of course I completely agree, I just did not know it was possible.

@Evizero This amazing, and the end result is definitely what I was aiming for as well!!! But it seems quite complicated at the moment. When I have more free time I will have to "study" it if I want to apply it.

But maybe your approach can also be refined and implemented here in Documenter.jl as a full feature!

@Datseris Datseris changed the title Create pages out of Jupyter notebooks? some (markdown) page <-> Jupyter notebooks conversion? Mar 29, 2018
@mortenpi mortenpi added Type: Feature Type: Plugin A feature that should be implemented as a separate package. Status: Available labels Apr 3, 2018
@mortenpi
Copy link
Member

mortenpi commented Apr 3, 2018

In order to not make Documenter explode with features, I am thinking it might be best to have this as a separate package/plugin. But it might be easiest to have this prototyped in Documenter's code first, and then see what it would take to split it into a separate package, making the necessary refactorings of Documenter's internals along the way.

@fredrikekre
Copy link
Member

fredrikekre commented Apr 16, 2018

I put together https://github.com/fredrikekre/Literate.jl

It is a combination of some ideas from Weaver.jl, the code @Evizero showed and some local code I had for the same purpose. It is very WIP, 0% test coverage, but pretty well documented I think (https://fredrikekre.github.io/Literate.jl/latest/). Would be nice if someone would like to try it out.

@Datseris
Copy link
Contributor Author

Thanks so much @fredrikekre for this. Seems easy to use and well laid out. I will incorporate it in my documentation, some time "soon". I will definitely report here as well how good it went and if I can come across improvements/issues/etc. I will post an issue at the repo!

@Evizero
Copy link
Contributor

Evizero commented Apr 23, 2018

@fredrikekre Awesome to see how you took this to the next level

@Nosferican
Copy link
Contributor

Nosferican commented Aug 18, 2018

I think the idea is to have one convenient way to convert from markdown like to HTML, TeX, and IPYNB while supporting a variety of features:

  • Citation management
  • Equation / math
  • Syntax highlight
  • Cross-reference
    etc.

The Pythonic way of using RST is a bit too separate from script to my liking.

@odow
Copy link
Collaborator

odow commented Oct 24, 2021

Closing because it's been 3 years and tools like https://github.com/fredrikekre/Literate.jl exist and integrate well into Documenter.

@odow odow closed this as completed Oct 24, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Status: Available Type: Feature Type: Plugin A feature that should be implemented as a separate package.
Projects
None yet
Development

No branches or pull requests

7 participants