Page 1 of 1

Restricting Numbering to the first 2 levels of headings

Posted: Thu Sep 19, 2024 1:47 pm
by digital_nomad
Is there any way to set the numbering to appear only for level 1 and level 2 headings and not for other headings? What changes in css will be needed for this?
I need this for PDF transformation. Currently, the numbering is set to deep, which adds numbers for all topics in the map.

Re: Restricting Numbering to the first 2 levels of headings

Posted: Fri Sep 20, 2024 9:39 am
by julien_lacour
Hello,

I assume you are using DITA Map PDF - based on HTML5 & CSS transformation scenario, then you can use the following rules:

Code: Select all

/* Table of Contents */
*[class ~= "map/map"][numbering ^= 'deep'] *[class ~= "map/topicref"][is-chapter]:not([is-part]) > *[class ~= "map/topicref"] > *[class ~= "map/topicref"] > *[class ~= "map/topicmeta"]:before {
  content: none;
}
/* Content */
*[class ~= "map/map"][numbering ^= 'deep'] *[class ~= "topic/topic"][is-chapter]:not([is-part]) > *[class ~= "topic/topic"] *[class ~= "topic/topic"] > *[class ~= "topic/title"]:before {
  content: none;
}
As a side note, you can debug the CSS in your favorite browser to see all the rules applied on a given HTML element and create additional rules to modify these elements style.

Regards,
Julien