how to limit the toc depth to 2 (css-based PDF)
Posted: Tue Oct 24, 2023 11:06 am
Hi I'm modifying the css so that only level 1 and 2 topics are displayed in the TOC.
I took a reference from here:https://www.oxygenxml.com/doc/versions/ ... tents.html
and modify it like this:
/* Hide sections below level 2. */
*[class ~= "map/topicref"][is-chapter] >
*[class ~= "map/topicref"][is-chapter] >
*[class ~= "map/topicref"]:not([is-chapter]) >
*[class ~= "map/topicref"] >
*[class ~= "map/topicref"] {
display: none;
}
It doesn't work.
And I also tried with the following generic css rules:
.toc-entry.toc-h1,
.toc-entry.toc-h2
{
display: block;
}
.toc-entry.toc-h3,
.toc-entry.toc-h4,
.toc-entry.toc-h5,
.toc-entry.toc-h6
{
display: none;
}
They don't work either.
By the way, in the publishing template, I have the following parameter specified: <parameter name="args.css.param.numbering" value="shallow"/>. Being shallow means to have only level 1 topic titles included in the TOC, but changing to "deep" doesn't make sense either, as it will include all nested topic titles in the TOC.
Any hint? Thanks!
I took a reference from here:https://www.oxygenxml.com/doc/versions/ ... tents.html
and modify it like this:
/* Hide sections below level 2. */
*[class ~= "map/topicref"][is-chapter] >
*[class ~= "map/topicref"][is-chapter] >
*[class ~= "map/topicref"]:not([is-chapter]) >
*[class ~= "map/topicref"] >
*[class ~= "map/topicref"] {
display: none;
}
It doesn't work.
And I also tried with the following generic css rules:
.toc-entry.toc-h1,
.toc-entry.toc-h2
{
display: block;
}
.toc-entry.toc-h3,
.toc-entry.toc-h4,
.toc-entry.toc-h5,
.toc-entry.toc-h6
{
display: none;
}
They don't work either.
By the way, in the publishing template, I have the following parameter specified: <parameter name="args.css.param.numbering" value="shallow"/>. Being shallow means to have only level 1 topic titles included in the TOC, but changing to "deep" doesn't make sense either, as it will include all nested topic titles in the TOC.
Any hint? Thanks!