[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[O] Case sensitivity of special block names in HTML export / class names

From: Nik Clayton
Subject: [O] Case sensitivity of special block names in HTML export / class names
Date: Mon, 29 Jul 2019 14:52:37 +0200


Org special block names (within Org) appear to be case-insensitive. That is, I can write either:




and Org is happy. I think the switch from Org 8 to 9 changed the default templates to insert lower-case blocks instead of upper case blocks, so it's natural now to have files that contain a mix of both cases.

This is a problem for HTML export, as they get converted to:

<div class="NOTES">...</div>


<div class="notes">...</div>

depending on the original case of the special block in the .org file. HTML class element values are case sensitive in non-quirks mode browsers, so this makes existing CSS for content exported by Org fail, as

div.NOTES { ... }

does not match a <div class="notes">.

A quick local fix is:

(defun my/downcase-special-block (ohsb special-block contents info)
  (let ((special-block-copy (org-element-copy special-block)))
     (downcase (org-element-property :type special-block)))
    (funcall ohsb special-block-copy contents info)))

(advice-add #'org-html-special-block :around

But I wanted to raise this in case there was any interest in a more general solution (perhaps a configuration option to either (a) retain case (current behaviour), (b) convert to lower case, (c) convert to upper case?


reply via email to

[Prev in Thread] Current Thread [Next in Thread]