-
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
✨♻️‼️ Rewrite myst-nb #380
Merged
Merged
Changes from 68 commits
Commits
Show all changes
88 commits
Select commit
Hold shift + click to select a range
d7fe4b6
⬆️ UPGRADE: myst-parser v0.16.1
chrisjsewell 6854166
Move jupyter-sphinx/ipywidgets functionality into jsphinx
chrisjsewell 815f6fc
move nodes from jsphinx -> nodes
chrisjsewell 83cccbd
ipywidgets url: unpkg -> jsdelivr
chrisjsewell 71bec09
Move sphinx extension to separate module
chrisjsewell c07109f
updates from myst-parser master branch
chrisjsewell b33ea1e
Module ansi_lexer -> lexer, and add entry points
chrisjsewell 02c3494
Initial implementation of docutils parser
chrisjsewell 11188c2
Document render methods
chrisjsewell d39d2f4
modularise docutils code
chrisjsewell 27ec5f7
Add execution data to the document
chrisjsewell 248e7af
Initial implementation of new sphinx parser
chrisjsewell 73ea5ed
Improve logging mechanism
chrisjsewell 422f2e7
Handle mime type selection in sphinx
chrisjsewell fa395a6
rename logger classes
chrisjsewell 88f2db6
Add deprecation pathway for legacy config names
chrisjsewell 30e29b6
Add notebook reading of custom formats
chrisjsewell 7c93581
Improve execute code
chrisjsewell 7148c5f
Add UnexpectedCellDirective
chrisjsewell 5023034
Move coalesce_streams to new module
chrisjsewell b0c2183
Handle ipywidgets
chrisjsewell 478b550
Successfully build the docs (with warnings)
chrisjsewell 8ce2d8c
re-add toggle-button integration
chrisjsewell c21ab70
Replace all old code
chrisjsewell ab03041
pre-commit fixes
chrisjsewell 3e54270
re-implement `execution_excludepatterns`
chrisjsewell 672fea0
skip glue outputs for now
chrisjsewell 4dfb54b
Fix execution tests
chrisjsewell 2bb55e2
fix more tests
chrisjsewell 95e4cf8
fix more tests
chrisjsewell 26d8f40
fix collector
chrisjsewell 2c38c16
typo fix
chrisjsewell 0a06ecf
And notebook level overrides of configuration
chrisjsewell 156d389
Add per-cell configuration
chrisjsewell ca38f6e
Add figure code cell output rendering
chrisjsewell 6573461
Do not create code cell container, if removing input & output
chrisjsewell 39a2b10
Fix more tests
chrisjsewell 24604f6
Render raw cells
chrisjsewell 3a19193
initial glue implementation
chrisjsewell baed2c6
Add some docstrings
chrisjsewell 91232e8
add MimeData data class
chrisjsewell 3b9010d
Add most glue functionality
chrisjsewell b67d219
Update documentation
chrisjsewell 1e54d1e
Update test for sphinx 3
chrisjsewell b1bfa59
Test fixes
chrisjsewell ed68851
test fix
chrisjsewell 766ee43
Output displayed glue variables
chrisjsewell c3dc375
fix docs
chrisjsewell 19e3204
fix sphinx_book_theme integration
chrisjsewell 4130489
Updates from myst-parser
chrisjsewell 7929b65
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] bcc711c
pre-commit fix
chrisjsewell aa6e502
Update pytest_param_files
chrisjsewell daab4d2
Add `render_markdown_format` configuration
chrisjsewell 5883982
improve glue code
chrisjsewell 0d27b3e
Improve registering of per-page javascript
chrisjsewell e87cf4c
Remove uneeded jupyter_sphinx CSS
chrisjsewell 1dd2e64
In sphinx, cache glue keys (on env)/outputs(on file)
chrisjsewell fff43fa
Update docs/use/formatting_outputs.md
chrisjsewell 64c6d2b
remove unnecessary header in glue.md
chrisjsewell a7a7b32
Improve docutils output of CSS
chrisjsewell d71d0cf
remove no longer used method
chrisjsewell cff8ebc
rename render_unknown -> render_unhandled
chrisjsewell c20db70
windows fix
chrisjsewell 51bb988
minor updates
chrisjsewell ac493b0
pin ipython to <8
chrisjsewell 5cc68ef
pin ipython to <8 for testing
chrisjsewell fe1529c
Fix glue line warnings
chrisjsewell 0234f5d
Merge branch 'master' into refactor-mystnb
chrisjsewell cddf60d
use myst-parser v0.17.0
chrisjsewell 7256cc0
Update test_parser.sphinx3.xml
chrisjsewell 61d8d35
Update tests to ipython v8
chrisjsewell b543351
Add typing
chrisjsewell 280c119
fix docs
chrisjsewell c354d0b
Update docs
chrisjsewell 9b3bf64
Update jupyter-cache
chrisjsewell fcc5ace
Update docutils_.py
chrisjsewell 437de73
Move to flit, replace attrs
chrisjsewell e8daf94
Update tests.yml
chrisjsewell e815a4b
Update tests.yml
chrisjsewell faf0367
Update tests.yml
chrisjsewell 7b71185
remove 3.10 for now
chrisjsewell eb4a92c
Restructure modules
chrisjsewell 14cab36
Fix typing
chrisjsewell 1e5450a
stuff
chrisjsewell cd60fe6
Add (limited) cross-document gluing
chrisjsewell 89924b9
Add `MimeRenderPlugin`
chrisjsewell c45bdab
add validator
chrisjsewell File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,16 +3,70 @@ | |
Python API | ||
========== | ||
|
||
.. toctree:: | ||
:maxdepth: 2 | ||
The parsing of a notebook consists of a number of stages, with each stage separated into a separate module: | ||
|
||
nodes | ||
render_outputs | ||
1. The configuration is set (from a file or CLI) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is a very helpful description of the whole process, I wonder if we could put this in a place where it is more discoverable? Can do that in a follow up though |
||
2. The parser is called with an input string and source | ||
3. The parser reads the input string to a notebook node | ||
4. The notebook code outputs are potentially updated, via execution or from a cache | ||
5. The notebook is "pre-processed" in-place (e.g. to coalesce output streams and extract glue outputs) | ||
6. The notebook is converted to a Markdown-It tokens syntax tree | ||
7. The syntax tree is transformed to a docutils document AST (calling the renderer plugin) | ||
8. The docutils document is processed by docutils/sphinx, to create the desired output format(s) | ||
|
||
Miscellaneous | ||
Configuration | ||
------------- | ||
|
||
.. autoclass:: myst_nb.ansi_lexer.AnsiColorLexer | ||
.. autoclass:: myst_nb.configuration.NbParserConfig | ||
:members: | ||
|
||
Parsers | ||
------- | ||
|
||
.. autoclass:: myst_nb.docutils_.Parser | ||
:members: | ||
|
||
.. autoclass:: myst_nb.sphinx_.Parser | ||
:members: | ||
|
||
Read | ||
---- | ||
|
||
.. autoclass:: myst_nb.read.NbReader | ||
:members: | ||
|
||
.. autofunction:: myst_nb.read.create_nb_reader | ||
|
||
.. autofunction:: myst_nb.read.is_myst_markdown_notebook | ||
|
||
.. autofunction:: myst_nb.read.read_myst_markdown_notebook | ||
|
||
Execute | ||
------- | ||
|
||
.. autoclass:: myst_nb.execute.ExecutionResult | ||
:members: | ||
|
||
.. autofunction:: myst_nb.execute.execute_notebook | ||
|
||
Pre-process | ||
----------- | ||
|
||
.. autofunction:: myst_nb.preprocess.preprocess_notebook | ||
|
||
Render plugin | ||
------------- | ||
|
||
.. autoclass:: myst_nb.render.MimeData | ||
:members: | ||
|
||
.. autoclass:: myst_nb.render.NbElementRenderer | ||
:members: | ||
|
||
Lexers | ||
------ | ||
|
||
.. autoclass:: myst_nb.lexers.AnsiColorLexer | ||
:members: | ||
:undoc-members: | ||
:show-inheritance: |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you add a comment explaining why this section is commented out, and when we should un-comment it? (or, can we just delete it?)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed