Skip to content

Instantly share code, notes, and snippets.

@trashhalo
Last active November 21, 2021 20:02
Show Gist options
  • Save trashhalo/0c3ea1ce98f5bc15d68e19520b9c35bb to your computer and use it in GitHub Desktop.
Save trashhalo/0c3ea1ce98f5bc15d68e19520b9c35bb to your computer and use it in GitHub Desktop.
Obsidian CSS Check

Obsidian CSS Check

After noticing a css error in the most popular theme (minimal), I decided to download every theme and see how widespread css errors are. Shell script using curl, jq to download them all. Stylelint with all rules turned off to just check for syntax errors.

Findings

  • 21 themes in the official theme list have syntax errors.
  • Most common type of error is theme makers thinking css supports // foo shape comments. CSS only supports /* foo */ shaped comments. These all show up as unknown word in the syntax-check.txt report.
    • A couple of these were introduced when someone tried to "comment out" a rule. // color: red;
  • Handful of extra or missing } ;. I tried to file pull requests for the obvious ones.

Suggestions

It might be helpful to set up a "starter theme" repo that already has css linting built into it. You could use github actions or git hooks to enable this.

# Downloads every theme from the obsidian community
# requires curl and jq
curl https://raw.githubusercontent.com/obsidianmd/obsidian-releases/master/community-css-themes.json |jq '.[].repo'|xargs -I {} sh -c 'mkdir -p {} && curl -O https://raw.githubusercontent.com/{}/master/obsidian.css && mv obsidian.css {}'
http://github.com/ArtexJay/Obsidian-CyberGlow
444:6 ✖ Unknown word CssSyntaxError
http://github.com/Chrismettal/Obsidian-Behave-dark
651:43 ✖ Unknown word CssSyntaxError
http://github.com/MatheusZarkov/Obsidian-Slytherin
1444:19 ✖ Missed semicolon CssSyntaxError
http://github.com/bcdavasconcelos/Obsidian-Ayu
1863:15 ✖ Unknown word CssSyntaxError
http://github.com/bcdavasconcelos/Obsidian-Ayu_Mirage
1879:15 ✖ Unknown word CssSyntaxError
http://github.com/bcdavasconcelos/Obsidian-Charcoal
1879:15 ✖ Unknown word CssSyntaxError
http://github.com/bcdavasconcelos/Obsidian-GDCT
1861:15 ✖ Unknown word CssSyntaxError
http://github.com/bcdavasconcelos/Obsidian-GDCT_Dark
1873:15 ✖ Unknown word CssSyntaxError
http://github.com/bcdavasconcelos/Obsidian-Graphite
1878:15 ✖ Unknown word CssSyntaxError
http://github.com/bcdavasconcelos/Obsidian-Panic_Mode
1901:15 ✖ Unknown word CssSyntaxError
http://github.com/cannibalox/ono-sendai_obsdn
122:1 ✖ Unexpected } CssSyntaxError
http://github.com/crashmoney/obsidian-typewriter
1941:1 ✖ Unexpected } CssSyntaxError
http://github.com/dogwaddle/lizardmen-zettelkasten
494:18 ✖ Unknown word CssSyntaxError
http://github.com/dogwaddle/obsidian-gastown-theme.md
515:1 ✖ Unknown word CssSyntaxError
http://github.com/dxcore35/Suddha-theme
1035:24 ✖ Unknown word CssSyntaxError
http://github.com/elliotboyd/obsidian-traffic-lights
883:36 ✖ Unknown word CssSyntaxError
http://github.com/gracejoseph1236/obsidian-ruby
661:5 ✖ Unexpected } CssSyntaxError
http://github.com/jdanielmourao/obsidian-sanctum
4527:5 ✖ Unknown word CssSyntaxError
http://github.com/pgalliford/Obsidian-theme-Incredible-Hulk
40:5 ✖ Unknown word CssSyntaxError
http://github.com/sergey900553/obsidian_githublike_theme
57:3 ✖ Unknown word CssSyntaxError
http://github.com/sparklau/comfort-smooth
947:17 ✖ Unclosed string CssSyntaxError
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment