Emacs: Xah HTML Mode

By Xah Lee. Date: . Last updated: .
emacs xah-html-mode intro, xah talk show 2019-08-29

xah-html-mode is a emacs major mode for HTML.

[see HTML Tutorial]




Manual Install

Put the file xah-html-mode.el in ~/.emacs.d/lisp/

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?


• 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 decided smartly on word/line/block. When current selection or position is empty, it'll place your cursor in between the inserted tag.

• Convert lines to list. xah-html-lines-to-html-list

• Convert text to table or reverse. xah-html-make-html-table xah-html-make-html-table-undo.

• Command to html syntax color computer language source code. xah-html-toggle-syntax-coloring-markup

• Command to edit source code in a separate buffer. xah-html-get-precode-make-new-file Similar to org babel feature.

• Remove HTML tags: xah-html-html-to-text, xah-html-remove-html-tags, xah-html-remove-span-tag-region

• Extract URL in a text selection. xah-html-extract-url.

• Htmlize keyboard shortcuts notation xah-html-htmlize-keyboard-shortcut-notation

• Replace region text to HTML entities or Unicode equivalent. xah-html-replace-html-named-entities [see HTML Entity List]

• Change inline image tag and image file name. xah-html-rename-html-inline-image


here's major features am working on

• Add HTML validation feature. Possibly on-the-fly.

• Make it a complete HTML syntax aware editor. So that it's impossible to create invalid HTML.

• Possibly adding JavaScript and PHP keywords, to make it a general mode for web dev.

HTML Topic

  1. Emacs HTML Tips
  2. Insert HTML Tag
  3. URL to Link Command
  4. Lines to HTML Table
  5. Replace HTML Entities
  6. CSS Compressor
  7. Color CSS Color Values
  8. View Image Thumbnails
  9. HTML Image Path to Img Tag
  10. Convert Image Files in Dired
  11. Xah HTML Mode

If you have a question, put $5 at patreon and message me.
Or Buy Xah Emacs Tutorial
Or buy a nice keyboard: Best Keyboards for Emacs


Emacs Lisp