data-8 / textbook

The textbook Computational and Inferential Thinking: The Foundations of Data Science

Home Page:http://www.inferentialthinking.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

HIDDEN stopped hiding code cells

davidwagner opened this issue · comments

Putting # HIDDEN at the top of a code cell used to cause the code to be hidden (excluded from the generated output). That no longer works.

To reproduce: run make site; make serve and look at http://127.0.0.1:4000/chapters/01/3/1/Literary_Characters.html; it shows two code cells at the top of the page that contain # HIDDEN.

@choldgraf, do you have any ideas about how to troubleshoot this?

(Could it be related to jupyter-book/jupyter-book#162 and jupyter-book/jupyter-book#207? I didn't fully process their implications.)

_config.yml looks reasonable:

hide_cell_text: '# HIDE CODE AND OUTPUT' # When building the textbook, any cells with this text inside will be hidden in the output markdown
hide_code_text: '# HIDDEN'               # When building the textbook, any cells with this text inside will have *only* their output shown (no code)

I looked through recent changes to nbclean and didn't see anything there that seemed like it would create problems.

Hey @davidwagner - good catch. Jupyter Book now has people hide cells via notebook cell tags rather than via comments in the cell itself. Here are some instructions on Jupyter Book:

https://jupyter.org/jupyter-book/features/hiding.html

cell tags are built in to the classic notebook interface already (I think it's under View somewhere) and this extension is useful for handling tags in jupyter lab.

does that help?

@choldgraf, Oh, I see. Thanks for the explanation. Unfortunately I can no longer build the textbook, due to this change to Jupyter Book. We have 143 instances of # HIDDEN in the Data 8 textbook and converting all of those by hand to the new method sounds painful. Can you suggest any tool I could use to automate the conversion? Or is there any way to enable backwards compatibility support for the old comments method?

I thought we had converted those a while back but I guess not, so I’ll do the conversion this week. Sounds good?

@choldgraf , oh, that'd be awesome, thank you!

Awesome, thank you so much for all the fixes, @choldgraf ! I appreciate it.