Function: html-ts-mode
html-ts-mode is an autoloaded, interactive and byte-compiled function
defined in html-ts-mode.el.gz.
Signature
(html-ts-mode)
Documentation
Major mode for editing Html, powered by tree-sitter.
In addition to any hooks its parent mode html-mode might have run,
this mode runs the hook html-ts-mode-hook, as the final or penultimate
step during initialization.
Probably introduced at or before Emacs version 30.1.
Key Bindings
Source Code
;; Defined in /usr/src/emacs/lisp/textmodes/html-ts-mode.el.gz
;;;###autoload
(define-derived-mode html-ts-mode html-mode "HTML"
"Major mode for editing Html, powered by tree-sitter."
:group 'html
(unless (treesit-ensure-installed 'html)
(error "Tree-sitter for HTML isn't available"))
(setq treesit-primary-parser (treesit-parser-create 'html))
;; Indent.
(setq-local treesit-simple-indent-rules html-ts-mode--indent-rules)
;; Navigation.
(setq-local treesit-defun-type-regexp html-ts-mode--treesit-defun-type-regexp)
(setq-local treesit-defun-name-function #'html-ts-mode--defun-name)
(setq-local treesit-thing-settings html-ts-mode--treesit-things-settings)
;; Font-lock.
(setq-local treesit-font-lock-settings html-ts-mode--font-lock-settings)
(setq-local treesit-font-lock-feature-list html-ts-mode--treesit-font-lock-feature-list)
;; Imenu.
(setq-local treesit-simple-imenu-settings html-ts-mode--treesit-simple-imenu-settings)
;; Outline minor mode.
(setq-local treesit-outline-predicate #'html-ts-mode--outline-predicate)
;; `html-ts-mode' inherits from `html-mode' that sets
;; regexp-based outline variables. So need to restore
;; the default values of outline variables to be able
;; to use `treesit-outline-predicate' above.
(kill-local-variable 'outline-regexp)
(kill-local-variable 'outline-heading-end-regexp)
(kill-local-variable 'outline-level)
(treesit-major-mode-setup))