Steps to reproduce
- Open a vault and open a document
- Use the default theme (or most other themes as this bug effects all but two themes as far as I could find)
- Enter the following content;
$$
\frac{1}{9}
$$
or any other latex math.
5. Ensure you are in edit mode (reading/preview will hide the underlying syntax)
4. Ctrl+Shift+I
> select element > any of the latex symbols
5. Scroll down the CSS rules until you see the following (source app.css:5707);
cm-s-obsidian .cm-inline-code, .cm-s-obsidian .cm-math {
color: var(--code-normal);
}
- Disable the checkbox next to
color
- Observe syntax highlighting suddenly be implemented
Expected result
This should be default behavior, it should not be hidden behind disabling a core CSS rule.
Actual result
The CSS rule mentioned acts as a permanent disable for latex syntax highlighting.
Environment
- Operating system: Linux (PopOS, Ubuntu)
- Debug info:
SYSTEM INFO:
Obsidian version: v1.1.9
Installer version: v1.1.9
Operating system: #202212290932~1673966427~22.04~e15d5b5 SMP PREEMPT_DYNAMIC Tue J 6.0.12-76060006-generic
Login status: not logged in
Insider build toggle: off
Live preview: on
Legacy editor: off
Base theme: dark
Community theme: none
Snippets enabled: 0
Restricted mode: off
Plugins installed: 2
Plugins enabled: 2
1: Style Settings v0.4.12
2: Sortable v0.3.0
RECOMMENDATIONS:
Community plugins: for bugs, please first try updating all your plugins to latest. If still not fixed, please try to make the issue happen in the Sandbox Vault or disable community plugins.
Additional information
The selector in question is the latter, .cm-s-obsidian .cm-math
. The issue is a selector specificity issue, as the syntax highlighting is applied directly via selectors like .cm-tag
which has 0,1,0
specificity, whereas this rule has 0,2,0
specificity.
This issue can be fixed with the following diff;
// app.css:5707
-cm-s-obsidian .cm-inline-code, .cm-s-obsidian .cm-math {
+cm-s-obsidian .cm-inline-code, .cm-math {
color: var(--code-normal);
}