Hide comment lines in jupyter

Viewed 72

Is there any way to hide comments in Code Cell lines in a Jupyter notebook?

I tried using a front-end extension with the following code:

$(".cm-comment").hide()

Which works fine but the cells appear to be regenerated each time I click on them which re-adds the code.

I then tried:

$(window).click(() => $(".cm-comment").hide())

So rexecuting each time there is a click anywhere. Except, if I click on an un-selected code cell the listener isn't triggered. (It is if I click on a selected cell.)

I tested this by using:

$(window).click(() => console.log("click"))

Clicking anywhere will log "click" to console except for clicking on an un-selected code cell.

0 Answers
Related