Skip to content

Commit

Permalink
fix: Fixes CSS escaping for custom callouts in Obsidian installer 1.4+
Browse files Browse the repository at this point in the history
  • Loading branch information
valentine195 committed Sep 14, 2023
1 parent 7686434 commit 523ca6a
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/callout/manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -206,15 +206,17 @@ export default class CalloutManager extends Component {
if (admonition.icon.type == "obsidian") {
rule = `.callout[data-callout="${admonition.type.toLowerCase()}"] {
${color}
--callout-icon: ${admonition.icon.name}; /* Icon name from the Obsidian Icon Set */
--callout-icon: ${
admonition.icon.name
}; /* Icon name from the Obsidian Icon Set */
}`;
} else {
rule = `.callout[data-callout="${admonition.type.toLowerCase()}"] {
${color}
--callout-icon: '${(
--callout-icon: "${(
this.plugin.iconManager.getIconNode(admonition.icon)?.outerHTML ??
""
).replace(/(width|height)=(\\?"|')\d+(\\?"|')/g, "")}';
).replace(/(width|height)=(\\?"|')\d+(\\?"|')/g, "").replace(/"/g, '\\"')}";
}`;
}
if (this.indexing.contains(admonition.type)) {
Expand Down

0 comments on commit 523ca6a

Please sign in to comment.