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
ReST support in notebooks #888
Comments
I like your idea to have the ReST preview open a new tab/window and it should be a deliberate action on the part of the user. |
Here are my notes about reST support from a recent email discussion (it may repeat some of Min's points, I'm just pasting my whole email for reference). None of this is cast in stone, just putting it out here so we have material for the discussion:
You could then imagine having a complex sphinx document (even a book) where certain parts are hand-written reST files and other sections/chapters are actually written as notebooks. The flags would allow you to control whether the notebook is only exported from the file as-is, or actually re-executed before export (allowing for a much more sophisticated form of tutorial/documentation creation for libraries, as well as a doctest-like capability of a higher degree). The reST export will require a fair amount of machinery: currently in the notebook all data is inlined (figures, etc) and that will have to go somewhere. I think a sensible solution is to add a directory called _files/ (like browsers do when they download a full html page), where figures and other files get disentangled and saved. The export will then create
I don't think we should focus too much on lossless roundtrip conversion: ensuring perfect roundtripping is devilishly hard and making such a promise to users is a hard to maintain contract. However, we could certainly implement reST import so that from a reST document, code blocks are read in as cells. That would make it possible for someone to migrate a reST document into a notebook. Basically this would mean writing a docutils writer that outputs ipynb files. |
Implemented as Plaintext cells in master. |
This is a place to discuss the requirements of ReST support in the notebooks.
We use markdown now, because what we have are light text cells, for annotating your documents. They are essentially rich text + math comment areas. ReST is a great deal more than that, and as such also a great deal more expensive to use (markdown does not require any server communication at all). We initially supported, but removed cell-level ReST support, because it isn't really ReST if each cell is treated as an independent document.
Users should be able to get everything they would expect from ReST when using it in the notebook. That means citations, references, links, and section-levels must be preserved across all cells in a document. As I understand it, this means that all cells must be rendered together. The potential cost of rendering the cells together may mean that render should be a deliberate action, rather than passive on mouseout of every text cell. Further, if ReST has to render the entire document, maybe it should include the code/output as well, and generate the entire document. If we do this, it should probably load in an external preview window, showing the full rendered output, rather than rendering inplace like the markdown cells.
Having markdown as the first-class language for cells, and ReST for full-document output may cause some problems, but it's possible a one-time pass of pandoc for converting md cells to rst would ameliorate that.
The text was updated successfully, but these errors were encountered: