commit 8566a933a3acda2e6beecebbc8f6e558993bf354 (patch)
parent 1acb0d8394e38bd030f358481228e416567e7531
Author: Alex Karle <alex@alexkarle.com>
Date: Tue, 21 Dec 2021 00:05:59 -0500
Change block-code to put <code> inside <pre>
According to the MDN, this is how it was meant to be! [1]
[1]: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/code
Diffstat:
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/blag.c b/blag.c
@@ -92,7 +92,7 @@ void handle_lf(state *s) {
if (s->lastc == '\n') {
switch (s->in) {
case PARAGRAPH: printf("</p>\n"); break;
- case CODE: printf("</pre></code>\n"); break;
+ case CODE: printf("</code></pre>\n"); break;
case QUOTE: printf("</blockquote>\n"); break;
case LIST:
s->previndent = 0;
@@ -239,7 +239,7 @@ int parse() {
case '>':
if (s.in == NONE) {
s.in = c == '>' ? QUOTE : CODE;
- printf("%s\n", c == '>' ? "<blockquote>" : "<code><pre>");
+ printf("%s\n", c == '>' ? "<blockquote>" : "<pre><code>");
} else if (s.lastc == '\n' && c == (s.in == CODE ? '\t' : '>')) {
/* no op */
} else {
diff --git a/test/big.html b/test/big.html
@@ -58,11 +58,11 @@ my <a href="gopher://alexkarle.com">gopherhole</a>.
this is a block quote
that wraps!
</blockquote>
-<code><pre>
+<pre><code>
$ this is a code block
$ *bold* and _italics_ and `code` have no effect!
$ git status
-</pre></code>
+</code></pre>
<p>
<html> is escaped!
</p>