-
Notifications
You must be signed in to change notification settings - Fork 676
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
modularizing the bage building and beefing up single page building #344
Conversation
e84850c
to
df68220
Compare
e7c671c
to
ec0b57f
Compare
49646a4
to
f7f24af
Compare
f7f24af
to
28c9455
Compare
89260ee
to
65f4db7
Compare
9c6eb3e
to
da72997
Compare
da72997
to
93369b2
Compare
OK, tests are happy and the new netlify build is working as well. None of this should change what the user experiences or how the sites look (mostly), but there's a fair bit of rearranging under the hood (which is why there are so many modified files). If anybody has thoughts give them now! |
maybe @SamLau95 has thoughts on this one as well - any thoughts on the SCSS restructuring? The goal is to separate out the pieces for "building a page" from "building a book", though hopefully without increasing the cognitive burden too much |
I'll look at this first thing tomorrow morning !! Thanks for the ping |
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.
This looks really good ! I had one question on whether users can add in their own JS / CSS, much as we do in the full book.
I'm also a little confused in that it seems that the CSS for the page converted from the notebook is different than the CSS for the page converted from the Jupytext / Markdown files ? Not sure if it's just the chosen exemplars or if they're genuinely different, looking at e.g. the title and byline.
jupyter_book/page/page.py
Outdated
return html, resources | ||
|
||
|
||
def page_head(): |
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.
Would it be worthwhile to also let users add in their own JS / CSS here, as we do in the full book ?
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.
Ah that's a good idea - lemme give it a shot
Thanks for the feedback @emdupre! I just pushed a commit with the ability to add custom CSS and JS in the write_page function + some tests for it. re: page for notebook vs. jupytext, I don't believe the CSS is different between the two. The main thing that's different there is a function I was playing around with to embed a That said, I think this PR is already too busy, so I'm going to remove that functionality for now and I opened up #362 to talk about it! Any feedback for other stuff? |
ce41bf7
to
8f2d5aa
Compare
Looks good to me! To clarify, this PR lets us publish single notebooks as standalone webpages instead of publishing notebooks as pages within a larger book? |
@SamLau95 yep exactly. Basically it tries to factor out the "build a single page's HTML" steps into a sub-module. Now the book uses that submodule for each page, and if you want to build a page by itself, then you can add a |
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.
This LGTM ! 🎉 Really excited to take it for a spin !
ok...I'm gonna merge this one away and we can see how it breaks :-) |
This PR makes the single-page HTML building a bit more modular and lays some foundation for making it easier to build a single page's HTML from book content. It does the following main things:
build_html
function now takes a NotebookNode as input, and outputs raw HTMLwrite_html
function that then takes the output HTML and writes it to diskbuild_html
function and adds in the CSS / SCSS / js needed to make the page render normally as a standalone pageassets/
folder instead of_includes/
. This should speed up builds and make it clearer what depends on the Jekyll site.page/
sub-folder, to make it clearer what should be self-contained within a page and what should be specific to a whole book.There are a lot of files changed in this one, mostly because of the file location rearranging. However, it shouldn't change the behavior of building books (building a single page now behaves a bit differently).
@emdupre you might be interested in this because it's trying to further disentangle building a whole book from building a single page. Does anything about the artifact preview look off to you?
In addition to the doc below, here are examples of single-page HTML outputs:
https://1727-137292803-gh.circle-artifacts.com/0/html_singlepage/jupytext.html
https://1727-137292803-gh.circle-artifacts.com/0/html_singlepage/markdown.html
https://1727-137292803-gh.circle-artifacts.com/0/html_singlepage/notebooks.html