Open tuncbkose opened 2 months ago
I'm not sure yet if this will be widely used for notebooks, but cannot hurt the addition. Pending that tests and documentation will be added to this PR.
While adding the test, I added a get_latex
function to access the built file. For some reason though the built latex file is named python.tex
instead of {filename}.tex
. I could not figure out why, so if anyone has an idea I'd be interested to know.
There are two errors, 1 is a typo I made and the other is about that Tex file naming issue as far as I can tell. Will take a closer look later.
I haven't had a long think about this PR, but my initial sense is one of reluctance to merge it. The code-cell
directive in MyST-NB is part of an (implicit) standard, and any new features should be something we carefully introduce. MyST-MD is an example of another project that implements the MyST spec.
I wonder here whether a post-process tool would be better suited, e.g. https://github.com/agoose77/sphinx-builder-classes. This extension allows you to add classes to your directives that are ignored for particular builders.
I understand if there may be good reasons not to merge this, but as far as I understand :load:
is also not a part of the spec, and it has been sitting here for a while.
About the link, post-processing doesn't always help when you need the code outputs to be dependent on the builder. I appreciate that this is not a straightforward thing to implement in the best way, but maybe something flagged as experimental may be ok, following :load:
s example. I'll be using it myself either way.
I made this primarily for myself but thought should make a PR if there would be any interest in merging. I'm happy to add tests/documentation, but I'd like to get an OK that the implementation is fine first.
Also, as far as I can tell,
NbParserConfig.builder_name
isn't used by anything, so I just co-opted it.