Re: (code, sample output and keyboard/device input <code>, <samp>, <kybd>) part of my review of 3.12 Phrase elements

[About syntax highlighting in <code>]

2007/7/20, Lachlan Hunt:
>
> However, it might be worth documenting how authors already solve this
> problem to provide syntax highlighting and it might be possible for the
> microformats community to address the issue.
>
> Some pages use javascript to add the highlighting.  For example:
>
> This uses <pre class="javascript">
> http://dean.edwards.name/weblog/2007/04/packer3/
>
> This uses <pre><code class="javascript">
> http://livepipe.net/projects/event_behavior/
>
> Maybe it would be possible to write a browser extension using similar
> scripts that could perform the syntax highlighting, particularly if the
> microformats community came up with hCode or something.  But, I really
> think more research and documentation of existing use cases and real
> world examples is needed before any good solution can be developed.

google-code-prettify [1] only needs class=prettyprint (on either <pre>
or <code>) and automatically detects the language for you.

You can of course use <pre class=prettyprint><code> or <pre><code
class=prettyprint>

(the latter seems to be better as the former has messed the <code>,
but I ran my tests changing the project's README.html live from within
Firebug and then calling prettyPrint() on Firebug's console).

[1] http://code.google.com/p/google-code-prettify/

-- 
Thomas Broyer

Received on Friday, 20 July 2007 13:59:09 UTC