I am using CSS to adjust the numbering of a nested list in HTML exported from Org. However, I've run into a problem when I use a link back to an item in the enumerated list.

As an example, the org file is:

1. item 1
   1. <<target>> subitem 1a
   2. subitem 1b
2. item 2
   1. subitem 2a refers to some text above [[target]]. Targets are a built-in feature of org
   2. subitem 2b

This produces the desired HTML output in terms of the numbering of the nested list: 1, 1a, 1b, 2, 2a, 2b when I include the following CSS (as described here):

#+HTML_HEAD: <style type="text/css">
#+HTML_HEAD:  ol ol { list-style-type: lower-alpha; }
#+HTML_HEAD: </style>

The problem is that [[target]] is replaced with 1.1 in HTML. I want the reference to reflect the CSS-dictated 1a label.

Any thoughts on how to fix that?

Reference: the use of <<>> [[]] is described in the org manual under Internal Links.

  • Looks like a bug to me: the HMTL export does not treat the sublists as sublists at all. I'd suggest you submit a bug report with org-submit-bug-report. – NickD Sep 9 '20 at 16:28
  • It looks as if alphabetic lists are not properly exported to HTML (and no, org-list-allow-alphabetical does not change that). If you change the alphabetic numbering to numeric, it all works as it should. – NickD Sep 9 '20 at 17:33
  • @NickD I edited my post after reading your comments. I want to clarify that the nested numbering (1, 1a, 1b, 2, 2a, 2b) is coming out fine in HTML. The problem lies in displaying the reference label (1b) when referring to the <<target>>. – Raj Sep 10 '20 at 11:13
  • How is Org mode supposed to know what you do in your CSS? It produces HTML depending on the structure of the Org mode document (not always as I pointed out above, but that's a bug). How you are going to change the appearance of the document with CSS when you display the HTML document cannot possibly be taken into account by the HTML exporter (it's not an HTML/CSS exporter and besides you can change the CSS later). – NickD Sep 10 '20 at 20:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.