Skip to content

Commit

Permalink
style: format with biome
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisgrieser committed Sep 13, 2024
1 parent 8d56342 commit a726a06
Show file tree
Hide file tree
Showing 28 changed files with 225 additions and 401 deletions.
25 changes: 17 additions & 8 deletions Justfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
set quiet := true

personal_settings := "true"

#───────────────────────────────────────────────────────────────────────────────

# INFO uses personal vaults saved in `~/.config/perma-repos.csv`
build_and_push_to_local_vaults:
#!/usr/bin/env zsh
Expand All @@ -11,12 +15,17 @@ build_and_push_to_local_vaults:
> /tmp/theme.css
# PUSH TO LOCAL VAULTS
cut -d, -f2 "$HOME/.config/perma-repos.csv" |
sed "s|^~|$HOME|" |
xargs -I {} find {} -maxdepth 1 -name ".obsidian" | # only vaults
xargs dirname | # vault root
xargs -I {} cp -f "/tmp/theme.css" "{}/.obsidian/themes/Shimmering Focus/theme.css"
rm -f /tmp/theme.css
if [[ "{{ personal_settings }}" == "true" ]]; then
cut -d, -f2 "$HOME/.config/perma-repos.csv" |
sed "s|^~|$HOME|" |
xargs -I {} find {} -maxdepth 1 -name ".obsidian" | # only vaults
xargs dirname | # vault root
xargs -I {} cp -f "/tmp/theme.css" "{}/.obsidian/themes/Shimmering Focus/theme.css"
rm -f /tmp/theme.css
open -a "Obsidian" # macOS specific opener
fi

# OPEN OBSIDIAN
open -a "Obsidian" # macOS specific opener
format_and_check:
#!/usr/bin/env zsh
[[ "{{ personal_settings }}" != "true" ]] && return 0
$HOME/.local/share/nvim/mason/bin/biome check --write --error-on-warnings --log-kind="compact"
19 changes: 18 additions & 1 deletion biome.jsonc
Original file line number Diff line number Diff line change
@@ -1 +1,18 @@
{}
{
"formatter": {
"useEditorconfig": true,
"lineWidth": 100, // FIX value from editorconfig not correctly applied
"formatWithErrors": true
},

"files": {
"ignore": ["./theme.css"]
},
"vcs": {
"enabled": true,
"clientKind": "git",
"useIgnoreFile": true
},

"$schema": "/Users/chrisgrieser/.local/share/nvim/mason/packages/biome/node_modules/@biomejs/biome/configuration_schema.json"
}
56 changes: 46 additions & 10 deletions snippets/annotation-tags.css
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,52 @@
REQUIRED Obsidian installer version 1.5.3 or higher */
/* ──────────────────────────────────────────────────────────────────── */

.tag:is([href="#agree"], [href="#critique"], [href="#data"], [href="#definition"],
[href="#disagree"], [href="#epistemic-break"], [href="#example"], [href="#gap"],
[href="#goal"], [href="#hypothesis"], [href="#idea"], [href="#important"],
[href="#litreview"], [href="#main"], [href="#method"], [href="#question"],
[href="#quote"], [href="#sidenote"], [href="#summary"], [href="#todo"]),
.cm-s-obsidian .cm-line span:is(.cm-tag-agree, .cm-tag-critique, .cm-tag-data, .cm-tag-definition,
.cm-tag-disagree, .cm-tag-epistemic-break, .cm-tag-example, .cm-tag-gap,
.cm-tag-goal, .cm-tag-hypothesis, .cm-tag-idea, .cm-tag-important,
.cm-tag-litreview, .cm-tag-main, .cm-tag-method, .cm-tag-question,
.cm-tag-quote, .cm-tag-sidenote, .cm-tag-summary, .cm-tag-todo) {
.tag:is(
[href="#agree"],
[href="#critique"],
[href="#data"],
[href="#definition"],
[href="#disagree"],
[href="#epistemic-break"],
[href="#example"],
[href="#gap"],
[href="#goal"],
[href="#hypothesis"],
[href="#idea"],
[href="#important"],
[href="#litreview"],
[href="#main"],
[href="#method"],
[href="#question"],
[href="#quote"],
[href="#sidenote"],
[href="#summary"],
[href="#todo"]
),
.cm-s-obsidian
.cm-line
span:is(
.cm-tag-agree,
.cm-tag-critique,
.cm-tag-data,
.cm-tag-definition,
.cm-tag-disagree,
.cm-tag-epistemic-break,
.cm-tag-example,
.cm-tag-gap,
.cm-tag-goal,
.cm-tag-hypothesis,
.cm-tag-idea,
.cm-tag-important,
.cm-tag-litreview,
.cm-tag-main,
.cm-tag-method,
.cm-tag-question,
.cm-tag-quote,
.cm-tag-sidenote,
.cm-tag-summary,
.cm-tag-todo
) {
/* stylelint-disable-next-line no-unknown-custom-properties */
border-radius: var(--tag-radius);
color: hsl(0 0% 100%);
Expand Down
8 changes: 6 additions & 2 deletions snippets/collapse-external-links.css
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
/* Original idea by @deathau */

/* Hides external links in source mode */
.cm-s-obsidian:not(.is-live-preview) .cm-line:not(.cm-active) .cm-string.cm-url:not(.cm-formatting) {
.cm-s-obsidian:not(.is-live-preview)
.cm-line:not(.cm-active)
.cm-string.cm-url:not(.cm-formatting) {
font-size: 0;
}

.cm-s-obsidian:not(.is-live-preview) .cm-line:not(.cm-active) .cm-string.cm-url:not(.cm-formatting)::after {
.cm-s-obsidian:not(.is-live-preview)
.cm-line:not(.cm-active)
.cm-string.cm-url:not(.cm-formatting)::after {
content: "🔗";
font-size: calc(var(--font-text-size) * 0.9);
position: relative;
Expand Down
10 changes: 8 additions & 2 deletions snippets/hidden-tab-bar-when-one-tab.css
Original file line number Diff line number Diff line change
@@ -1,11 +1,17 @@
/* ⚠️ Requires Obsidian installer version 1.1.8 or later. */
/* ───────────────────────────────────────────────────── */
/* hide tab bar when only one tab */
body:not(.is-mobile) .mod-root .workspace-tab-header-container:not(:has(.workspace-tab-header + .workspace-tab-header)) {
body:not(.is-mobile)
.mod-root
.workspace-tab-header-container:not(:has(.workspace-tab-header + .workspace-tab-header)) {
display: none;
}

/* hide inline title only when one more than tab */
body:not(.is-mobile) .mod-root .workspace-tab-header-container:has(.workspace-tab-header + .workspace-tab-header) + .workspace-tab-container .inline-title {
body:not(.is-mobile)
.mod-root
.workspace-tab-header-container:has(.workspace-tab-header + .workspace-tab-header)
+ .workspace-tab-container
.inline-title {
display: none;
}
6 changes: 3 additions & 3 deletions snippets/image-caption.css
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
/* add alt-text of images as caption */
.image-embed[alt]:not([alt$=".png"], [alt$=".jpg"], [alt$=".jpeg"], [alt$=".tiff"])::after {
content: attr(alt);
font-style: italic;
color: var(--text-muted);
content: attr(alt);
font-style: italic;
color: var(--text-muted);
}

/* centers image caption */
Expand Down
2 changes: 0 additions & 2 deletions snippets/no-readable-line-length-on-tables.css
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,3 @@ body:not(.is-mobile) .markdown-source-view:has(.HyperMD-table-2),
body:not(.is-mobile) .markdown-preview-view:has(table) {
--file-line-width: 100%;
}


16 changes: 0 additions & 16 deletions snippets/private-mode.css

This file was deleted.

18 changes: 9 additions & 9 deletions snippets/relative-line-numbers.css
Original file line number Diff line number Diff line change
Expand Up @@ -15,39 +15,39 @@ body:not(.is-mobile) .cm-lineNumbers *:has(+ .cm-active)::before {
content: "1";
}

body:not(.is-mobile) .cm-lineNumbers *:has(+*+ .cm-active)::before {
body:not(.is-mobile) .cm-lineNumbers *:has(+ * + .cm-active)::before {
content: "2";
}

body:not(.is-mobile) .cm-lineNumbers *:has(+*+*+ .cm-active)::before {
body:not(.is-mobile) .cm-lineNumbers *:has(+ * + * + .cm-active)::before {
content: "3";
}

body:not(.is-mobile) .cm-lineNumbers *:has(+*+*+*+ .cm-active)::before {
body:not(.is-mobile) .cm-lineNumbers *:has(+ * + * + * + .cm-active)::before {
content: "4";
}

body:not(.is-mobile) .cm-lineNumbers *:has(+*+*+*+*+ .cm-active)::before {
body:not(.is-mobile) .cm-lineNumbers *:has(+ * + * + * + * + .cm-active)::before {
content: "5";
}

body:not(.is-mobile) .cm-lineNumbers *:has(+*+*+*+*+*+ .cm-active)::before {
body:not(.is-mobile) .cm-lineNumbers *:has(+ * + * + * + * + * + .cm-active)::before {
content: "6";
}

body:not(.is-mobile) .cm-lineNumbers *:has(+*+*+*+*+*+*+ .cm-active)::before {
body:not(.is-mobile) .cm-lineNumbers *:has(+ * + * + * + * + * + * + .cm-active)::before {
content: "7";
}

body:not(.is-mobile) .cm-lineNumbers *:has(+*+*+*+*+*+*+*+ .cm-active)::before {
body:not(.is-mobile) .cm-lineNumbers *:has(+ * + * + * + * + * + * + * + .cm-active)::before {
content: "8";
}

body:not(.is-mobile) .cm-lineNumbers *:has(+*+*+*+*+*+*+*+*+ .cm-active)::before {
body:not(.is-mobile) .cm-lineNumbers *:has(+ * + * + * + * + * + * + * + * + .cm-active)::before {
content: "9";
}

/* numbers after */
/* numbers after */
body:not(.is-mobile) .cm-lineNumbers .cm-active + *::before {
content: "1";
}
Expand Down
20 changes: 10 additions & 10 deletions snippets/shortened-wordcount-statusbar.css
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,23 @@
/* ────────────────────────────────────────────────────────────────────────── */
/* CONFIG values potentially need to be adjusted depending on the font */
body {
--cut-off-for-word: -2rem;
--cut-off-for-character: -4.94rem;
--cut-off-for-word: -2rem;
--cut-off-for-character: -4.94rem;
}
/* ────────────────────────────────────────────────────────────────────────── */

.plugin-word-count > .status-bar-item-segment {
&:first-child {
margin-right: var(--cut-off-for-word);
}
&:first-child {
margin-right: var(--cut-off-for-word);
}

&:nth-child(2) {
margin-right: var(--cut-off-for-character);
}
&:nth-child(2) {
margin-right: var(--cut-off-for-character);
}
}

.plugin-word-count > .status-bar-item-segment:nth-child(2),
.plugin-word-count ~ .status-bar-item {
background-color: var(--status-bar-background);
padding-left: 0.5rem;
background-color: var(--status-bar-background);
padding-left: 0.5rem;
}
13 changes: 3 additions & 10 deletions source/03 images tables embeds.css
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,7 @@ body .markdown-rendered tbody tr:nth-child(odd):hover {

/* automatically turn off readable line length when there is a table */
.unrestricted-line-length-tables:not(.is-mobile)
:is(.markdown-source-view, .markdown-preview-view):has(
table,
.HyperMD-table-2
) {
:is(.markdown-source-view, .markdown-preview-view):has(table, .HyperMD-table-2) {
--file-line-width: 100%;
}

Expand All @@ -64,9 +61,7 @@ body .markdown-rendered tbody tr:nth-child(odd):hover {
body:not(.is-mobile, .max-image-size-toggle)
.workspace-leaf-content:not([data-type="image"])
img:not(:active),
body:not(.is-mobile, .max-image-size-toggle)
.oz-image-widget-cm6
> img:not(:active) {
body:not(.is-mobile, .max-image-size-toggle) .oz-image-widget-cm6 > img:not(:active) {
max-width: calc(var(--image-size) * 1%);
cursor: zoom-in;
}
Expand Down Expand Up @@ -143,9 +138,7 @@ body:not(.no-image-alttext-caption) .image-embed::after {
}

/* fix placement of link icon */
body:not(.no-heading-background)
.markdown-embed[data-type="heading"]
.markdown-embed-link {
body:not(.no-heading-background) .markdown-embed[data-type="heading"] .markdown-embed-link {
top: 9px;
right: 14px;
}
Loading

0 comments on commit a726a06

Please sign in to comment.