Conversation
Here we create a specific `PasteTextNode`, and move most of the logic for formatting etc out of the `PasteNodesToDocutils` transform. This makes the transform more generic, so that we can add more PasteNode subclasses to it in the future. We also rename the role from `nb:paste` to `nb:text`, to reflect its specific nature, and rewrite the documentation to reflect this.
|
In d4aa616, I have refactored the paste role and rewritten the documentation accordingly: |
|
this looks awesome - I'll take a look soon! |
|
I was also thinking of changing |
|
took a look at the docs - the figure bit is super cool!! A few quick thoughts:
|
Yeh that was my thinking, that this role (with the formatting aspect) is very specific to text |
|
to further prove my counter point, I tried adding I think this means we can basically already include "sparkline"-style images easily. That is super cool. All we'd need to do is insert that in the doctree and add a css rule like |
|
Yeh maybe |
|
@chrisjsewell yeah I was thinking that if we used |
|
|
yeah - I was thinking then we'd always follow a Or maybe Edit: I wonder if domains can also be used as a role/directive as well? E.g. could |
No I think only one domain name is allowed |
|
Ok, for now, in 19b2b0e I have change the domain name to I have also added a Obviously this should be up-streamed to |
| def create_node(self, output: dict): | ||
| """Create the output node, give the cell output.""" | ||
| # the whole output chunk is deposited and rendered later | ||
| # TODO move these nodes to separate module, to avoid cyclic imports |
There was a problem hiding this comment.
I hope that we can just import these nodes from jupyter-sphinx at some point, whenever I can figure out the tests in jupyter/jupyter-sphinx#107
| col.process_doc(self.app, node) | ||
|
|
||
|
|
||
| def cell_output_to_nodes_inline(cell, data_priority, write_stderr, dir, thebe_config): |
There was a problem hiding this comment.
This one you'd like to upstream yeah? What's the main difference w/ jupyter-sphinx one?
There was a problem hiding this comment.
Yep. All the nodes returned should be inline versions, i.e. literal_block -> literal, container -> inline, math_block -> math
|
This is looking really good to me - I like the API decisions in here, and we can always re-visit after others have had a chance to play with them. |
|
(FYI this is still in "draft" state but I am +1 to merge when you are happy with it) |
So that e.g. tables inherit the same CSS
Two last changes for you to review above, both were made so that pandas tables are formatted properly in figures here: https://189-241268229-gh.circle-artifacts.com/0/html/use/glue.html#tbl-df |
|
If you do want to then merge, please add this as the commit message 😁 This commit introduces the
Multiple glue roles/directives have been introduced for formatting the output, including the |
|
Final piece of the puzzle: https://194-241268229-gh.circle-artifacts.com/0/html/use/glue.html#the-glu-math-directive |
|
This looks great to me - let's give it a merge and see how things feel as folks on the team use this, I am excited! |

closes #70 and also relates to #72
An initial draft of reworking the paste roles/directive into a domain. The domain achieve's two things:
app.add_domain(NbGlueDomain).NbGlueDomain.clear_doc)I have then added the
PasteFiguredirective as an example of extending the functionality of the domain for handling different output types. It allows for captions, labelling/referencing, width and alignment.Take a look at:
https://173-241268229-gh.circle-artifacts.com/0/html/use/glue.html#using-the-nb-figure-directive
😄