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

Some small formatting issues following upgrade to master #296

Closed
gureckis opened this issue Sep 4, 2019 · 14 comments
Closed

Some small formatting issues following upgrade to master #296

gureckis opened this issue Sep 4, 2019 · 14 comments
Labels
bug Something isn't working

Comments

@gureckis
Copy link

gureckis commented Sep 4, 2019

Sorry for opening and closing issues but get getting familiar with this project! I noticed that my book (and others) has a fixed width in Safari such that the entire page is centered in the browser and only expands to some maximum width (about 1200px). In contrast the example book, the table of contents anchor to the left side of the page and the main text area expands to fill whatever space is available. This seems to somewhat influence if you can do the Tufts-Style pullouts. Is there a way to toggle the behavior that the jupyterbook guide has?

Example:
Fixed width: http://www.pymc-learn.org/pymc-learn-book/features/interact
Left anchor, scaling width: https://jupyter.org/jupyter-book/intro.html

@choldgraf
Copy link
Collaborator

Can you try installing from the "master" branch? I think that's because we haven't cut a release with the new layout in it yet:

https://jupyter.org/jupyter-book/intro.html#Installation

@choldgraf
Copy link
Collaborator

(and no problem about the issues! it is always fine :-) )

@gureckis
Copy link
Author

gureckis commented Sep 5, 2019

Hmm.. I upgraded to github master and that did change the page layout (yay!) but broke my site's search function. Now Search needs explicit 'not_numbered: true'? also when clicking it in the sidebar it goes to a dead link (`/courses/fall19/labincp/course-content/.html' not found.)

I did run the upgrade procedure on my book.

@choldgraf
Copy link
Collaborator

Ah - search should now not need its own TOC section, but is a little eyeglass in the top right. Sorry, you happen to be giving it a shot right when a bunch of stuff changed on master (a bunch of features were pushed just before the semester started)

@gureckis
Copy link
Author

gureckis commented Sep 5, 2019

got it, all makes sense now. I'm figuring it out. any guesses why markdown wraped in <div class="something" markdown="1"></div> no longer renders as Markdown. I was using that with the pip version and it worked but on the bleeding edge from github this no longer seem to trigger markdown rendering within the div.

@choldgraf
Copy link
Collaborator

Hmm, what are you trying to do? Do you have an example notebook?

@gureckis
Copy link
Author

gureckis commented Sep 5, 2019

yeah I have a .md file for my syllabus that looks like this

# Schedule

This is the schedule for the semester.  This page will be frequently updated based on how we progress and everything is subject to change. Homeworks and links to the lecture will be provided here for easy reference to the calendar.

<div  class="schedule" markdown="1">

**Date** | **Lecture** | **Lab** 
:---|:---|:------|:---
*Wed, Sept 4* | Introductions, course policies <br> -- [HW1](https://forms.gle/Nqqm2LhR1x3Z53Kj7) - Due Sun Sept 8th  | -- 
*Mon, Sept 9* | What is cognitive science? Introduction to Jupyter | Accessing JupyterHub, Basics of Jupyter, python, and markdown  
*Wed, Sept 11* | Why do we do statistics? | intro to Python: Indenting, variables, functions, importing libraries 

</div>

but the markdown in the middle is no longer being rendered (after upgrade). interestingly if I delete the final </div> it starts rendering but I think that is just the browser making some choices about how to handle unmatched divs based on looking at the rendered files in _build.

@choldgraf
Copy link
Collaborator

Just to be on the same page, is the issue that you don't want nbconvert to render the table, and instead want jekyll to render it?

Maybe there is a bug in there somewhere...

@gureckis gureckis changed the title Default page width Some small formatting issues following upgrade to master Sep 5, 2019
@choldgraf choldgraf added the bug Something isn't working label Sep 5, 2019
@choldgraf
Copy link
Collaborator

Just a note that (I think) there is a bug in your table code. You have one extra "column alignment" cell (the final :---). When I deleted that, the markdown table rendered fine using nbconvert for me. Can you try that?

@gureckis
Copy link
Author

gureckis commented Sep 5, 2019

ok interesting, that didn't work for me. here is the simplified schedule.md file:

# Schedule

This is the schedule for the semester.  This page will be frequently updated based on how we progress and everything is subject to change. Homeworks and links to the lecture will be provided here for easy reference to the calendar.

<div  class="schedule" markdown="1">

**Date** | **Lecture** | **Lab** 
:---|:---|:------
*Mon, Sept 9* | A | B  
*Wed, Sept 11* | C | D 

</div>

and the output in _build following jupyter-book build . --overwrite

---
interact_link: content/schedule.md
kernel_name: 
has_widgets: false
title: 'Schedule'
prev_page:
  url: /course-content/syllabus.html
  title: 'Syllabus'
next_page:
  url: http://labincp.jupyter.hpc.nyu.edu
  title: 'JupyterHub'
comment: "***PROGRAMMATICALLY GENERATED, DO NOT EDIT. SEE ORIGINAL FILES IN /content***"
---

<div class="jb_cell">

<div class="cell border-box-sizing text_cell rendered"><div class="inner_cell">
<div class="text_cell_render border-box-sizing rendered_html">
<h1 id="Schedule">Schedule<a class="anchor-link" href="#Schedule"> </a></h1><p>This is the schedule for the semester.  This page will be frequently updated based on how we progress and everything is subject to change. Homeworks and links to the lecture will be provided here for easy reference to the calendar.</p>
<div  class="schedule" markdown="1">

**Date** | **Lecture** | **Lab** 
:---|:---|:------
*Mon, Sept 9* | A | B  
*Wed, Sept 11* | C | D 

</div>
</div>
</div>
</div>
</div>

@choldgraf
Copy link
Collaborator

Could you try removing the <div class="schedule" markdown="1"> code blocks? For me, that makes it render fine.

In this case, do you need to style your table in a particular way using the .schedule tag? If so, you can add any tag to your notebook cell, and that tag will be added to the top-level DIV for the cell in the HTML, with tag_ appended to it.

So if you added the tag schedule, then the final div would have a class of .tag_schedule.

@gureckis
Copy link
Author

gureckis commented Sep 6, 2019

oh that's great, ok. yeah it works fine without the outer div. however Jekyll suggest this is a legit way to stylize a bit of markdown: https://kramdown.gettalong.org/syntax.html#html-blocks. however,t a million iterations of blank lines and spaces and whatnot never triggered markdown rendering inside the <div markdown="1"></div> block. your method with jupyter is just as good for me (it is jupyter-book after all) so I'll just try that and skip the .md rendering all together!

@choldgraf
Copy link
Collaborator

Yep - that would definitely work with Jekyll, I think that the reason it doesn't is because each page's intermediate HTML file isn't parsed as markdown by Jekyll, so that behavior isn't triggered. I believe that the markdown="1" trick is if you have a markdown file, and want HTML inside that markdown file, and then inside the HTML is more markdown. While that is the case for the original Jupyter Book content, by the time Jekyll sees the page, it's an HTML file instead of a markdown file. That changed in the master branch which is probably why this behavior broke. (the reason we changed it was to remove dependence on Jekyll for building each page's HTML, and instead rely on nbconvert for that)

Do you think this issue is resolved for you? If so, feel free to close!

@gureckis
Copy link
Author

gureckis commented Sep 6, 2019

yep, and well explained! Thanks!

@gureckis gureckis closed this as completed Sep 6, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants