-
Notifications
You must be signed in to change notification settings - Fork 654
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
✨ NEW: Introducing jupyterbook-latex and added handling of tableofcontents for latex #1167
Conversation
Codecov Report
@@ Coverage Diff @@
## master #1167 +/- ##
==========================================
+ Coverage 92.78% 93.50% +0.72%
==========================================
Files 8 8
Lines 887 970 +83
==========================================
+ Hits 823 907 +84
+ Misses 64 63 -1
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
1460b91
to
5c3ba03
Compare
cafa391
to
6681b7e
Compare
Have also introduced The styling of tableofcontents directive follows the default styling of sphinx for now. (the title 'Table of Contents' is part of markdown here not the directive) |
@AakashGfude this is looking good. May I suggest you edit the top (main) comment field with a full description including the inclusion of This will supersede #1125 right? |
Thanks @mmcky , have updated the top comment. No, I have not introduced I have included the doc page, where all the features are outlined. Hopefully, that can outline the proposed changes? |
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.
Looking good cheers, just a request for documenting/typing the code a bit more, and some more "lower level" unit tests
jupyter_book/directive/toc.py
Outdated
return filtered_toc | ||
return | ||
|
||
def _has_toc_yaml(self, subnode, tocdict, depth): |
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.
I think this method, together with _handle_toc_header
, should be a standalone function. Then you can you add some unit tests, e.g. constructing example globaltoc dicts and testing the output subnode.pformat()
. Because at the moment there is only a few integration tests where it is difficult to test a large range of possibilities and to understand what the functions do.
Also can you try "typing" your methods and providing docstring explanations of the inputs, e.g. something like
from typing import Dict
from docutils import nodes
def _has_toc_yaml(self, subnode: nodes.Element, tocdict: Dict[str, nodes.Element], depth: int) -> None:
"""constructs toc nodes from globaltoc dict
:param subnode: this is....
:param tocdict: this is....
:param depth: this is....
"""
You should be trying to type all your code and using mypy, for example markdown-it-py and myst-parser are now fully typed (executablebooks/MyST-Parser@07ac859) and this will eventually be the same for myst-nb
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.
Great. Thanks, @chrisjsewell . On 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.
Hey @chrisjsewell, have typed the functions and added tests for individual ones. let me know if it is looking better.
Also in https://github.com/executablebooks/jupyterbook-latex/blob/master/docs/intro.md it says "jupyterbook-latex is in an active development stage and may change rapidly.", and it says about "git cloning" to install. a) With these changes, is this package more stable now, and so we don't have to essentially warn people away from using anymore |
3f56db8
to
2d20cab
Compare
@AakashGfude is |
@mmcky have added the dependency here https://github.com/executablebooks/jupyter-book/pull/1167/files#diff-60f61ab7a8d1910d86d9fda2261620314edcae5894d5aaa236b821c7256badd7R20 , only for the testing case. |
Hmm ... I just had a failure when using |
did you run |
@AakashGfude doing some testing on lecture-python.myst I am finding:
I'll continue to dig a little into these issues |
oopsie. sorry had not setup
Since your build was not using |
thanks @AakashGfude building nicely now after |
I belive with our testing in different projects its stable enough. So, I reckon we can remove this.
Should we add a button to the theme, to download the whole repo as pdf using this extension as well?
have done these changes in this PR https://github.com/executablebooks/jupyterbook-latex/pull/37/files#diff-22760d417a52c66f14bee182587d458d0737a616dd14cb09748b4c725fc5809fR12 . |
@AakashGfude perhaps there should be an But an example link would be great 👍. We could build the |
@AakashGfude is there a way to switch this feature off just in case a user has configured something that they are using with the existing setup? I think this should be switched |
It only affects the Latex output, the one which was written earlier for HTML has just been copied in this else case |
@chrisjsewell @choldgraf I am planning to merge this on |
+1 from me 👍 |
thanks @AakashGfude for this pull request and enhancements -- and iterating on comments and design. This will be a useful addition and big improvement to LaTeX builds. |
It looks like comment has been acted on but GitHub hasn't registered that.
@chrisjsewell I am not sure why GitHub still had your |
Heya @AakashGfude @mmcky, yeh in general all looks great thanks 👍
I don't see a jupyter-latex package on conda yet? Can you address this as a priority a3065b1; can you make sure that commit messages adhere to https://github.com/executablebooks/.github/blob/master/CONTRIBUTING.md#commit-messages |
oh man that commit message is awful. Sorry @chrisjsewell. I should have adjusted from the first cell of the PR. Is there a way to amend this? |
|
Same goes for @choldgraf with 5de7ca6 😉 it just helps for understanding changes in retrospect and constructing the changelog for a release |
you can edit any of the message cells (top-right), but also you can just edit the message directly, before pressing "Confirm squash and merge" |
let me know if you need any help, its pretty straightforward |
Sorry I meant is there a way to amend the commit message? I'll have a look over the first cell of the PR history too. |
you can do an interactive rebase of the master branch, although thats a bit naughty 😬 (I'm not sure if just changing the message changes the commit hash). Perhaps if you write the intended commit message here I can amend it. |
oh that definitely sounds like something I'm not going to try :-). The initial PR message has more details but here is a good summary ✨ NEW: Introducing jupyterbook-latex and added handling of tableofcontents for latex (PR #1167) This PR brings improvements to
|
…tents for latex (PR #1167) This PR brings improvements to `PDF` builds via `LaTeX` by incorporating the [jupyterbook-latex](https://github.com/executablebooks/jupyterbook-latex) extension. This initial release: 1. harmonises the document structure for `html` and `latex` outputs, by implementing support for `part`/`chapter` structures in the `_toc.yml` for PDF via LaTeX, 2. brings support for the jupyter-book directive `tableofcontents` to PDF via LaTeX, and 3. adds support for commonly used tags on `code-cell` directives (such as `hide-cell`) to PDF via LaTeX Co-authored-by: mmcky <mamckay@gmail.com> Co-authored-by: mmcky <mmcky@users.noreply.github.com>
ok sorted, yeh you shouldn't normally rebase master, because it can screw up other peoples branches/PRs of it. But as this was only just merged, then hopefully no one would have updated their branches with it anyway |
I have to send a PR of the recipe to https://github.com/conda-forge/staged-recipes . am I right? |
Yep 👍 |
congrats @AakashGfude and @mmcky on getting this one in 🚀🚀🚀 |
This PR brings a range of improvements to
PDF
builds viaLaTeX
by incorporating the jupyterbook-latex extension. This initial release is focused on bringing harmony tohtml
andlatex
outputs (through support forpart
/chapter
structures in the_toc.yml
), support for the jupyter-book directivetableofcontents
, and support for commonly used tags on code-cell directives such ashide-cell
.This initial release targets
whole of project
pdf files only.pdf
andlatex
generation. Activation of this package is configurable with theuse_jupyterbook_latex
key (turned on by default). Further information forjupyterbook-latex
can be read here: https://github.com/executablebooks/jupyterbook-latex/blob/master/docs/intro.md. This package adds support for document structures that are recommended for jupyter-booktableofcontents
directive for LaTeX by creating a list of reference nodes such as.We have documented some design decisions and future work in this discussion thread.
TODO:
fixes #847
fixes #810
fixes #1192