jckantor / nbpages

Command line tool to maintain a repository of Jupyter notebooks.
https://jckantor.github.io/nbpages/
MIT License
1 stars 4 forks source link

Special formatting for cells with special tags #45

Closed adowling2 closed 4 years ago

adowling2 commented 4 years ago

In my current CBE 20258 notebooks, I use some HTML code to put a colored box around certain markdown cells. For example:

<div style="background-color: rgba(0,255,0,0.05) ; padding: 10px; border: 1px solid darkgreen;"> 
<b>Home Activity</b>: In the cell below, assign the value of 5 to the variable x. Then type Shift+Enter to execute the line.
</div>

This box is solid dark green which I use for all "home activities". I used a blue box for "class activities" and a red box for "important notes". Would it be possible to add a border and set the background color accordingly for cells with "home-activity", "class-activity", and "important-note" tags when publishing to the HTML pages? Currently, nbpages strips out this formatting, which I think is fine. I would much rather use tags.

jckantor commented 4 years ago

Check out what I did on nbpages ... https://jckantor.github.io/nbpages/02.01-Tagging.html

The relevant code is entirely in /templates/notebook.tpl, so this is potentially a user configurablel feature. But currently there is no backup for the templates if --setup is rerun. So if this looks like a good idea, then that's a change needed for --setup in order to protect against inadvertently overwriting a modified template.

jckantor commented 4 years ago

Existing templates are now backed up prior to updating in --setup. This should protect against the inadvertent loss of edits to the template files.

adowling2 commented 4 years ago

This is great! I am going to close the issue, although this is something we should eventually document.