Restricting Numbering to the first 2 levels of headings

Post here questions and problems related to editing and publishing DITA content.
digital_nomad
Posts: 5
Joined: Thu Jul 28, 2022 9:03 am

Restricting Numbering to the first 2 levels of headings

Post 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.
julien_lacour
Posts: 566
Joined: Wed Oct 16, 2019 3:47 pm

Re: Restricting Numbering to the first 2 levels of headings

Post 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
Post Reply