Skip to content
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

Make tocbot work in single page mode #426

Closed
wants to merge 1 commit into from

Conversation

grst
Copy link

@grst grst commented Oct 31, 2019

See discussion in #113 (comment).

The main problem was that the tocbot script was not included.
It works in principle, but arguably the layout can be improved:

image

@grst grst mentioned this pull request Oct 31, 2019
@choldgraf
Copy link
Collaborator

choldgraf commented Oct 31, 2019

Nice! You can demo what this looks like on one of the jupyter book pages here:

https://2168-137292803-gh.circle-artifacts.com/0/html_singlepage/notebooks.html#Markdown-+-notebooks

I think for now it'd be most straightforward to style this so that it shows up at the top, in-line with the content below, and some styling changes to make it look more consistent with the main text (currently, it has smaller text because it's meant to be in the right sidebar). Perhaps one thing to do would be to move the empty nav block from here:

https://github.com/jupyter/jupyter-book/blob/master/jupyter_book/page/page.py#L111

to underneath the title block here:

https://github.com/jupyter/jupyter-book/blob/master/jupyter_book/page/page.py#L183

For the templates stuff - I agree at some point it makes more sense to use a template - we're using a jinja template for most of the HTML rendering, it's just the final "piecing things together" part that uses some manual string injection. If it gets too unweildy at some point we should templatize it

@@ -246,7 +246,7 @@ def page_html(ntbk, path_media_output=None, name=None, preprocessors=None,
html, resources = exp.from_notebook_node(ntbk, resources=output_resources)

html = f"""
<main class="jupyter-page">
<main class="jupyter-page c-textbook__content">
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is going to create some formatting weirdness in the actual book (textbook__content is a book class):

https://deploy-preview-426--jupyter-book.netlify.com/intro

better that we:

  1. Pick the CSS styles that should be shared between a "book" TOC and a single page TOC, move them into a selector that is agnostic to a book-specific class
  2. Define a class that's specific to the single page (maybe just class="jupyter-page single-page"?) and add some CSS rules for the one-page case

@choldgraf choldgraf added the enhancement New feature or request label Nov 4, 2019
@choldgraf
Copy link
Collaborator

Closing as this should be superceded by beta.jupyterbook.org, but thanks very much for your work on this! Let me know if the TOC doesn't work with the new build system

@choldgraf choldgraf closed this Apr 25, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants