Skip to content

Commit b4e9c76

Browse files
authored
Improve wikilink styling (foambubble#221)
* Improve wikilink formatting detection * Remove surrounding brackets * Add wikilink styling
1 parent 76188bd commit b4e9c76

File tree

2 files changed

+17
-0
lines changed

2 files changed

+17
-0
lines changed

docs/_layouts/foam.html

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,14 @@
2626
prev instanceof Text && prev.textContent.endsWith('[') &&
2727
next instanceof Text && next.textContent.startsWith(']')
2828
) {
29+
30+
// remove surrounding brackets
31+
prev.textContent = prev.textContent.slice(0, -1);
32+
next.textContent = next.textContent.slice(1);
2933

34+
// add CSS list for styling
35+
a.classList.add('wikilink');
36+
3037
// replace page-link with "Page Title"...
3138
a.innerText = a.title;
3239

docs/assets/css/style.scss

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,16 @@ blockquote {
5252
"DejaVu Serif", "Bitstream Vera Serif", "Liberation Serif", Georgia, serif;
5353
}
5454

55+
.wikilink:before {
56+
content: "[[";
57+
opacity: 0.5;
58+
}
59+
60+
.wikilink:after {
61+
content: "]]";
62+
opacity: 0.5;
63+
}
64+
5565
.github-only {
5666
display: none;
5767
}

0 commit comments

Comments
 (0)