Fossil Forum

<pre> and <code> aren't mutually redundant

<pre> and <code> aren't mutually redundant

<pre> and <code> aren't mutually redundant

(1) By Warren Young (wyoung) on 2022-09-15 11:28:09 [source]

I just saw this checkin and had to react. The <pre><code></code></pre> pattern is perfectly cromulent, not redundant at all. Indeed, some tools (e.g. Prism.js) rely on it to identify blocks to work on.

At the most basic level, <pre> is a block-level element that specifies presentation, while <code> is an inline element making a semantic declaration. Unless you're mixing content with presentation, you need both.

(2.3) By george on 2022-09-15 15:24:45 edited from 2.2 in reply to 1 [link] [source]

Thank you for looking into that.
While I agree with you in general, I still think that the check-in concerned is legitimate.

It should resolve an issue in /wdiff appearance (visible under default skin). The second <pre> should actually be </pre>. But even if it were </pre> there would still be an annoying padding with a border below the table.udiff (this table holds and marks-up the actual unified diff).

As far as I understand, enclosing diffs with <pre>...</pre> is not necessary after 1347a1ddb9a5. Diffs on the /info pages do not have such enclosure and look fine.