[html5] syntax for server-side processing instructions

Ian Hickson ian at hixie.ch
Wed Mar 17 16:52:51 PDT 2010

On Tue, 16 Feb 2010, Leonardo Boiko wrote:
> Sorry if this was already discussed; I get confused easily.  I’d like
> to author HTML5 in a parsing text editor.  I’d also like to insert
> custom server-side non-HTML instructions – like PHP, ERB &c. – without
> confusing the parser; ideally, keeping the whole thing a valid,
> conformant HTML5 document (so that my hypothetical validating text
> editor can point only actual mistakes).  What’s the preferred approach
> for that?
> Myself, I’d favor XML-style processing instructions.  Say I have a
> blog engine called My Stupid Blog.  Then I could do something like
> PHP:
>     <?msb include('header.html') ?>
> However, from a quick search, it appears that HTML5 does not allow PIs
> (at least in HTML syntax, and I’d like to use HTML syntax).
> Would it be considered bad form if I just used comments?
>     <!--msb include('header.html') -->
> Or is there some magical elegant idiom I am missing?

If it's just on for your own use, and isn't going to be sent over the 
wire, you can basically use whatever convention you like. At that point 
it's not really "HTML", it's your own personal variant of HTML, with your 
own rules, which later gets turned into "proper" HTML for use by others.

Ian Hickson               U+1047E                )\._.,--....,'``.    fL
http://ln.hixie.ch/       U+263A                /,   _.. \   _\  ;`._ ,.
Things that are impossible just take longer.   `._.-(,_..'--(,_..'`-.;.'

More information about the Help mailing list