Add support for nested <code> tag in <pre> elements
The style for .code uses white-space: nowrap; which causes all line breaks in e.g., preformated code blocks to be ignored. It seems almost any other value than nowrap would have made sense. This makes this style unusable for code blocks.
In below example the code block is displayed on a single line.
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<link rel="stylesheet" href="dist/canvas.css" type="text/css" />
</head>
<body>
<pre><code>#include <cstdio>
int main() {
printf("Hello, world!\n");
}</code></pre>
</body>
</html>
@bbannier valid. However, in CNVS the expectation is code blocks (not inline code fragments) live inside a <pre>...</pre> element only -- not <pre><code>...</code></pre>.
You can see this in practice here -- http://mesosphere.github.io/cnvs/content/code/
If you have an argument for why you feel it should be <pre><code>...</code></pre>, throw it out there for consideration/discussion. For example, on Github, they follow the <pre><code>...</code></pre> structure, but elsewhere on the web, you'll find just <pre>...</pre> (e.g. http://mediatemple.net/blog/tips/randomizing-svg-shapes/).
@jfurrow @orlandohohmeier opinions?
@ashenden I arrived at above output via pandoc's HTML writer, so it certainly isn't just github using this pattern. Stackoverflow uses the same pattern, https://stackoverflow.com/questions/1642028/what-is-the-operator-in-c.
I cannot make a strong argument for HTML best practices myself, but it seems a style wrapping at all anything in<pre>s would break that tag's intent, https://www.w3.org/TR/html5/grouping-content.html#the-pre-element (see also https://www.w3.org/TR/2011/WD-html5-author-20110809/the-code-element.html which again seems to suggest that wrapping code blocks in <pre><code> is not that weird).
Sounds good. We'll work in support for both <pre></pre> and <pre><code></code></pre>.
Sorry for the delay, but after reviewing the provided resources, I agree with the consensus here. I think using the white-space: nowrap property assumes too much about the usage of code tags.