Emacs: Xah HTML Mode
xah-html-mode is a emacs major mode for HTML.
Put the file
Put the following in your emacs init:
(add-to-list 'load-path "~/.emacs.d/lisp/") (require 'xah-html-mode)
How's it different from default HTML mode?
- xah-html-mode has keyword based coloring. If a word is not colored, it is not a valid HTML5 or CSS word. (This way, it's easy to spot typos.)
- xah-html-mode tag completion is much convenient to use, and contains all HTML5 keywords. Emacs default html mode is from around 1990s.
- xah-html-mode has large number of commands for working with HTML.
- xah-html-mode particularly features working with programing language source code. Easily embed source code, html syntax color it, or extract and edit the code in a buffer, similar to org mode's babel features. [see Emacs: Org Mode, Work with Source Code]
- Syntax coloring based on exact keywords. If it's not colored, it's not a valid tag.
- Press Tab to insert html tag. They wrap a tag around text selection. If there's no selection, then work on current word or line or text block, depending on the tag. If current selection or position is empty, it'll place your cursor in between the inserted tag.
- Convert text blocks to paragraphs.
- Convert lines to list.
- Convert lines to definition list.
- Convert lines to table.
- Convert image path to image.
- Html syntax color computer language source code.
- edit source code in a separate buffer. Similar to org babel feature.
- Remove HTML tags.
- convert HTML to text.
- Extract URL in a text selection.
- Replace HTML entities to unicode characters or reverse..
- Percent encode/decode URL.
- Change inline image file name directly in HTML.
See also HTML Tutorial
- Insert HTML Tag
- Add Paragraph Tags
- Lines/Blocks to List
- Lines to Table
- Select Current Element
- Delete Tags
- URL to Link
- URL to Link, with Date
- Link to Dead Link
- URL Percent Decode/Encode
- Image Path to Link
- Embed YouTube Video
- Word to Wikipedia Link
- Wikipedia URL to Link
- Citation to Link
- Amazon URL to Link
- Google Map URL to Link 🌐
- Chinese Char to Ref Link
- Extract URL