[IPython-dev] Highlight lines of code in code cells?

Eric Matthes ehmatthes at gmail.com
Mon Dec 2 11:37:07 EST 2013


Hello,

I often use IPython Notebook to write tutorials. In tutorials, I find it
helpful to highlight the lines of code that are being changed in each
iteration of a project. Is there a straightforward way to highlight
individual lines of code within a code cell?

I came up with one approach, but it feels like an ugly hack. I write a
comment before the line[s] I want to highlight, and a comment after. Then
when converting to html I convert these comment lines to <b> and </b>. This
works, but it clutters the raw notebook file with formatting comments.

##bold
print("I'd like to highlight this line.")
##/bold

becomes:

<b>print("I'd like to highlight this line.")</b>

Is there a better way?

(formatting I'd like to have:
http://peak5390.wordpress.com/2012/12/08/matplotlib-basemap-tutorial-making-a-simple-map/
)

Eric
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/ipython-dev/attachments/20131202/e1492344/attachment.html>


More information about the IPython-dev mailing list