> Timothy, may you take a look?

Sure, sorry for the delay. I'm not quite sure whether we should have `<code>` 
within `<pre>` unfortunately. On one hand, it doesn't break from the the whatwg 
intended use case, but the examples do seem to emphasise inline usage and if we 
check https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/code 
we see the element described as "the inline code element". That said, the MDN 
docs do also say "To represent multiple lines of code, wrap the <code> element 
within a <pre> element.".

So, I think this is probably slightly unusual in practice, but also fine to do. 
Consistency with the klipsify version seems worth it, regardless of which way 
we go.

All the best,
Timothy.

On Wed, Mar 12, 2025, at 1:51 AM, Ihor Radchenko wrote:
> Nikolaos Chatzikonstantinou <nchatz...@gmail.com> writes:
>
>> Shouldn't the source blocks be using the <code> element?
>>
>> This patch is untested, I can pay more attention to it if first the
>> maintainer(s) agree with my opinion. I thought the <code> tag is good
>> for semantics.
>
> Timothy, may you take a look?
>
> For me, the patch looks reasonable, especially since <code> is used with
> `org-html-klipsify-src'. Although, I'd be careful moving class property
> into code - it might potentially block CSS selectors.
>
>> From 61ff4297044beb9d62673557d311475c897f057c Mon Sep 17 00:00:00 2001
>> From: Nikolaos Chatzikonstantinou <nchatz...@gmail.com>
>> Date: Wed, 26 Feb 2025 03:51:36 -0500
>> Subject: [PATCH] Add code element inside src-block in ox-html
>>
>> * lisp/org/ox-html.el (org-html-src-block): Add HTML code element inside
>> pre element for Org source blocks exported to HTML.
>> ---
>>  lisp/org/ox-html.el | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/lisp/org/ox-html.el b/lisp/org/ox-html.el
>> index e8ae3a134cb..6f5ce9269ff 100644
>> --- a/lisp/org/ox-html.el
>> +++ b/lisp/org/ox-html.el
>> @@ -3697,7 +3697,7 @@ org-html-src-block
>>                            " data-editor-type=\"html\""
>>                          "")
>>                        code)
>> -            (format "<pre class=\"src src-%s\"%s>%s</pre>"
>> +            (format "<pre class=\"src src-%s\"%s><code>%s</code></pre>"
>>                          ;; Lang being nil is OK.
>>                          lang label code))))))
>
> -- 
> Ihor Radchenko // yantar92,
> Org mode maintainer,
> Learn more about Org mode at <https://orgmode.org/>.
> Support Org development at <https://liberapay.com/org-mode>,
> or support my work at <https://liberapay.com/yantar92>

Reply via email to