fxbois / web-mode

web template editing mode for emacs
https://web-mode.org
GNU General Public License v3.0
1.63k stars 262 forks source link

what's web-mode-content-type ? #1166

Closed snowman closed 3 years ago

snowman commented 3 years ago

What's the difference between web-mode-engine, the documentation is unclear.

What features does it provide when i open file /tmp/a.api if i set below:

(add-to-list 'auto-mode-alist '("\\.api\\'" . web-mode))

(setq web-mode-content-types-alist
  '(("json" . "/tmp/.*\\.api\\'")))
snowman commented 3 years ago

seems like web-mode-engine is deal with html/xml(Markup Language syntax like) but enhanced with template syntax like php/blade, and web-mode-content-types is used for something other than html.

web-mode-engines is a variable defined in ‘web-mode.el’.
Its value is shown below.

Documentation:
Engine name aliases

Value:
(("angular" "angularjs")
 ("archibus")
 ("artanis")
 ("asp")
 ("aspx")
 ("blade" "laravel")
 ("cl-emb")
 ("clip")
 ("closure" "soy")
 ("ctemplate" "mustache" "handlebars" "hapax" "ngtemplate" "ember" "kite" "meteor" "blaze" "ractive" "velvet")
 ("django" "dtl" "twig" "swig" "jinja" "jinja2" "erlydtl" "liquid" "clabango" "selmer" "nunjucks")
 ("dust" "dustjs")
 ("ejs")
 ("elixir" "phoenix")
 ("erb" "eruby" "erubis")
 ("expressionengine" "ee")
 ("freemarker")
 ("go" "gtl" "hugo")
 ("hero")
 ("json-t")
 ("jsp" "grails")
 ("mako")
 ("marko")
 ("mason" "poet")
 ("lsp" "lisp")
 ("mojolicious")
 ("php")
 ("python")
 ("razor" "play" "play2")
 ("riot")
 ("smarty")
 ("spip")
 ("svelte" "svelte")
 ("template-toolkit")
 ("thymeleaf")
 ("underscore" "underscore.js")
 ("velocity" "vtl" "cheetah" "ssp")
 ("vue" "vuejs" "vue.js")
 ("web2py")
 ("xoops"))

[back]
web-mode-engines-alist is a variable defined in ‘web-mode.el’.
Its value is nil

Documentation:
A list of filename patterns and corresponding web-mode engine. For example,
(setq web-mode-engines-alist
      ’(("php"    . "\\.phtml\\’")
        ("blade"  . "\\.blade\\.")))

[back]
web-mode-content-types is a variable defined in ‘web-mode.el’.
Its value is
(("css" . "\\.\\(s?css\\|css\\.erb\\)\\'")
 ("javascript" . "\\.\\(js\\|js\\.erb\\)\\'")
 ("typescript" . "\\.\\(ts\\|ts\\.erb\\)\\'")
 ("json" . "\\.\\(api\\|json\\|jsonld\\)\\'")
 ("jsx" . "\\.[jt]sx\\'")
 ("xml" . "\\.xml\\'")
 ("html" . "."))

Documentation:
content types

[back]