-
Notifications
You must be signed in to change notification settings - Fork 84
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 myst-based 'ipynb' document structure #12
Comments
On that last point (shorthand for markdown cell breaks), why not use "double comment" characters?
? That would map onto this pattern as used in Matlab and pycharm I believe... In those cases it breaks up code cells but this seems similar. (for example, see "the percent format" here https://jupytext.readthedocs.io/en/latest/introduction.html#jupytext-formats) |
That would be semi-consistent with the jupytext |
Is your concern about comment clashing that it would be an annoying regex, or that users would find it cognitively confusing? If it is the latter, I think it's worth discussing for sure, but my intuition is that it would be OK given that this is common in other languages. For example, Matlab's uses a single But I think your concern is valid, so we should see what others think. I think that |
A little from column A, a little from column B |
Hey all - I just added a little example to the top-level-comment showing off the currently-proposed syntax for a notebook. I don't think it's too bad, what do you all think? A few thoughts that came up:
|
|
Hey @mmcky do you know what the state of implementing this with jupytext is? I seem to recall you and aakash were going to look into this? |
hey @choldgraf (@aakash) started looking into this -- but we asked him to focus on helping get the full |
sounds good...if we can unify what |
Per a recent conversation with @mmcky and @chrisjsewell , we came up with the proposal for a MyST-based IPYNB structure.
Here is an example notebook with the latest syntactic ideas
influences
constraints
Round-trip conversion
Content within cells
All content withing cells, as well as the breaks between cells, should be 100% round-trippable in a lossless fashion. The markup language used in markdown cells and anything inside code cells should not be modified.
Cell-level metadata
All metadata specified in markdown will be converted into the
ipynb
file. Conversely, a subset of cell-levelipynb
metadata will be converted into markdown. TODO: figure out what subset we want...only tags? Other publishing-specific stuff?Notebook-level metadata
The same rule applies to notebook-level metdata (and we need to figure out the subset of metadata to keep)
Proposed syntax
Notebook-level metadata
A YAML header block at the top of the document will denote notebook-level metadata
example:
Code cells
Code cells are defined with the "execute" directive, followed by the language that should be used to execute the code. If no language is specified, then a notebook-level metadata should define the default kernel to use. YAML or
:
configuration at the front of the code cell will convert into cell-level metadata.example:
OR
Markdown cells
Markdown that's in-between code cells will be treated as a single markdown cell that separates those code cells.
If a user wants to attach cell-level metadata to some markdown, then they must use the "markdown" directive. This accepts a list of tags as a short-hand input, and also accepts YAML configuration like code cells.
example:
Simple markdown cell splits
To define a split between two markdown cells, but without attaching extra metadata to those cells, there is a short-hand one-liner:
+++
This simply defines where one block of markdown content should become two markdown cells. If the author wishes to add extra metadata to one of the markdown cells, they should instead use the
pattern
The text was updated successfully, but these errors were encountered: