How can I change a buffer view in emacs to hide HTML tags
Question
Like any conscientious emacs user I edit blog posts with it all the time using "It's All Text". However I'm often inserting HTML hrefs into my text and when I come to do my final proof read they tend to get in the way. Is there a mode I can toggle into that will hide these elements?
More generally are there any pointers on how to write a mode that modifies the actual buffer view while leaving the buffer contents untouched? Or does this just involve magic hacking with font-lock?
Solution
In html-mode
you can use M-x sgml-tags-invisible
to hide/show tags.
You can also C-c C-v
to run browse-url-of-buffer
, which opens the current buffer (if buffer-file-name
is not nil
, that is, if it's a regular file) with your default browser.
This works fine enough even with partial html blocks (i.e. without <html>
, <body>
etc.).
OTHER TIPS
Do you (1) directly write HTML when writing the blogpost or (2) do you use some form of wiki language for lists, tables, etc. For (1) you could have a look at org-mode and convert to HTML after proof read with org-export-region-as-html
. In the second case you could look out for some special wiki mode which might hide the links (like markdown-mode).