Skip to content

Commit

Permalink
fix: Explicitly set titles will override the no title setting in call…
Browse files Browse the repository at this point in the history
…outs (close #284)
  • Loading branch information
valentine195 committed Sep 14, 2023
1 parent 3efb093 commit 22f32d4
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions src/callout/manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ export default class CalloutManager extends Component {
if (
content &&
(this.plugin.admonitions[type].copy ??
this.plugin.data.copyButton)
this.plugin.data.copyButton)
) {
let copy = content.createDiv("admonition-content-copy");
setIcon(copy, "copy");
Expand All @@ -95,7 +95,14 @@ export default class CalloutManager extends Component {
}

if (admonition.noTitle && !callout.dataset.calloutFold) {
titleEl.addClass("no-title");
if (
titleEl
.querySelector(".callout-title-inner")
?.textContent?.toLowerCase() ===
admonition.type.toLowerCase()
) {
titleEl.addClass("no-title");
}
}
if (
!admonition.noTitle &&
Expand Down Expand Up @@ -217,7 +224,9 @@ export default class CalloutManager extends Component {
--callout-icon: "${(
this.plugin.iconManager.getIconNode(admonition.icon)?.outerHTML ??
""
).replace(/(width|height)=(\\?"|')\d+(\\?"|')/g, "").replace(/"/g, '\\"')}";
)
.replace(/(width|height)=(\\?"|')\d+(\\?"|')/g, "")
.replace(/"/g, '\\"')}";
}`;
}
if (this.indexing.contains(admonition.type)) {
Expand Down

0 comments on commit 22f32d4

Please sign in to comment.