+TITLE: ov-highlight
ov-highlight provides a lightweight way to highlight text and put notes on
them using overlays that are locally stored.
ov-highlight defines a local save-buffer-hook to automatically update and save highlights. It uses local file variables to load the highlights and apply them when the file is opened. All of the data is stored in a single line of base64 encoded text that is made mostly invisible by Emacs.
- Features
** Pre-defined highlights
There are several pre-defined highlights that are accessed from a hydra menu
=ov-highlight/body=. I suggest you bind it to a key like H-h.
- green, pink, yellow backgrounds
- an interactive background chooser
- an interactive text color chooser
There are several markups highlights:
- bold, italic, underline, strikethrough, and box
You can change the font size as well as the font.
For editing, you can use typo, comment, delete and insert highlights.
** Define your own highlights
The library defines a macro =ov-make-highlight= to make your own highlights. The macro takes a name, a face, and other properties as arguments.
For example, here is the type highlight that puts a reddish background and tooltip on the highlight.
+BEGIN_SRC emacs-lisp
(ov-highlight-make "typo" '(:background "PaleVioletRed1") help-echo "tpyo")
+END_SRC
That macro creates the command =ov-highlight-typo=. See https://www.gnu.org/software/emacs/manual/html_node/elisp/Face-Attributes.html for details on setting face attributes.
** List the highlights
You can use =ov-highlight-display= to see a list of the highlights, jump to one of them and delete one or all of them conveniently.
** Cut/copy/paste highlights
=ov-highlight-cut-copy-paste-on= and =ov-highlight-cut-copy-paste-off= control whether you can copy and paste highlights around. This works within a buffer.
** Write highlights to html
=ov-highlight-html= will write the buffer to an html file that retains the highlights.
Highlights are basically fragile. There are many ways to mess them up.
- You cannot edit the files with other editors, or the positions of the highlights will be messed up. This means if you put annotations in a file that is under version control, and then pull someone else's changes in, the highlights are likely to break.
- The annotations will not export in org-mode. Highlights are presented as overlays, and are not part of the markup. There is some support to convert them to html using =ov-highlight-html= via the htmlize library.
Note: These will not be visible without installing ov-highlight. See [[http://htmlpreview.github.com/?https://github.com/jkitchin/ov-highlighter/blob/master/README.html][README.html]] to see what they look like. Not all the markups convert to html, but most of them do. The tooltips are not preserved either.
- green
- pink
- yellow
- my choice (LightSalmon2)
- dark red text
** Markup examples
bold, italic, underlined, struck, boxed
Big, little, Comic Sans font
Delete this text, replace it with this. You mispleled this. You can also add comments.
ov-highlight-data: KCgzMDg1IDMxMTAgKGZhY2UgKDpiYWNrZ3JvdW5kICJPcmFuZ2UxIikgbW91c2UtZmFjZSBoaWdobGlnaHQgbG9jYWwtbWFwIChrZXltYXAgKG1vdXNlLTEgbGFtYmRhIG5pbCAoaW50ZXJhY3RpdmUpIChzZXRxICpvdi13aW5kb3ctY29uZmlndXJhdGlvbiogKGN1cnJlbnQtd2luZG93LWNvbmZpZ3VyYXRpb24pKSAobGV0ICgoY2IgKGN1cnJlbnQtYnVmZmVyKSkgKGN1cnJlbnQtbm90ZSAob3ZlcmxheS1nZXQgKG92LWhpZ2hsaWdodC1nZXQtY29tbWVudC1vdikgKHF1b3RlIGhlbHAtZWNobykpKSkgKHN3aXRjaC10by1idWZmZXIgIipvdi1ub3RlKiIpIChlcmFzZS1idWZmZXIpIChvcmctbW9kZSkgKGluc2VydCAob3IgY3VycmVudC1ub3RlICIiKSkgKGxldCAoKG1hcCAobWFrZS1zcGFyc2Uta2V5bWFwKSkpIChzZXRxIGhlYWRlci1saW5lLWZvcm1hdCAiQ2xpY2sgaGVyZSBvciB0eXBlIHMtPHJldHVybj4gdG8gZmluaXNoLiBDLXggayB0byBjYW5jZWwuIikpIChsb2NhbC1zZXQta2V5IChrYmQgIkMteCBrIikgKFxgIChsYW1iZGEgbmlsIChpbnRlcmFjdGl2ZSkgKGtpbGwtYnVmZmVyKSkpKSAobG9jYWwtc2V0LWtleSAoa2JkICJzLTxyZXR1cm4+IikgKFxgIChsYW1iZGEgbmlsIChpbnRlcmFjdGl2ZSkgKGxldCAoKHRvb2x0aXAgKGJ1ZmZlci1zdWJzdHJpbmctbm8tcHJvcGVydGllcyAocG9pbnQtbWluKSAocG9pbnQtbWF4KSkpKSAoa2lsbC1idWZmZXIpIChzZXQtd2luZG93LWNvbmZpZ3VyYXRpb24gKm92LXdpbmRvdy1jb25maWd1cmF0aW9uKikgKHNldHEgKm92LXdpbmRvdy1jb25maWd1cm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