Shouldn't collapsible admonitions also contain admonition
class name like their classic counterparts ?
#7999
-
I was wondering why my JavaScript script that opens all collapsible admonitions on a page when the user asks for it didn't work. Then I realized that collapsible admonitions do not have the Here is the HTML generated for each type of admonitions: Classic admonition: <div class="admonition note">
<p class="admonition-title">Note</p>
<p>Lorem ipsum...</p>
</div> Collapsible admonition: <details class="note">
<summary>Note</summary>
<p>Lorem ipsum...</p>
</details> I understand that collapsible admonitions use the |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Hi @Thiti517,
Which generate output separately. Also looking at other SSGs like Docosaurus, there is also a clear separation between admonitions and details, as details is an HTML tag. MkDocs and with it Material for MkDocs uses these dependencies, and has to work with the given output. Hence, the theme defines two selectors for the CSS: .md-typeset .note > .admonition-title, .md-typeset .note > summary {
background-color: #448aff1a;
} and the same should be done with JavaScript. though for opening the details with a class you can select If you really need the addition of the |
Beta Was this translation helpful? Give feedback.
Hi @Thiti517,
admonitions and details, are generated by separate Markdown Extensions:
Which generate output separately. Also looking at other SSGs like Docosaurus, there is also a clear separation between admonitions and details, as details is an HTML tag.
MkDocs and with it Material for MkDocs uses these dependencies, and has to work with the given output. Hence, the theme defines two selectors for the CSS:
and the same should be done with JavaScript. though fo…