ddoc patterns

Aleksandar Ružičić ruzicic.aleksandar at gmail.com
Fri Apr 8 13:47:32 PDT 2011


On Fri, Apr 8, 2011 at 8:52 PM, spir <denis.spir at gmail.com> wrote:
> Right, but IIUC unlike <pre> there is no guarantee for <code> contents not
> to be interpreted further. It's a "semantic hint" to the rendering engine
> (which is often used to perform syntax highlighting).

AFAIK no major browser (A-grade browser) does nothing more with <code>
than making it have monospaced font (i.e. look at default styles for
all elements in webkit:
http://trac.webkit.org/browser/trunk/Source/WebCore/css/html.css,
you'll see <code> only has it's font-family defined, while <pre> has
few others more, most notably white-space: pre; and display: block).
And no browser supports rendering syntax highlighting (as I know of)
for any computer language (there are user scripts and maybe extensions
which does that but in no way is that default behavior).

It's true, <code> does have semantic hint, and that's "hey anything
between <code> and </code> is a computer code!", which is I believe
exact what you want - to display some code inline..


More information about the Digitalmars-d-learn mailing list