Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Authoring HTML5 in Emacs?

Tags:

html

emacs

What's the best solution for authoring HTML5 in Emacs? Is there a mode that will do conformance checking?

like image 661
Ryan Avatar asked Jul 04 '09 15:07

Ryan


3 Answers

My best suggestion is to use nxml-mode (available as packages in several linux distributions if you're on that platform) and load the html5 RelaxNG compact format specifications from HTML5 specification page (or any other source if you have one).

Nxml-mode validates xml files on the fly according to relaxNG specifications and give you nice customization features and handy functions for writing documents faster like inserting end-tags and such. Written by James Clark, so you know the author knows his XML.

If you load it like a system package you can probably just add it to your auto-mode-alist and be good to go. I have just set the following two variables for auto-completion and more docs is available at the first link.

(nxml-bind-meta-tab-to-complete-flag t)
(nxml-slash-auto-complete-flag t)

When it is loaded, just load the file you want and specify the location of the schema for html5, save its location through the menu and you should be on your way. There are also more links to documentation on nxml-mode in the link I provided.

like image 122
Knut Haugen Avatar answered Nov 17 '22 17:11

Knut Haugen


I've just seen this project, which apparently takes care of the necessary work to teach nxml-mode about HTML5:

http://github.com/hober/html5-el/tree/master

like image 20
npad Avatar answered Nov 17 '22 18:11

npad


An easier to install solution may be web-mode. It definitely plays well with HTML5 and doesn't require you to jump through the XHTML hoops.

JavaScript and CSS blocks work as you would hope.

It also includes the ability to handle common templating languages like php, erb, handlebars, etc.

Check out http://web-mode.org for more details. It's available as a package, at least on MELPA.

like image 7
mcginniwa Avatar answered Nov 17 '22 18:11

mcginniwa