Compare commits
252 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
591c4813ec | ||
|
|
83e7aec3c9 | ||
|
|
25ba1159ad | ||
|
|
e38eaa94d6 | ||
|
|
a78926ede5 | ||
|
|
5c76d8dad9 | ||
|
|
3dcc1f1106 | ||
|
|
ff770927fd | ||
|
|
7ffc907907 | ||
|
|
6dd4c64a4c | ||
|
|
8fc6b8e28e | ||
|
|
b10b23a47b | ||
|
|
23380d0519 | ||
|
|
dd047305af | ||
|
|
54a8fd4a56 | ||
|
|
5ef9aad501 | ||
|
|
14b89105dc | ||
|
|
93d039fe7c | ||
|
|
234c707a93 | ||
|
|
728d8529ec | ||
|
|
e142f37e8d | ||
|
|
d747b19e61 | ||
|
|
1f3da4b829 | ||
|
|
e15e39155d | ||
|
|
dff5ae0d4d | ||
|
|
b2555ced61 | ||
|
|
7ccff2cf3d | ||
|
|
e0b6606d50 | ||
|
|
d7a42a2fd7 | ||
|
|
422b6cc25b | ||
|
|
22c8981bb9 | ||
|
|
8b2a82a96a | ||
|
|
81af8c459b | ||
|
|
ffe22689eb | ||
|
|
c1b8fe1221 | ||
|
|
b7a619bbd7 | ||
|
|
74993d19b7 | ||
|
|
25a4d3b6e1 | ||
|
|
aaf31f419e | ||
|
|
f54df35767 | ||
|
|
015ed4cfa2 | ||
|
|
a8137edf24 | ||
|
|
eda370334a | ||
|
|
d3e20b8b94 | ||
|
|
8d7a7b712f | ||
|
|
0896814959 | ||
|
|
8b2fba895a | ||
|
|
e884f4927f | ||
|
|
2b0482ae4c | ||
|
|
8a100edeb8 | ||
|
|
200c605142 | ||
|
|
f2078ee621 | ||
|
|
916c51c19c | ||
|
|
67a7ba37e8 | ||
|
|
72941965ab | ||
|
|
b732293f65 | ||
|
|
7070a1992a | ||
|
|
997937af5a | ||
|
|
a334b45b17 | ||
|
|
473ea2c66f | ||
|
|
34b0353797 | ||
|
|
52a185f73b | ||
|
|
69c74ca6b5 | ||
|
|
ab809249c8 | ||
|
|
84c75d0546 | ||
|
|
dbd4fb7595 | ||
|
|
a275123be2 | ||
|
|
c88f31c364 | ||
|
|
d261655d96 | ||
|
|
c0800a8749 | ||
|
|
ac0dd50c04 | ||
|
|
e809896338 | ||
|
|
19606ba63d | ||
|
|
1e237ef677 | ||
|
|
5a1fbc9374 | ||
|
|
a1293f820a | ||
|
|
84c6e1efed | ||
|
|
8673a7bc3d | ||
|
|
775a1b2490 | ||
|
|
006b74ec6f | ||
|
|
8aba612a00 | ||
|
|
cbc2bea413 | ||
|
|
ae240ff82c | ||
|
|
ba586adc76 | ||
|
|
159deabfe1 | ||
|
|
44984cdaf4 | ||
|
|
683cb53cbd | ||
|
|
232bd2f016 | ||
|
|
e0fd9570d7 | ||
|
|
bc32bbeaed | ||
|
|
efb6c7845f | ||
|
|
bd316d8249 | ||
|
|
0293c12217 | ||
|
|
0439c163a0 | ||
|
|
0b6711c218 | ||
|
|
ed9a8efd1f | ||
|
|
e302f6c423 | ||
|
|
b21b27d1d3 | ||
|
|
364aee36fc | ||
|
|
cea0f3eb74 | ||
|
|
8b855b522a | ||
|
|
7b3696b877 | ||
|
|
b4ff12ca0b | ||
|
|
b67a389bea | ||
|
|
2b5c03c972 | ||
|
|
aaed5dc1f1 | ||
|
|
1a5d158fce | ||
|
|
a09974446d | ||
|
|
9fc71603ba | ||
|
|
d38f9bec70 | ||
|
|
771ebd8031 | ||
|
|
e4cc625c33 | ||
|
|
3789df80e4 | ||
|
|
037426217c | ||
|
|
e646cdb0be | ||
|
|
8d092a3a4a | ||
|
|
32c79a561f | ||
|
|
3c660dd9b5 | ||
|
|
4cca3c1f2d | ||
|
|
9d3bbd6076 | ||
|
|
9c71f07355 | ||
|
|
77485b754d | ||
|
|
6e6dd4cb0b | ||
|
|
81fe2d2493 | ||
|
|
24d08d580d | ||
|
|
321e19dc41 | ||
|
|
12d33619a2 | ||
|
|
97607c3ca5 | ||
|
|
4197ad460a | ||
|
|
fc89ff2680 | ||
|
|
e9a33c04b5 | ||
|
|
b0e15e0cbc | ||
|
|
9ba0a4b34f | ||
|
|
f1b85fb6d9 | ||
|
|
66304da027 | ||
|
|
40d216759c | ||
|
|
5c602ab16f | ||
|
|
87144fca21 | ||
|
|
a9523dd39b | ||
|
|
bcb166c21c | ||
|
|
416dc0b85c | ||
|
|
b8a660e208 | ||
|
|
ec86cca97b | ||
|
|
87b5a7a251 | ||
|
|
c8d390dbc5 | ||
|
|
3c7ece5405 | ||
|
|
f7027e7ecd | ||
|
|
0cfd93c57c | ||
|
|
3f8c473678 | ||
|
|
f05ff5e62d | ||
|
|
12ed9722d8 | ||
|
|
887d4d4f5e | ||
|
|
f9c7cdf928 | ||
|
|
2d55b6ac2e | ||
|
|
d5884aedb7 | ||
|
|
66eaa444a4 | ||
|
|
0ddc48a452 | ||
|
|
cd19159c53 | ||
|
|
7808c66c4d | ||
|
|
a7abc6ab96 | ||
|
|
9509a64354 | ||
|
|
53242b1e57 | ||
|
|
3ce6944c18 | ||
|
|
3cec4fd950 | ||
|
|
e245505082 | ||
|
|
fc4b9ded76 | ||
|
|
27c4761fe0 | ||
|
|
3583265f80 | ||
|
|
3781b67707 | ||
|
|
671fe05312 | ||
|
|
1613511f39 | ||
|
|
acab488784 | ||
|
|
ff91dcd196 | ||
|
|
a287d11246 | ||
|
|
575288ece9 | ||
|
|
25b5ac43dd | ||
|
|
1d9c0e4a44 | ||
|
|
e62d512d95 | ||
|
|
8f15c5f8c1 | ||
|
|
efeaf9b49c | ||
|
|
91c4e3fb3a | ||
|
|
22f11711b2 | ||
|
|
5c3ef884c7 | ||
|
|
16b177ce66 | ||
|
|
14c6181d24 | ||
|
|
e6e04c03c4 | ||
|
|
146e975932 | ||
|
|
c117e38899 | ||
|
|
4fd983277e | ||
|
|
cc86136bcb | ||
|
|
8e083d4a93 | ||
|
|
03b574b160 | ||
|
|
a469653f75 | ||
|
|
c51573efa9 | ||
|
|
902d0f2a0f | ||
|
|
1ddd15afc6 | ||
|
|
16f8cd7100 | ||
|
|
9c5ecccf25 | ||
|
|
e3cd531c53 | ||
|
|
3674df48b8 | ||
|
|
9e8c5587e4 | ||
|
|
6605b13b86 | ||
|
|
6edc979896 | ||
|
|
fc43922445 | ||
|
|
54a68e6e5c | ||
|
|
a6ab2f92ef | ||
|
|
fda481fbb9 | ||
|
|
94e987dab5 | ||
|
|
e981c76ed4 | ||
|
|
f70128a3de | ||
|
|
651bfc5cd2 | ||
|
|
6079420178 | ||
|
|
b96c60edfc | ||
|
|
978d5ca1ae | ||
|
|
907270992d | ||
|
|
6f9283e95b | ||
|
|
0fad5570d3 | ||
|
|
dc9b421e21 | ||
|
|
8779e72c77 | ||
|
|
7f6523337c | ||
|
|
7e0f2e4449 | ||
|
|
1313bd9779 | ||
|
|
5234fae080 | ||
|
|
0ee0855e1c | ||
|
|
e06e341468 | ||
|
|
73e526a7d5 | ||
|
|
cdc4f1a840 | ||
|
|
714b4fcfa3 | ||
|
|
9c04ca0266 | ||
|
|
388a2bf78b | ||
|
|
f192f9a23d | ||
|
|
3b3e6ec3b2 | ||
|
|
8e85e274f6 | ||
|
|
fcd5d2807d | ||
|
|
4587b13360 | ||
|
|
fb9ea8dcb8 | ||
|
|
c520db4882 | ||
|
|
10f9843bb6 | ||
|
|
0dc51ff39c | ||
|
|
c35086c510 | ||
|
|
31297b7e5a | ||
|
|
fa3bc3de92 | ||
|
|
41c443dbf0 | ||
|
|
a271fb9d74 | ||
|
|
49cdca5dfc | ||
|
|
9645f00317 | ||
|
|
57ebf4c21c | ||
|
|
54e3e071d1 | ||
|
|
d46e223831 | ||
|
|
6f9a29c174 | ||
|
|
532bc61025 | ||
|
|
99aea48260 |
11
.github/workflows/deploy.yaml
vendored
11
.github/workflows/deploy.yaml
vendored
@@ -10,18 +10,21 @@ jobs:
|
|||||||
runs-on: ubuntu-18.04
|
runs-on: ubuntu-18.04
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v2
|
||||||
|
with:
|
||||||
|
fetch-depth: 0 # Fetch all history for .GitInfo and .Lastmod
|
||||||
|
|
||||||
- name: Build Link Index
|
- name: Build Link Index
|
||||||
uses: jackyzha0/hugo-obsidian@v2.7
|
uses: jackyzha0/hugo-obsidian@v2.18
|
||||||
with:
|
with:
|
||||||
index: true
|
index: true
|
||||||
input: content
|
input: content
|
||||||
output: data
|
output: assets/indices
|
||||||
|
root: .
|
||||||
|
|
||||||
- name: Setup Hugo
|
- name: Setup Hugo
|
||||||
uses: peaceiris/actions-hugo@v2
|
uses: peaceiris/actions-hugo@v2
|
||||||
with:
|
with:
|
||||||
hugo-version: '0.82.0'
|
hugo-version: '0.96.0'
|
||||||
extended: true
|
extended: true
|
||||||
|
|
||||||
- name: Build
|
- name: Build
|
||||||
@@ -33,4 +36,4 @@ jobs:
|
|||||||
github_token: ${{ secrets.GITHUB_TOKEN }}
|
github_token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
publish_dir: ./public
|
publish_dir: ./public
|
||||||
publish_branch: master # deploying branch
|
publish_branch: master # deploying branch
|
||||||
cname: quartz.jzhao.xyz
|
cname: quartz.jzhao.xyz
|
||||||
|
|||||||
5
.gitignore
vendored
5
.gitignore
vendored
@@ -3,5 +3,6 @@ public
|
|||||||
resources
|
resources
|
||||||
.idea
|
.idea
|
||||||
content/.obsidian
|
content/.obsidian
|
||||||
data/linkIndex.yaml
|
assets/indices/linkIndex.json
|
||||||
data/contentIndex.yaml
|
assets/indices/contentIndex.json
|
||||||
|
linkmap
|
||||||
|
|||||||
0
.hugo_build.lock
Normal file
0
.hugo_build.lock
Normal file
7
.prettierrc
Normal file
7
.prettierrc
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
{
|
||||||
|
"printWidth": 100,
|
||||||
|
"quoteProps": "as-needed",
|
||||||
|
"trailingComma": "all",
|
||||||
|
"tabWidth": 2,
|
||||||
|
"semi": false
|
||||||
|
}
|
||||||
17
Makefile
17
Makefile
@@ -3,5 +3,18 @@
|
|||||||
help: ## Show all Makefile targets
|
help: ## Show all Makefile targets
|
||||||
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'
|
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'
|
||||||
|
|
||||||
serve: ## serve
|
update: ## Update Quartz to the latest version on Github
|
||||||
hugo-obsidian -input=content -output=data -index -root=. && hugo server
|
go install github.com/jackyzha0/hugo-obsidian@latest
|
||||||
|
@git remote show upstream || (echo "remote 'upstream' not present, setting 'upstream'" && git remote add upstream https://github.com/jackyzha0/quartz.git)
|
||||||
|
git fetch upstream
|
||||||
|
git log --oneline --decorate --graph ..upstream/hugo
|
||||||
|
git checkout -p upstream/hugo -- layouts .github Makefile assets/js assets/styles/base.scss assets/styles/darkmode.scss config.toml data
|
||||||
|
|
||||||
|
update-force: ## Forcefully pull all changes and don't ask to patch
|
||||||
|
go install github.com/jackyzha0/hugo-obsidian@latest
|
||||||
|
@git remote show upstream || (echo "remote 'upstream' not present, setting 'upstream'" && git remote add upstream https://github.com/jackyzha0/quartz.git)
|
||||||
|
git fetch upstream
|
||||||
|
git checkout upstream/hugo -- layouts .github Makefile assets/js assets/styles/base.scss assets/styles/darkmode.scss config.toml data
|
||||||
|
|
||||||
|
serve: ## Serve Quartz locally
|
||||||
|
hugo-obsidian -input=content -output=assets/indices -index -root=. && hugo server --enableGitInfo --minify
|
||||||
|
|||||||
17
README.md
17
README.md
@@ -1,6 +1,19 @@
|
|||||||
# Quartz
|
# Quartz
|
||||||
Host your own second brain and digital garden for free.
|
|
||||||
|
Host your second brain and [digital garden](https://jzhao.xyz/posts/networked-thought) for free. Quartz features
|
||||||
|
|
||||||
|
1. Extremely fast full-text search by pressing `Ctrl` + `k`
|
||||||
|
2. Customizable and hackable design based on Hugo
|
||||||
|
3. Automatically generated backlinks, link previews, and local graph
|
||||||
|
4. Built-in CJK + Latex Support
|
||||||
|
5. Support for both Markdown Links and Wikilinks
|
||||||
|
|
||||||
|
Check out some of the [amazing gardens that community members](https://quartz.jzhao.xyz/notes/showcase/) have published with Quartz!
|
||||||
|
|
||||||
> “[One] who works with the door open gets all kinds of interruptions, but [they] also occasionally gets clues as to what the world is and what might be important.” — Richard Hamming
|
> “[One] who works with the door open gets all kinds of interruptions, but [they] also occasionally gets clues as to what the world is and what might be important.” — Richard Hamming
|
||||||
|
|
||||||
🔗 Get Started: https://quartz.jzhao.xyz/
|
🔗 Get Started: https://quartz.jzhao.xyz/
|
||||||
|
|
||||||
|
*Quartz Example Screenshot*
|
||||||
|
|
||||||
|
[Join the Discord Community](https://discord.gg/cRFFHYye7t)
|
||||||
|
|||||||
0
assets/indices/.gitkeep
Normal file
0
assets/indices/.gitkeep
Normal file
6
assets/js/callouts.js
Normal file
6
assets/js/callouts.js
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
const addCollapsibleCallouts = () => {
|
||||||
|
const collapsibleCallouts = document.querySelectorAll("blockquote.callout-collapsible");
|
||||||
|
collapsibleCallouts.forEach(el => el.addEventListener('click', event => {
|
||||||
|
event.currentTarget.classList.toggle("callout-collapsed");
|
||||||
|
}));
|
||||||
|
}
|
||||||
40
assets/js/clipboard.js
Normal file
40
assets/js/clipboard.js
Normal file
@@ -0,0 +1,40 @@
|
|||||||
|
const svgCopy =
|
||||||
|
'<svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true"><path fill-rule="evenodd" d="M0 6.75C0 5.784.784 5 1.75 5h1.5a.75.75 0 010 1.5h-1.5a.25.25 0 00-.25.25v7.5c0 .138.112.25.25.25h7.5a.25.25 0 00.25-.25v-1.5a.75.75 0 011.5 0v1.5A1.75 1.75 0 019.25 16h-7.5A1.75 1.75 0 010 14.25v-7.5z"></path><path fill-rule="evenodd" d="M5 1.75C5 .784 5.784 0 6.75 0h7.5C15.216 0 16 .784 16 1.75v7.5A1.75 1.75 0 0114.25 11h-7.5A1.75 1.75 0 015 9.25v-7.5zm1.75-.25a.25.25 0 00-.25.25v7.5c0 .138.112.25.25.25h7.5a.25.25 0 00.25-.25v-7.5a.25.25 0 00-.25-.25h-7.5z"></path></svg>';
|
||||||
|
const svgCheck =
|
||||||
|
'<svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true"><path fill-rule="evenodd" fill="rgb(63, 185, 80)" d="M13.78 4.22a.75.75 0 010 1.06l-7.25 7.25a.75.75 0 01-1.06 0L2.22 9.28a.75.75 0 011.06-1.06L6 10.94l6.72-6.72a.75.75 0 011.06 0z"></path></svg>';
|
||||||
|
|
||||||
|
|
||||||
|
const addCopyButtons = () => {
|
||||||
|
let els = document.getElementsByClassName("highlight");
|
||||||
|
// for each highlight
|
||||||
|
for (let i = 0; i < els.length; i++) {
|
||||||
|
if (els[i].getElementsByClassName("clipboard-button").length) continue;
|
||||||
|
|
||||||
|
// find pre > code inside els[i]
|
||||||
|
let codeBlocks = els[i].getElementsByTagName("code");
|
||||||
|
|
||||||
|
// line numbers are inside first code block
|
||||||
|
let lastCodeBlock = codeBlocks[codeBlocks.length - 1];
|
||||||
|
const button = document.createElement("button");
|
||||||
|
button.className = "clipboard-button";
|
||||||
|
button.type = "button";
|
||||||
|
button.innerHTML = svgCopy;
|
||||||
|
// remove every second newline from lastCodeBlock.innerText
|
||||||
|
button.addEventListener("click", () => {
|
||||||
|
navigator.clipboard.writeText(lastCodeBlock.innerText.replace(/\n\n/g, "\n")).then(
|
||||||
|
() => {
|
||||||
|
button.blur();
|
||||||
|
button.innerHTML = svgCheck;
|
||||||
|
setTimeout(() => {
|
||||||
|
button.innerHTML = svgCopy
|
||||||
|
button.style.borderColor = ""
|
||||||
|
}, 2000);
|
||||||
|
},
|
||||||
|
(error) => (button.innerHTML = "Error")
|
||||||
|
);
|
||||||
|
});
|
||||||
|
// find chroma inside els[i]
|
||||||
|
let chroma = els[i].getElementsByClassName("chroma")[0];
|
||||||
|
els[i].insertBefore(button, chroma);
|
||||||
|
}
|
||||||
|
}
|
||||||
13
assets/js/code-title.js
Normal file
13
assets/js/code-title.js
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
|
||||||
|
function addTitleToCodeBlocks() {
|
||||||
|
var els = document.getElementsByClassName("highlight");
|
||||||
|
for (var i = 0; i < els.length; i++) {
|
||||||
|
if (els[i].title.length) {
|
||||||
|
let div = document.createElement("div");
|
||||||
|
if (els[i].getElementsByClassName("code-title").length) continue;
|
||||||
|
div.textContent=els[i].title;
|
||||||
|
div.classList.add("code-title")
|
||||||
|
els[i].insertBefore(div, els[i].firstChild);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
@@ -1,18 +1,26 @@
|
|||||||
const userPref = window.matchMedia('(prefers-color-scheme: light)').matches ? 'light' : 'dark'
|
const userPref = window.matchMedia('(prefers-color-scheme: light)').matches ? 'light' : 'dark'
|
||||||
const currentTheme = localStorage.getItem('theme') ?? userPref
|
const currentTheme = localStorage.getItem('theme') ?? userPref
|
||||||
|
const syntaxTheme = document.querySelector("#theme-link");
|
||||||
|
|
||||||
|
|
||||||
|
{{ $darkSyntax := resources.Get "styles/_dark_syntax.scss" | resources.ToCSS (dict "outputStyle" "compressed") | resources.Fingerprint "md5" | resources.Minify }}
|
||||||
|
{{ $lightSyntax := resources.Get "styles/_light_syntax.scss" | resources.ToCSS (dict "outputStyle" "compressed") | resources.Fingerprint "md5" | resources.Minify }}
|
||||||
|
|
||||||
if (currentTheme) {
|
if (currentTheme) {
|
||||||
document.documentElement.setAttribute('saved-theme', currentTheme);
|
document.documentElement.setAttribute('saved-theme', currentTheme);
|
||||||
|
syntaxTheme.href = currentTheme === 'dark' ? '{{ $darkSyntax.Permalink }}' : '{{ $lightSyntax.Permalink }}';
|
||||||
}
|
}
|
||||||
|
|
||||||
const switchTheme = (e) => {
|
const switchTheme = (e) => {
|
||||||
if (e.target.checked) {
|
if (e.target.checked) {
|
||||||
document.documentElement.setAttribute('saved-theme', 'dark')
|
document.documentElement.setAttribute('saved-theme', 'dark');
|
||||||
localStorage.setItem('theme', 'dark')
|
localStorage.setItem('theme', 'dark');
|
||||||
|
syntaxTheme.href = '{{ $darkSyntax.Permalink }}';
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
document.documentElement.setAttribute('saved-theme', 'light')
|
document.documentElement.setAttribute('saved-theme', 'light')
|
||||||
localStorage.setItem('theme', 'light')
|
localStorage.setItem('theme', 'light')
|
||||||
|
syntaxTheme.href = '{{ $lightSyntax.Permalink }}';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
61
assets/js/full-text-search.js
Normal file
61
assets/js/full-text-search.js
Normal file
@@ -0,0 +1,61 @@
|
|||||||
|
; (async function() {
|
||||||
|
const encoder = (str) => str.toLowerCase().split(/([^a-z]|[^\x00-\x7F])/)
|
||||||
|
const contentIndex = new FlexSearch.Document({
|
||||||
|
cache: true,
|
||||||
|
charset: "latin:extra",
|
||||||
|
optimize: true,
|
||||||
|
index: [
|
||||||
|
{
|
||||||
|
field: "content",
|
||||||
|
tokenize: "reverse",
|
||||||
|
encode: encoder,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
field: "title",
|
||||||
|
tokenize: "forward",
|
||||||
|
encode: encoder,
|
||||||
|
},
|
||||||
|
],
|
||||||
|
})
|
||||||
|
|
||||||
|
const { content } = await fetchData
|
||||||
|
for (const [key, value] of Object.entries(content)) {
|
||||||
|
contentIndex.add({
|
||||||
|
id: key,
|
||||||
|
title: value.title,
|
||||||
|
content: removeMarkdown(value.content),
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
const formatForDisplay = (id) => ({
|
||||||
|
id,
|
||||||
|
url: id,
|
||||||
|
title: content[id].title,
|
||||||
|
content: content[id].content,
|
||||||
|
})
|
||||||
|
|
||||||
|
registerHandlers((e) => {
|
||||||
|
term = e.target.value
|
||||||
|
const searchResults = contentIndex.search(term, [
|
||||||
|
{
|
||||||
|
field: "content",
|
||||||
|
limit: 10,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
field: "title",
|
||||||
|
limit: 5,
|
||||||
|
},
|
||||||
|
])
|
||||||
|
const getByField = (field) => {
|
||||||
|
const results = searchResults.filter((x) => x.field === field)
|
||||||
|
if (results.length === 0) {
|
||||||
|
return []
|
||||||
|
} else {
|
||||||
|
return [...results[0].result]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
const allIds = new Set([...getByField("title"), ...getByField("content")])
|
||||||
|
const finalResults = [...allIds].map(formatForDisplay)
|
||||||
|
displayResults(finalResults, true)
|
||||||
|
})
|
||||||
|
})()
|
||||||
270
assets/js/graph.js
Normal file
270
assets/js/graph.js
Normal file
@@ -0,0 +1,270 @@
|
|||||||
|
async function drawGraph(baseUrl, isHome, pathColors, graphConfig) {
|
||||||
|
|
||||||
|
let {
|
||||||
|
depth,
|
||||||
|
enableDrag,
|
||||||
|
enableLegend,
|
||||||
|
enableZoom,
|
||||||
|
opacityScale,
|
||||||
|
scale,
|
||||||
|
repelForce,
|
||||||
|
fontSize} = graphConfig;
|
||||||
|
|
||||||
|
const container = document.getElementById("graph-container")
|
||||||
|
const { index, links, content } = await fetchData
|
||||||
|
|
||||||
|
// Use .pathname to remove hashes / searchParams / text fragments
|
||||||
|
const cleanUrl = window.location.origin + window.location.pathname
|
||||||
|
|
||||||
|
const curPage = cleanUrl.replace(/\/$/g, "").replace(baseUrl, "")
|
||||||
|
|
||||||
|
const parseIdsFromLinks = (links) => [
|
||||||
|
...new Set(links.flatMap((link) => [link.source, link.target])),
|
||||||
|
]
|
||||||
|
|
||||||
|
// Links is mutated by d3. We want to use links later on, so we make a copy and pass that one to d3
|
||||||
|
// Note: shallow cloning does not work because it copies over references from the original array
|
||||||
|
const copyLinks = JSON.parse(JSON.stringify(links))
|
||||||
|
|
||||||
|
const neighbours = new Set()
|
||||||
|
const wl = [curPage || "/", "__SENTINEL"]
|
||||||
|
if (depth >= 0) {
|
||||||
|
while (depth >= 0 && wl.length > 0) {
|
||||||
|
// compute neighbours
|
||||||
|
const cur = wl.shift()
|
||||||
|
if (cur === "__SENTINEL") {
|
||||||
|
depth--
|
||||||
|
wl.push("__SENTINEL")
|
||||||
|
} else {
|
||||||
|
neighbours.add(cur)
|
||||||
|
const outgoing = index.links[cur] || []
|
||||||
|
const incoming = index.backlinks[cur] || []
|
||||||
|
wl.push(...outgoing.map((l) => l.target), ...incoming.map((l) => l.source))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
parseIdsFromLinks(copyLinks).forEach((id) => neighbours.add(id))
|
||||||
|
}
|
||||||
|
|
||||||
|
const data = {
|
||||||
|
nodes: [...neighbours].map((id) => ({ id })),
|
||||||
|
links: copyLinks.filter((l) => neighbours.has(l.source) && neighbours.has(l.target)),
|
||||||
|
}
|
||||||
|
|
||||||
|
const color = (d) => {
|
||||||
|
if (d.id === curPage || (d.id === "/" && curPage === "")) {
|
||||||
|
return "var(--g-node-active)"
|
||||||
|
}
|
||||||
|
|
||||||
|
for (const pathColor of pathColors) {
|
||||||
|
const path = Object.keys(pathColor)[0]
|
||||||
|
const colour = pathColor[path]
|
||||||
|
if (d.id.startsWith(path)) {
|
||||||
|
return colour
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return "var(--g-node)"
|
||||||
|
}
|
||||||
|
|
||||||
|
const drag = (simulation) => {
|
||||||
|
function dragstarted(event, d) {
|
||||||
|
if (!event.active) simulation.alphaTarget(1).restart()
|
||||||
|
d.fx = d.x
|
||||||
|
d.fy = d.y
|
||||||
|
}
|
||||||
|
|
||||||
|
function dragged(event, d) {
|
||||||
|
d.fx = event.x
|
||||||
|
d.fy = event.y
|
||||||
|
}
|
||||||
|
|
||||||
|
function dragended(event, d) {
|
||||||
|
if (!event.active) simulation.alphaTarget(0)
|
||||||
|
d.fx = null
|
||||||
|
d.fy = null
|
||||||
|
}
|
||||||
|
|
||||||
|
const noop = () => {}
|
||||||
|
return d3
|
||||||
|
.drag()
|
||||||
|
.on("start", enableDrag ? dragstarted : noop)
|
||||||
|
.on("drag", enableDrag ? dragged : noop)
|
||||||
|
.on("end", enableDrag ? dragended : noop)
|
||||||
|
}
|
||||||
|
|
||||||
|
const height = Math.max(container.offsetHeight, isHome ? 500 : 250)
|
||||||
|
const width = container.offsetWidth
|
||||||
|
|
||||||
|
const simulation = d3
|
||||||
|
.forceSimulation(data.nodes)
|
||||||
|
.force("charge", d3.forceManyBody().strength(-100 * repelForce))
|
||||||
|
.force(
|
||||||
|
"link",
|
||||||
|
d3
|
||||||
|
.forceLink(data.links)
|
||||||
|
.id((d) => d.id)
|
||||||
|
.distance(40),
|
||||||
|
)
|
||||||
|
.force("center", d3.forceCenter())
|
||||||
|
|
||||||
|
const svg = d3
|
||||||
|
.select("#graph-container")
|
||||||
|
.append("svg")
|
||||||
|
.attr("width", width)
|
||||||
|
.attr("height", height)
|
||||||
|
.attr('viewBox', [-width / 2 * 1 / scale, -height / 2 * 1 / scale, width * 1 / scale, height * 1 / scale])
|
||||||
|
|
||||||
|
if (enableLegend) {
|
||||||
|
const legend = [{ Current: "var(--g-node-active)" }, { Note: "var(--g-node)" }, ...pathColors]
|
||||||
|
legend.forEach((legendEntry, i) => {
|
||||||
|
const key = Object.keys(legendEntry)[0]
|
||||||
|
const colour = legendEntry[key]
|
||||||
|
svg
|
||||||
|
.append("circle")
|
||||||
|
.attr("cx", -width / 2 + 20)
|
||||||
|
.attr("cy", height / 2 - 30 * (i + 1))
|
||||||
|
.attr("r", 6)
|
||||||
|
.style("fill", colour)
|
||||||
|
svg
|
||||||
|
.append("text")
|
||||||
|
.attr("x", -width / 2 + 40)
|
||||||
|
.attr("y", height / 2 - 30 * (i + 1))
|
||||||
|
.text(key)
|
||||||
|
.style("font-size", "15px")
|
||||||
|
.attr("alignment-baseline", "middle")
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// draw links between nodes
|
||||||
|
const link = svg
|
||||||
|
.append("g")
|
||||||
|
.selectAll("line")
|
||||||
|
.data(data.links)
|
||||||
|
.join("line")
|
||||||
|
.attr("class", "link")
|
||||||
|
.attr("stroke", "var(--g-link)")
|
||||||
|
.attr("stroke-width", 2)
|
||||||
|
.attr("data-source", (d) => d.source.id)
|
||||||
|
.attr("data-target", (d) => d.target.id)
|
||||||
|
|
||||||
|
// svg groups
|
||||||
|
const graphNode = svg.append("g").selectAll("g").data(data.nodes).enter().append("g")
|
||||||
|
|
||||||
|
// calculate radius
|
||||||
|
const nodeRadius = (d) => {
|
||||||
|
const numOut = index.links[d.id]?.length || 0
|
||||||
|
const numIn = index.backlinks[d.id]?.length || 0
|
||||||
|
return 2 + Math.sqrt(numOut + numIn)
|
||||||
|
}
|
||||||
|
|
||||||
|
// draw individual nodes
|
||||||
|
const node = graphNode
|
||||||
|
.append("circle")
|
||||||
|
.attr("class", "node")
|
||||||
|
.attr("id", (d) => d.id)
|
||||||
|
.attr("r", nodeRadius)
|
||||||
|
.attr("fill", color)
|
||||||
|
.style("cursor", "pointer")
|
||||||
|
.on("click", (_, d) => {
|
||||||
|
// SPA navigation
|
||||||
|
window.Million.navigate(new URL(`${baseUrl}${decodeURI(d.id).replace(/\s+/g, "-")}/`), ".singlePage")
|
||||||
|
})
|
||||||
|
.on("mouseover", function (_, d) {
|
||||||
|
d3.selectAll(".node").transition().duration(100).attr("fill", "var(--g-node-inactive)")
|
||||||
|
|
||||||
|
const neighbours = parseIdsFromLinks([
|
||||||
|
...(index.links[d.id] || []),
|
||||||
|
...(index.backlinks[d.id] || []),
|
||||||
|
])
|
||||||
|
const neighbourNodes = d3.selectAll(".node").filter((d) => neighbours.includes(d.id))
|
||||||
|
const currentId = d.id
|
||||||
|
window.Million.prefetch(new URL(`${baseUrl}${decodeURI(d.id).replace(/\s+/g, "-")}/`))
|
||||||
|
const linkNodes = d3
|
||||||
|
.selectAll(".link")
|
||||||
|
.filter((d) => d.source.id === currentId || d.target.id === currentId)
|
||||||
|
|
||||||
|
// highlight neighbour nodes
|
||||||
|
neighbourNodes.transition().duration(200).attr("fill", color)
|
||||||
|
|
||||||
|
// highlight links
|
||||||
|
linkNodes.transition().duration(200).attr("stroke", "var(--g-link-active)")
|
||||||
|
|
||||||
|
const bigFont = fontSize*1.5
|
||||||
|
|
||||||
|
// show text for self
|
||||||
|
d3.select(this.parentNode)
|
||||||
|
.raise()
|
||||||
|
.select("text")
|
||||||
|
.transition()
|
||||||
|
.duration(200)
|
||||||
|
.attr('opacityOld', d3.select(this.parentNode).select('text').style("opacity"))
|
||||||
|
.style('opacity', 1)
|
||||||
|
.style('font-size', bigFont+'em')
|
||||||
|
.attr('dy', d => nodeRadius(d) + 20 + 'px') // radius is in px
|
||||||
|
})
|
||||||
|
.on("mouseleave", function (_, d) {
|
||||||
|
d3.selectAll(".node").transition().duration(200).attr("fill", color)
|
||||||
|
|
||||||
|
const currentId = d.id
|
||||||
|
const linkNodes = d3
|
||||||
|
.selectAll(".link")
|
||||||
|
.filter((d) => d.source.id === currentId || d.target.id === currentId)
|
||||||
|
|
||||||
|
linkNodes.transition().duration(200).attr("stroke", "var(--g-link)")
|
||||||
|
|
||||||
|
d3.select(this.parentNode)
|
||||||
|
.select("text")
|
||||||
|
.transition()
|
||||||
|
.duration(200)
|
||||||
|
.style('opacity', d3.select(this.parentNode).select('text').attr("opacityOld"))
|
||||||
|
.style('font-size', fontSize+'em')
|
||||||
|
.attr('dy', d => nodeRadius(d) + 8 + 'px') // radius is in px
|
||||||
|
})
|
||||||
|
.call(drag(simulation))
|
||||||
|
|
||||||
|
// draw labels
|
||||||
|
const labels = graphNode
|
||||||
|
.append("text")
|
||||||
|
.attr("dx", 0)
|
||||||
|
.attr("dy", (d) => nodeRadius(d) + 8 + "px")
|
||||||
|
.attr("text-anchor", "middle")
|
||||||
|
.text((d) => content[d.id]?.title || d.id.replace("-", " "))
|
||||||
|
.style('opacity', (opacityScale - 1) / 3.75)
|
||||||
|
.style("pointer-events", "none")
|
||||||
|
.style('font-size', fontSize+'em')
|
||||||
|
.raise()
|
||||||
|
.call(drag(simulation))
|
||||||
|
|
||||||
|
// set panning
|
||||||
|
|
||||||
|
if (enableZoom) {
|
||||||
|
svg.call(
|
||||||
|
d3
|
||||||
|
.zoom()
|
||||||
|
.extent([
|
||||||
|
[0, 0],
|
||||||
|
[width, height],
|
||||||
|
])
|
||||||
|
.scaleExtent([0.25, 4])
|
||||||
|
.on("zoom", ({ transform }) => {
|
||||||
|
link.attr("transform", transform)
|
||||||
|
node.attr("transform", transform)
|
||||||
|
const scale = transform.k * opacityScale;
|
||||||
|
const scaledOpacity = Math.max((scale - 1) / 3.75, 0)
|
||||||
|
labels.attr("transform", transform).style("opacity", scaledOpacity)
|
||||||
|
}),
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
// progress the simulation
|
||||||
|
simulation.on("tick", () => {
|
||||||
|
link
|
||||||
|
.attr("x1", (d) => d.source.x)
|
||||||
|
.attr("y1", (d) => d.source.y)
|
||||||
|
.attr("x2", (d) => d.target.x)
|
||||||
|
.attr("y2", (d) => d.target.y)
|
||||||
|
node.attr("cx", (d) => d.x).attr("cy", (d) => d.y)
|
||||||
|
labels.attr("x", (d) => d.x).attr("y", (d) => d.y)
|
||||||
|
})
|
||||||
|
}
|
||||||
76
assets/js/popover.js
Normal file
76
assets/js/popover.js
Normal file
@@ -0,0 +1,76 @@
|
|||||||
|
function htmlToElement(html) {
|
||||||
|
const template = document.createElement("template")
|
||||||
|
html = html.trim()
|
||||||
|
template.innerHTML = html
|
||||||
|
return template.content.firstChild
|
||||||
|
}
|
||||||
|
|
||||||
|
function initPopover(baseURL, useContextualBacklinks, renderLatex) {
|
||||||
|
const basePath = baseURL.replace(window.location.origin, "")
|
||||||
|
fetchData.then(({ content }) => {
|
||||||
|
const links = [...document.getElementsByClassName("internal-link")]
|
||||||
|
links
|
||||||
|
.filter(li => li.dataset.src || (li.dataset.idx && useContextualBacklinks))
|
||||||
|
.forEach(li => {
|
||||||
|
var el
|
||||||
|
if (li.dataset.ctx) {
|
||||||
|
const linkDest = content[li.dataset.src]
|
||||||
|
const popoverElement = `<div class="popover">
|
||||||
|
<h3>${linkDest.title}</h3>
|
||||||
|
<p>${highlight(removeMarkdown(linkDest.content), li.dataset.ctx)}...</p>
|
||||||
|
<p class="meta">${new Date(linkDest.lastmodified).toLocaleDateString()}</p>
|
||||||
|
</div>`
|
||||||
|
el = htmlToElement(popoverElement)
|
||||||
|
} else {
|
||||||
|
const linkDest = content[li.dataset.src.replace(/\/$/g, "").replace(basePath, "")]
|
||||||
|
if (linkDest) {
|
||||||
|
let splitLink = li.href.split("#")
|
||||||
|
let cleanedContent = removeMarkdown(linkDest.content)
|
||||||
|
if (splitLink.length > 1) {
|
||||||
|
let headingName = splitLink[1].replace(/\-/g, " ")
|
||||||
|
let headingIndex = cleanedContent.toLowerCase().indexOf("<b>" + headingName + "</b>")
|
||||||
|
cleanedContent = cleanedContent.substring(headingIndex, cleanedContent.length)
|
||||||
|
}
|
||||||
|
const popoverElement = `<div class="popover">
|
||||||
|
<h3>${linkDest.title}</h3>
|
||||||
|
<p>${cleanedContent.split(" ", 20).join(" ")}...</p>
|
||||||
|
<p class="meta">${new Date(linkDest.lastmodified).toLocaleDateString()}</p>
|
||||||
|
</div>`
|
||||||
|
el = htmlToElement(popoverElement)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (el) {
|
||||||
|
li.appendChild(el)
|
||||||
|
if (renderLatex) {
|
||||||
|
renderMathInElement(el, {
|
||||||
|
delimiters: [
|
||||||
|
{ left: '$$', right: '$$', display: false },
|
||||||
|
{ left: '$', right: '$', display: false },
|
||||||
|
{ left: '\\(', right: '\\)', display: false },
|
||||||
|
{ left: '\\[', right: '\\]', display: false }
|
||||||
|
],
|
||||||
|
throwOnError: false
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
li.addEventListener("mouseover", () => {
|
||||||
|
// fix tooltip positioning
|
||||||
|
window.FloatingUIDOM.computePosition(li, el, {
|
||||||
|
middleware: [window.FloatingUIDOM.offset(10), window.FloatingUIDOM.inline(), window.FloatingUIDOM.shift()],
|
||||||
|
}).then(({ x, y }) => {
|
||||||
|
Object.assign(el.style, {
|
||||||
|
left: `${x}px`,
|
||||||
|
top: `${y}px`,
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
|
el.classList.add("visible")
|
||||||
|
})
|
||||||
|
li.addEventListener("mouseout", () => {
|
||||||
|
el.classList.remove("visible")
|
||||||
|
})
|
||||||
|
}
|
||||||
|
})
|
||||||
|
})
|
||||||
|
}
|
||||||
26
assets/js/router.js
Normal file
26
assets/js/router.js
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
import {
|
||||||
|
apply,
|
||||||
|
navigate,
|
||||||
|
prefetch,
|
||||||
|
router,
|
||||||
|
} from "https://unpkg.com/million@1.11.5/dist/router.mjs"
|
||||||
|
|
||||||
|
export const attachSPARouting = (init, rerender) => {
|
||||||
|
// Attach SPA functions to the global Million namespace
|
||||||
|
window.Million = {
|
||||||
|
apply,
|
||||||
|
navigate,
|
||||||
|
prefetch,
|
||||||
|
router,
|
||||||
|
}
|
||||||
|
|
||||||
|
const render = () => requestAnimationFrame(rerender)
|
||||||
|
|
||||||
|
window.addEventListener("DOMContentLoaded", () => {
|
||||||
|
apply((doc) => init(doc))
|
||||||
|
init()
|
||||||
|
router(".singlePage")
|
||||||
|
render()
|
||||||
|
})
|
||||||
|
window.addEventListener("million:navigate", render)
|
||||||
|
}
|
||||||
38
assets/js/semantic-search.js
Normal file
38
assets/js/semantic-search.js
Normal file
@@ -0,0 +1,38 @@
|
|||||||
|
const apiKey = "{{$.Site.Data.config.operandApiKey}}"
|
||||||
|
|
||||||
|
async function searchContents(query) {
|
||||||
|
const response = await fetch('https://prod.operand.ai/v3/search/objects', {
|
||||||
|
method: 'POST',
|
||||||
|
headers: {
|
||||||
|
'Content-Type': 'application/json',
|
||||||
|
Authorization: apiKey,
|
||||||
|
},
|
||||||
|
body: JSON.stringify({
|
||||||
|
query,
|
||||||
|
max: 10
|
||||||
|
}),
|
||||||
|
});
|
||||||
|
return (await response.json());
|
||||||
|
}
|
||||||
|
|
||||||
|
function debounce(func, timeout = 200) {
|
||||||
|
let timer;
|
||||||
|
return (...args) => {
|
||||||
|
clearTimeout(timer)
|
||||||
|
timer = setTimeout(() => { func.apply(this, args); }, timeout)
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
registerHandlers(debounce((e) => {
|
||||||
|
term = e.target.value
|
||||||
|
if (term !== "") {
|
||||||
|
searchContents(term)
|
||||||
|
.then((res) => res.results.map(entry => ({
|
||||||
|
url: entry.object.properties.url,
|
||||||
|
content: entry.snippet,
|
||||||
|
title: entry.object.metadata.title
|
||||||
|
})
|
||||||
|
))
|
||||||
|
.then(results => displayResults(results))
|
||||||
|
}
|
||||||
|
}))
|
||||||
209
assets/js/util.js
Normal file
209
assets/js/util.js
Normal file
@@ -0,0 +1,209 @@
|
|||||||
|
// code from https://github.com/danestves/markdown-to-text
|
||||||
|
const removeMarkdown = (
|
||||||
|
markdown,
|
||||||
|
options = {
|
||||||
|
listUnicodeChar: false,
|
||||||
|
stripListLeaders: true,
|
||||||
|
gfm: true,
|
||||||
|
useImgAltText: false,
|
||||||
|
preserveLinks: false,
|
||||||
|
},
|
||||||
|
) => {
|
||||||
|
let output = markdown || ""
|
||||||
|
output = output.replace(/^(-\s*?|\*\s*?|_\s*?){3,}\s*$/gm, "")
|
||||||
|
|
||||||
|
try {
|
||||||
|
if (options.stripListLeaders) {
|
||||||
|
if (options.listUnicodeChar)
|
||||||
|
output = output.replace(/^([\s\t]*)([\*\-\+]|\d+\.)\s+/gm, options.listUnicodeChar + " $1")
|
||||||
|
else output = output.replace(/^([\s\t]*)([\*\-\+]|\d+\.)\s+/gm, "$1")
|
||||||
|
}
|
||||||
|
if (options.gfm) {
|
||||||
|
output = output
|
||||||
|
.replace(/\n={2,}/g, "\n")
|
||||||
|
.replace(/~{3}.*\n/g, "")
|
||||||
|
.replace(/~~/g, "")
|
||||||
|
.replace(/`{3}.*\n/g, "")
|
||||||
|
}
|
||||||
|
if (options.preserveLinks) {
|
||||||
|
output = output.replace(/\[(.*?)\][\[\(](.*?)[\]\)]/g, "$1 ($2)")
|
||||||
|
}
|
||||||
|
output = output
|
||||||
|
.replace(/<[^>]*>/g, "")
|
||||||
|
.replace(/^[=\-]{2,}\s*$/g, "")
|
||||||
|
.replace(/\[\^.+?\](\: .*?$)?/g, "")
|
||||||
|
.replace(/(#{1,6})\s+(.+)\1?/g, "<b>$2</b>")
|
||||||
|
.replace(/\s{0,2}\[.*?\]: .*?$/g, "")
|
||||||
|
.replace(/\!\[(.*?)\][\[\(].*?[\]\)]/g, options.useImgAltText ? "$1" : "")
|
||||||
|
.replace(/\[(.*?)\][\[\(].*?[\]\)]/g, "<a>$1</a>")
|
||||||
|
.replace(/!?\[\[\S[^\[\]\|]*(?:\|([^\[\]]*))?\S\]\]/g, "<a>$1</a>")
|
||||||
|
.replace(/^\s{0,3}>\s?/g, "")
|
||||||
|
.replace(/(^|\n)\s{0,3}>\s?/g, "\n\n")
|
||||||
|
.replace(/^\s{1,2}\[(.*?)\]: (\S+)( ".*?")?\s*$/g, "")
|
||||||
|
.replace(/([\*_]{1,3})(\S.*?\S{0,1})\1/g, "$2")
|
||||||
|
.replace(/([\*_]{1,3})(\S.*?\S{0,1})\1/g, "$2")
|
||||||
|
.replace(/(`{3,})(.*?)\1/gm, "$2")
|
||||||
|
.replace(/`(.+?)`/g, "$1")
|
||||||
|
.replace(/\n{2,}/g, "\n\n")
|
||||||
|
.replace(/\[![a-zA-Z]+\][-\+]? /g, "")
|
||||||
|
} catch (e) {
|
||||||
|
console.error(e)
|
||||||
|
return markdown
|
||||||
|
}
|
||||||
|
return output
|
||||||
|
}
|
||||||
|
|
||||||
|
const highlight = (content, term) => {
|
||||||
|
const highlightWindow = 20
|
||||||
|
// try to find direct match first
|
||||||
|
const directMatchIdx = content.indexOf(term)
|
||||||
|
if (directMatchIdx !== -1) {
|
||||||
|
const h = highlightWindow
|
||||||
|
const before = content.substring(0, directMatchIdx).split(" ").slice(-h)
|
||||||
|
const after = content
|
||||||
|
.substring(directMatchIdx + term.length, content.length - 2)
|
||||||
|
.split(" ")
|
||||||
|
.slice(0, h)
|
||||||
|
return (
|
||||||
|
(before.length == h ? `...${before.join(" ")}` : before.join(" ")) +
|
||||||
|
`<span class="search-highlight">${term}</span>` +
|
||||||
|
after.join(" ")
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
const tokenizedTerm = term.split(/\s+/).filter((t) => t !== "")
|
||||||
|
const splitText = content.split(/\s+/).filter((t) => t !== "")
|
||||||
|
const includesCheck = (token) =>
|
||||||
|
tokenizedTerm.some((term) => token.toLowerCase().startsWith(term.toLowerCase()))
|
||||||
|
|
||||||
|
const occurrencesIndices = splitText.map(includesCheck)
|
||||||
|
|
||||||
|
// calculate best index
|
||||||
|
let bestSum = 0
|
||||||
|
let bestIndex = 0
|
||||||
|
for (let i = 0; i < Math.max(occurrencesIndices.length - highlightWindow, 0); i++) {
|
||||||
|
const window = occurrencesIndices.slice(i, i + highlightWindow)
|
||||||
|
const windowSum = window.reduce((total, cur) => total + cur, 0)
|
||||||
|
if (windowSum >= bestSum) {
|
||||||
|
bestSum = windowSum
|
||||||
|
bestIndex = i
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const startIndex = Math.max(bestIndex - highlightWindow, 0)
|
||||||
|
const endIndex = Math.min(startIndex + 2 * highlightWindow, splitText.length)
|
||||||
|
const mappedText = splitText
|
||||||
|
.slice(startIndex, endIndex)
|
||||||
|
.map((token) => {
|
||||||
|
if (includesCheck(token)) {
|
||||||
|
return `<span class="search-highlight">${token}</span>`
|
||||||
|
}
|
||||||
|
return token
|
||||||
|
})
|
||||||
|
.join(" ")
|
||||||
|
.replaceAll('</span> <span class="search-highlight">', " ")
|
||||||
|
return `${startIndex === 0 ? "" : "..."}${mappedText}${endIndex === splitText.length ? "" : "..."
|
||||||
|
}`
|
||||||
|
}
|
||||||
|
|
||||||
|
// Common utilities for search
|
||||||
|
const resultToHTML = ({ url, title, content }) => {
|
||||||
|
return `<button class="result-card" id="${url}">
|
||||||
|
<h3>${title}</h3>
|
||||||
|
<p>${content}</p>
|
||||||
|
</button>`
|
||||||
|
}
|
||||||
|
|
||||||
|
const redir = (id, term) => {
|
||||||
|
// SPA navigation
|
||||||
|
window.Million.navigate(
|
||||||
|
new URL(`${BASE_URL.replace(/\/$/g, "")}${id}#:~:text=${encodeURIComponent(term)}/`),
|
||||||
|
".singlePage",
|
||||||
|
)
|
||||||
|
closeSearch()
|
||||||
|
}
|
||||||
|
|
||||||
|
function openSearch() {
|
||||||
|
const source = document.getElementById("search-bar")
|
||||||
|
const results = document.getElementById("results-container")
|
||||||
|
const searchContainer = document.getElementById("search-container")
|
||||||
|
if (searchContainer.style.display === "none" || searchContainer.style.display === "") {
|
||||||
|
source.value = ""
|
||||||
|
results.innerHTML = ""
|
||||||
|
searchContainer.style.display = "block"
|
||||||
|
source.focus()
|
||||||
|
} else {
|
||||||
|
searchContainer.style.display = "none"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function closeSearch() {
|
||||||
|
const searchContainer = document.getElementById("search-container")
|
||||||
|
searchContainer.style.display = "none"
|
||||||
|
}
|
||||||
|
|
||||||
|
const registerHandlers = (onInputFn) => {
|
||||||
|
const source = document.getElementById("search-bar")
|
||||||
|
const searchContainer = document.getElementById("search-container")
|
||||||
|
let term
|
||||||
|
source.addEventListener("keyup", (e) => {
|
||||||
|
if (e.key === "Enter") {
|
||||||
|
const anchor = document.getElementsByClassName("result-card")[0]
|
||||||
|
redir(anchor.id, term)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
source.addEventListener("input", onInputFn)
|
||||||
|
document.addEventListener("keydown", (event) => {
|
||||||
|
if (event.key === "k" && (event.ctrlKey || event.metaKey)) {
|
||||||
|
event.preventDefault()
|
||||||
|
openSearch()
|
||||||
|
}
|
||||||
|
if (event.key === "Escape") {
|
||||||
|
event.preventDefault()
|
||||||
|
closeSearch()
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
const searchButton = document.getElementById("search-icon")
|
||||||
|
searchButton.addEventListener("click", (_) => {
|
||||||
|
openSearch()
|
||||||
|
})
|
||||||
|
searchButton.addEventListener("keydown", (_) => {
|
||||||
|
openSearch()
|
||||||
|
})
|
||||||
|
searchContainer.addEventListener("click", (_) => {
|
||||||
|
closeSearch()
|
||||||
|
})
|
||||||
|
document.getElementById("search-space").addEventListener("click", (evt) => {
|
||||||
|
evt.stopPropagation()
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
const displayResults = (finalResults, extractHighlight = false) => {
|
||||||
|
const results = document.getElementById("results-container")
|
||||||
|
if (finalResults.length === 0) {
|
||||||
|
results.innerHTML = `<button class="result-card">
|
||||||
|
<h3>No results.</h3>
|
||||||
|
<p>Try another search term?</p>
|
||||||
|
</button>`
|
||||||
|
} else {
|
||||||
|
results.innerHTML = finalResults
|
||||||
|
.map((result) => {
|
||||||
|
if (extractHighlight) {
|
||||||
|
return resultToHTML({
|
||||||
|
url: result.url,
|
||||||
|
title: highlight(result.title, term),
|
||||||
|
content: highlight(removeMarkdown(result.content), term)
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
return resultToHTML(result)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
)
|
||||||
|
.join("\n")
|
||||||
|
const anchors = [...document.getElementsByClassName("result-card")]
|
||||||
|
anchors.forEach((anchor) => {
|
||||||
|
anchor.onclick = () => redir(anchor.id, term)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
170
assets/styles/_callouts.scss
Normal file
170
assets/styles/_callouts.scss
Normal file
@@ -0,0 +1,170 @@
|
|||||||
|
:root {
|
||||||
|
--callout-summary: #00b0ff;
|
||||||
|
--callout-summary-accent: #7fd7ff;
|
||||||
|
--callout-bug: #f50057;
|
||||||
|
--callout-bug-accent: #ff7aa9;
|
||||||
|
--callout-danger: #ff1744;
|
||||||
|
--callout-danger-accent: #ff8aa1;
|
||||||
|
--callout-example: #7c4dff;
|
||||||
|
--callout-example-accent: #bda5ff;
|
||||||
|
--callout-fail: #ff5252;
|
||||||
|
--callout-fail-accent: #ffa8a8;
|
||||||
|
--callout-info: #00b8d4;
|
||||||
|
--callout-info-accent: #69ebff;
|
||||||
|
--callout-note: #448aff;
|
||||||
|
--callout-note-accent: #a1c4ff;
|
||||||
|
--callout-question: #64dd17;
|
||||||
|
--callout-question-accent: #b0f286;
|
||||||
|
--callout-quote: #9e9e9e;
|
||||||
|
--callout-quote-accent: #cecece;
|
||||||
|
--callout-done: #00c853;
|
||||||
|
--callout-done-accent: #63ffa4;
|
||||||
|
--callout-important: #00bfa5;
|
||||||
|
--callout-important-accent: #5fffe9;
|
||||||
|
--callout-warning: #ff9100;
|
||||||
|
--callout-warning-accent: #ffc87f;
|
||||||
|
}
|
||||||
|
|
||||||
|
[saved-theme=dark] {
|
||||||
|
--callout-summary: #00b0ff !important;
|
||||||
|
--callout-summary-accent: #00587f !important;
|
||||||
|
--callout-bug: #f50057 !important;
|
||||||
|
--callout-bug-accent: #7a002b !important;
|
||||||
|
--callout-danger: #ff1744 !important;
|
||||||
|
--callout-danger-accent: #8b001a !important;
|
||||||
|
--callout-example: #7c4dff !important;
|
||||||
|
--callout-example-accent: #2b00a6 !important;
|
||||||
|
--callout-fail: #ff5252 !important;
|
||||||
|
--callout-fail-accent: #a80000 !important;
|
||||||
|
--callout-info: #00b8d4 !important;
|
||||||
|
--callout-info-accent: #005c6a !important;
|
||||||
|
--callout-note: #448aff !important;
|
||||||
|
--callout-note-accent: #003ca1 !important;
|
||||||
|
--callout-question: #64dd17 !important;
|
||||||
|
--callout-question-accent: #006429 !important;
|
||||||
|
--callout-quote: #9e9e9e !important;
|
||||||
|
--callout-quote-accent: #4f4f4f !important;
|
||||||
|
--callout-done: #00c853 !important;
|
||||||
|
--callout-done-accent: #006429 !important;
|
||||||
|
--callout-important: #00bfa5 !important;
|
||||||
|
--callout-important-accent: #005f52 !important;
|
||||||
|
--callout-warning: #ff9100 !important;
|
||||||
|
--callout-warning-accent: #7f4800 !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
blockquote.callout-collapsible {
|
||||||
|
cursor: pointer;
|
||||||
|
|
||||||
|
&.callout-collapsible::after {
|
||||||
|
content: '-';
|
||||||
|
right: 6px;
|
||||||
|
font-weight: bolder;
|
||||||
|
font-family: Courier New, Courier, monospace;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
blockquote.callout-collapsed {
|
||||||
|
& > p { border-bottom-right-radius: 5px !important; }
|
||||||
|
padding-bottom: 0 !important;
|
||||||
|
&::after {
|
||||||
|
content: '+' !important;
|
||||||
|
}
|
||||||
|
& > *:not(:first-child) {
|
||||||
|
display: none !important;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
blockquote[class*="-callout"] {
|
||||||
|
margin-right: 0;
|
||||||
|
border-radius: 5px;
|
||||||
|
position: relative;
|
||||||
|
padding-left: 0 !important;
|
||||||
|
padding-bottom: 0.25em;
|
||||||
|
color: var(--dark);
|
||||||
|
background-color: var(--lightgray);
|
||||||
|
border-left: 6px solid var(--primary) !important;
|
||||||
|
& > p {
|
||||||
|
border-top-right-radius: 5px;
|
||||||
|
padding: 0.5em 1em;
|
||||||
|
margin: 0;
|
||||||
|
color: var(--gray);
|
||||||
|
&:first-child {
|
||||||
|
font-weight: 600;
|
||||||
|
color: var(--dark);
|
||||||
|
padding: 0.4em 30px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
blockquote[class*="-callout"] > p:first-child::after, blockquote.callout-collapsible::after {
|
||||||
|
display: inline-block;
|
||||||
|
height: 18px;
|
||||||
|
width: 18px;
|
||||||
|
position: absolute;
|
||||||
|
top: 0.4em;
|
||||||
|
margin: 0.2em 0.4em;
|
||||||
|
}
|
||||||
|
|
||||||
|
blockquote[class*="-callout"] > p:first-child {
|
||||||
|
font-weight: bold;
|
||||||
|
padding: 0.4em 35px;
|
||||||
|
|
||||||
|
&::after {
|
||||||
|
left: 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$summary: summary, abstract, tldr;
|
||||||
|
$bug: bug;
|
||||||
|
$danger: danger, error;
|
||||||
|
$example: example;
|
||||||
|
$fail: fail, failure, missing;
|
||||||
|
$info: info, todo;
|
||||||
|
$note: note;
|
||||||
|
$question: question, help, faq;
|
||||||
|
$quote: quote, cite;
|
||||||
|
$done: done, success, check;
|
||||||
|
$important: important, tip, hint;
|
||||||
|
$warning: warning, caution, attention;
|
||||||
|
$types: $summary, $bug, $danger, $example, $fail, $info, $note, $question, $quote, $done, $important, $warning;
|
||||||
|
$svgs: ();
|
||||||
|
$svgs: map-merge($svgs, ($summary: url("data:image/svg+xml,%3Csvg aria-hidden='true' focusable='false' data-icon='book' class='svg-inline--callout-fa fa-book fa-w-14' role='img' xmlns='http://www.w3.org/2000/svg' viewBox='0 0 448 512'%3E%3Cpath fill='currentColor' d='M448 360V24c0-13.3-10.7-24-24-24H96C43 0 0 43 0 96v320c0 53 43 96 96 96h328c13.3 0 24-10.7 24-24v-16c0-7.5-3.5-14.3-8.9-18.7-4.2-15.4-4.2-59.3 0-74.7 5.4-4.3 8.9-11.1 8.9-18.6zM128 134c0-3.3 2.7-6 6-6h212c3.3 0 6 2.7 6 6v20c0 3.3-2.7 6-6 6H134c-3.3 0-6-2.7-6-6v-20zm0 64c0-3.3 2.7-6 6-6h212c3.3 0 6 2.7 6 6v20c0 3.3-2.7 6-6 6H134c-3.3 0-6-2.7-6-6v-20zm253.4 250H96c-17.7 0-32-14.3-32-32 0-17.6 14.4-32 32-32h285.4c-1.9 17.1-1.9 46.9 0 64z'%3E%3C/path%3E%3C/svg%3E")));
|
||||||
|
$svgs: map-merge($svgs, ($bug: url("data:image/svg+xml,%3Csvg aria-hidden='true' focusable='false' data-icon='bug' class='svg-inline--callout-fa fa-bug fa-w-16' role='img' xmlns='http://www.w3.org/2000/svg' viewBox='0 0 512 512'%3E%3Cpath fill='currentColor' d='M511.988 288.9c-.478 17.43-15.217 31.1-32.653 31.1H424v16c0 21.864-4.882 42.584-13.6 61.145l60.228 60.228c12.496 12.497 12.496 32.758 0 45.255-12.498 12.497-32.759 12.496-45.256 0l-54.736-54.736C345.886 467.965 314.351 480 280 480V236c0-6.627-5.373-12-12-12h-24c-6.627 0-12 5.373-12 12v244c-34.351 0-65.886-12.035-90.636-32.108l-54.736 54.736c-12.498 12.497-32.759 12.496-45.256 0-12.496-12.497-12.496-32.758 0-45.255l60.228-60.228C92.882 378.584 88 357.864 88 336v-16H32.666C15.23 320 .491 306.33.013 288.9-.484 270.816 14.028 256 32 256h56v-58.745l-46.628-46.628c-12.496-12.497-12.496-32.758 0-45.255 12.498-12.497 32.758-12.497 45.256 0L141.255 160h229.489l54.627-54.627c12.498-12.497 32.758-12.497 45.256 0 12.496 12.497 12.496 32.758 0 45.255L424 197.255V256h56c17.972 0 32.484 14.816 31.988 32.9zM257 0c-61.856 0-112 50.144-112 112h224C369 50.144 318.856 0 257 0z'%3E%3C/path%3E%3C/svg%3E")));
|
||||||
|
$svgs: map-merge($svgs, ($danger: url("data:image/svg+xml,%3Csvg aria-hidden='true' focusable='false' data-icon='bolt' class='svg-inline--callout-fa fa-bolt fa-w-10' role='img' xmlns='http://www.w3.org/2000/svg' viewBox='0 0 320 512'%3E%3Cpath fill='currentColor' d='M296 160H180.6l42.6-129.8C227.2 15 215.7 0 200 0H56C44 0 33.8 8.9 32.2 20.8l-32 240C-1.7 275.2 9.5 288 24 288h118.7L96.6 482.5c-3.6 15.2 8 29.5 23.3 29.5 8.4 0 16.4-4.4 20.8-12l176-304c9.3-15.9-2.2-36-20.7-36z'%3E%3C/path%3E%3C/svg%3E")));
|
||||||
|
$svgs: map-merge($svgs, ($example: url("data:image/svg+xml,%3Csvg aria-hidden='true' focusable='false' data-icon='list-ol' class='svg-inline--callout-fa fa-list-ol fa-w-16' role='img' xmlns='http://www.w3.org/2000/svg' viewBox='0 0 512 512'%3E%3Cpath fill='currentColor' d='M61.77 401l17.5-20.15a19.92 19.92 0 0 0 5.07-14.19v-3.31C84.34 356 80.5 352 73 352H16a8 8 0 0 0-8 8v16a8 8 0 0 0 8 8h22.83a157.41 157.41 0 0 0-11 12.31l-5.61 7c-4 5.07-5.25 10.13-2.8 14.88l1.05 1.93c3 5.76 6.29 7.88 12.25 7.88h4.73c10.33 0 15.94 2.44 15.94 9.09 0 4.72-4.2 8.22-14.36 8.22a41.54 41.54 0 0 1-15.47-3.12c-6.49-3.88-11.74-3.5-15.6 3.12l-5.59 9.31c-3.72 6.13-3.19 11.72 2.63 15.94 7.71 4.69 20.38 9.44 37 9.44 34.16 0 48.5-22.75 48.5-44.12-.03-14.38-9.12-29.76-28.73-34.88zM496 224H176a16 16 0 0 0-16 16v32a16 16 0 0 0 16 16h320a16 16 0 0 0 16-16v-32a16 16 0 0 0-16-16zm0-160H176a16 16 0 0 0-16 16v32a16 16 0 0 0 16 16h320a16 16 0 0 0 16-16V80a16 16 0 0 0-16-16zm0 320H176a16 16 0 0 0-16 16v32a16 16 0 0 0 16 16h320a16 16 0 0 0 16-16v-32a16 16 0 0 0-16-16zM16 160h64a8 8 0 0 0 8-8v-16a8 8 0 0 0-8-8H64V40a8 8 0 0 0-8-8H32a8 8 0 0 0-7.14 4.42l-8 16A8 8 0 0 0 24 64h8v64H16a8 8 0 0 0-8 8v16a8 8 0 0 0 8 8zm-3.91 160H80a8 8 0 0 0 8-8v-16a8 8 0 0 0-8-8H41.32c3.29-10.29 48.34-18.68 48.34-56.44 0-29.06-25-39.56-44.47-39.56-21.36 0-33.8 10-40.46 18.75-4.37 5.59-3 10.84 2.8 15.37l8.58 6.88c5.61 4.56 11 2.47 16.12-2.44a13.44 13.44 0 0 1 9.46-3.84c3.33 0 9.28 1.56 9.28 8.75C51 248.19 0 257.31 0 304.59v4C0 316 5.08 320 12.09 320z'%3E%3C/path%3E%3C/svg%3E")));
|
||||||
|
$svgs: map-merge($svgs, ($fail: url("data:image/svg+xml,%3Csvg aria-hidden='true' focusable='false' data-icon='times-circle' class='svg-inline--callout-fa fa-times-circle fa-w-16' role='img' xmlns='http://www.w3.org/2000/svg' viewBox='0 0 512 512'%3E%3Cpath fill='currentColor' d='M256 8C119 8 8 119 8 256s111 248 248 248 248-111 248-248S393 8 256 8zm121.6 313.1c4.7 4.7 4.7 12.3 0 17L338 377.6c-4.7 4.7-12.3 4.7-17 0L256 312l-65.1 65.6c-4.7 4.7-12.3 4.7-17 0L134.4 338c-4.7-4.7-4.7-12.3 0-17l65.6-65-65.6-65.1c-4.7-4.7-4.7-12.3 0-17l39.6-39.6c4.7-4.7 12.3-4.7 17 0l65 65.7 65.1-65.6c4.7-4.7 12.3-4.7 17 0l39.6 39.6c4.7 4.7 4.7 12.3 0 17L312 256l65.6 65.1z'%3E%3C/path%3E%3C/svg%3E")));
|
||||||
|
$svgs: map-merge($svgs, ($info: url("data:image/svg+xml,%3Csvg aria-hidden='true' focusable='false' data-icon='info-circle' class='svg-inline--callout-fa fa-info-circle fa-w-16' role='img' xmlns='http://www.w3.org/2000/svg' viewBox='0 0 512 512'%3E%3Cpath fill='currentColor' d='M256 8C119.043 8 8 119.083 8 256c0 136.997 111.043 248 248 248s248-111.003 248-248C504 119.083 392.957 8 256 8zm0 110c23.196 0 42 18.804 42 42s-18.804 42-42 42-42-18.804-42-42 18.804-42 42-42zm56 254c0 6.627-5.373 12-12 12h-88c-6.627 0-12-5.373-12-12v-24c0-6.627 5.373-12 12-12h12v-64h-12c-6.627 0-12-5.373-12-12v-24c0-6.627 5.373-12 12-12h64c6.627 0 12 5.373 12 12v100h12c6.627 0 12 5.373 12 12v24z'%3E%3C/path%3E%3C/svg%3E")));
|
||||||
|
$svgs: map-merge($svgs, ($note: url("data:image/svg+xml,%3Csvg aria-hidden='true' focusable='false' data-icon='pencil-alt' class='svg-inline--callout-fa fa-pencil-alt fa-w-16' role='img' xmlns='http://www.w3.org/2000/svg' viewBox='0 0 512 512'%3E%3Cpath fill='currentColor' d='M497.9 142.1l-46.1 46.1c-4.7 4.7-12.3 4.7-17 0l-111-111c-4.7-4.7-4.7-12.3 0-17l46.1-46.1c18.7-18.7 49.1-18.7 67.9 0l60.1 60.1c18.8 18.7 18.8 49.1 0 67.9zM284.2 99.8L21.6 362.4.4 483.9c-2.9 16.4 11.4 30.6 27.8 27.8l121.5-21.3 262.6-262.6c4.7-4.7 4.7-12.3 0-17l-111-111c-4.8-4.7-12.4-4.7-17.1 0zM124.1 339.9c-5.5-5.5-5.5-14.3 0-19.8l154-154c5.5-5.5 14.3-5.5 19.8 0s5.5 14.3 0 19.8l-154 154c-5.5 5.5-14.3 5.5-19.8 0zM88 424h48v36.3l-64.5 11.3-31.1-31.1L51.7 376H88v48z'%3E%3C/path%3E%3C/svg%3E")));
|
||||||
|
$svgs: map-merge($svgs, ($question: url("data:image/svg+xml,%3Csvg aria-hidden='true' focusable='false' data-icon='question-circle' class='svg-inline--callout-fa fa-question-circle fa-w-16' role='img' xmlns='http://www.w3.org/2000/svg' viewBox='0 0 512 512'%3E%3Cpath fill='currentColor' d='M504 256c0 136.997-111.043 248-248 248S8 392.997 8 256C8 119.083 119.043 8 256 8s248 111.083 248 248zM262.655 90c-54.497 0-89.255 22.957-116.549 63.758-3.536 5.286-2.353 12.415 2.715 16.258l34.699 26.31c5.205 3.947 12.621 3.008 16.665-2.122 17.864-22.658 30.113-35.797 57.303-35.797 20.429 0 45.698 13.148 45.698 32.958 0 14.976-12.363 22.667-32.534 33.976C247.128 238.528 216 254.941 216 296v4c0 6.627 5.373 12 12 12h56c6.627 0 12-5.373 12-12v-1.333c0-28.462 83.186-29.647 83.186-106.667 0-58.002-60.165-102-116.531-102zM256 338c-25.365 0-46 20.635-46 46 0 25.364 20.635 46 46 46s46-20.636 46-46c0-25.365-20.635-46-46-46z'%3E%3C/path%3E%3C/svg%3E")));
|
||||||
|
$svgs: map-merge($svgs, ($quote: url("data:image/svg+xml,%3Csvg aria-hidden='true' focusable='false' data-icon='quote-right' class='svg-inline--callout-fa fa-quote-right fa-w-16' role='img' xmlns='http://www.w3.org/2000/svg' viewBox='0 0 512 512'%3E%3Cpath fill='currentColor' d='M464 32H336c-26.5 0-48 21.5-48 48v128c0 26.5 21.5 48 48 48h80v64c0 35.3-28.7 64-64 64h-8c-13.3 0-24 10.7-24 24v48c0 13.3 10.7 24 24 24h8c88.4 0 160-71.6 160-160V80c0-26.5-21.5-48-48-48zm-288 0H48C21.5 32 0 53.5 0 80v128c0 26.5 21.5 48 48 48h80v64c0 35.3-28.7 64-64 64h-8c-13.3 0-24 10.7-24 24v48c0 13.3 10.7 24 24 24h8c88.4 0 160-71.6 160-160V80c0-26.5-21.5-48-48-48z'%3E%3C/path%3E%3C/svg%3E")));
|
||||||
|
$svgs: map-merge($svgs, ($done: url("data:image/svg+xml,%3Csvg aria-hidden='true' focusable='false' data-icon='check-circle' class='svg-inline--callout-fa fa-check-circle fa-w-16' role='img' xmlns='http://www.w3.org/2000/svg' viewBox='0 0 512 512'%3E%3Cpath fill='currentColor' d='M504 256c0 136.967-111.033 248-248 248S8 392.967 8 256 119.033 8 256 8s248 111.033 248 248zM227.314 387.314l184-184c6.248-6.248 6.248-16.379 0-22.627l-22.627-22.627c-6.248-6.249-16.379-6.249-22.628 0L216 308.118l-70.059-70.059c-6.248-6.248-16.379-6.248-22.628 0l-22.627 22.627c-6.248 6.248-6.248 16.379 0 22.627l104 104c6.249 6.249 16.379 6.249 22.628.001z'%3E%3C/path%3E%3C/svg%3E")));
|
||||||
|
$svgs: map-merge($svgs, ($important: url("data:image/svg+xml,%3Csvg aria-hidden='true' focusable='false' data-icon='fire' class='svg-inline--callout-fa fa-fire fa-w-12' role='img' xmlns='http://www.w3.org/2000/svg' viewBox='0 0 384 512'%3E%3Cpath fill='currentColor' d='M216 23.86c0-23.8-30.65-32.77-44.15-13.04C48 191.85 224 200 224 288c0 35.63-29.11 64.46-64.85 63.99-35.17-.45-63.15-29.77-63.15-64.94v-85.51c0-21.7-26.47-32.23-41.43-16.5C27.8 213.16 0 261.33 0 320c0 105.87 86.13 192 192 192s192-86.13 192-192c0-170.29-168-193-168-296.14z'%3E%3C/path%3E%3C/svg%3E")));
|
||||||
|
$svgs: map-merge($svgs, ($warning: url("data:image/svg+xml,%3Csvg aria-hidden='true' focusable='false' data-icon='exclamation-triangle' class='svg-inline--callout-fa fa-exclamation-triangle fa-w-18' role='img' xmlns='http://www.w3.org/2000/svg' viewBox='0 0 576 512'%3E%3Cpath fill='currentColor' d='M569.517 440.013C587.975 472.007 564.806 512 527.94 512H48.054c-36.937 0-59.999-40.055-41.577-71.987L246.423 23.985c18.467-32.009 64.72-31.951 83.154 0l239.94 416.028zM288 354c-25.405 0-46 20.595-46 46s20.595 46 46 46 46-20.595 46-46-20.595-46-46-46zm-43.673-165.346l7.418 136c.347 6.364 5.609 11.346 11.982 11.346h48.546c6.373 0 11.635-4.982 11.982-11.346l7.418-136c.375-6.874-5.098-12.654-11.982-12.654h-63.383c-6.884 0-12.356 5.78-11.981 12.654z'%3E%3C/path%3E%3C/svg%3E")));
|
||||||
|
|
||||||
|
@function getstr($l) {
|
||||||
|
$v: nth($l, 1);
|
||||||
|
@return $v;
|
||||||
|
}
|
||||||
|
|
||||||
|
@each $type in $types {
|
||||||
|
@each $s in $type {
|
||||||
|
blockquote.#{$s}-callout {
|
||||||
|
border-left: 6px solid var(--callout-#{getstr($type)}) !important;
|
||||||
|
& > p:first-child {
|
||||||
|
background-color: var(--callout-#{getstr($type)}-accent) !important;
|
||||||
|
&::after {
|
||||||
|
content: '';
|
||||||
|
-webkit-mask: map-get($svgs, $type);
|
||||||
|
mask: map-get($svgs, $type);
|
||||||
|
background-color: var(--callout-#{getstr($type)}) !important;
|
||||||
|
-webkit-mask-size: contain;
|
||||||
|
mask-size: contain;
|
||||||
|
-webkit-mask-repeat: no-repeat;
|
||||||
|
mask-repeat: no-repeat;
|
||||||
|
-webkit-mask-position: center;
|
||||||
|
mask-position: center;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,11 +1,14 @@
|
|||||||
/* Background */ .chroma { color: #f8f8f2; background-color: #282a36; overflow: hidden }
|
/* Background */ .bg { color: #f8f8f2; background-color: #282a36; }
|
||||||
|
/* PreWrapper */ .chroma { color: #f8f8f2; background-color: #282a36; }
|
||||||
/* Other */ .chroma .x { }
|
/* Other */ .chroma .x { }
|
||||||
/* Error */ .chroma .err { }
|
/* Error */ .chroma .err { }
|
||||||
|
/* CodeLine */ .chroma .cl { }
|
||||||
/* LineTableTD */ .chroma .lntd { vertical-align: top; padding: 0; margin: 0; border: 0; }
|
/* LineTableTD */ .chroma .lntd { vertical-align: top; padding: 0; margin: 0; border: 0; }
|
||||||
/* LineTable */ .chroma .lntable { border-spacing: 0; padding: 0; margin: 0; border: 0; width: auto; overflow: auto; display: block; }
|
/* LineTable */ .chroma .lntable { border-spacing: 0; padding: 0; margin: 0; border: 0; }
|
||||||
/* LineHighlight */ .chroma .hl { display: block; width: 100%;background-color: #ffffcc }
|
/* LineHighlight */ .chroma .hl { background-color: #ffffcc }
|
||||||
/* LineNumbersTable */ .chroma .lnt { margin-right: 0.4em; padding: 0 0.4em 0 0.4em;color: #7f7f7f }
|
/* LineNumbersTable */ .chroma .lnt { white-space: pre; user-select: none; margin-right: 0.4em; padding: 0 0.4em 0 0.4em;color: #7f7f7f }
|
||||||
/* LineNumbers */ .chroma .ln { margin-right: 0.4em; padding: 0 0.4em 0 0.4em;color: #7f7f7f }
|
/* LineNumbers */ .chroma .ln { white-space: pre; user-select: none; margin-right: 0.4em; padding: 0 0.4em 0 0.4em;color: #7f7f7f }
|
||||||
|
/* Line */ .chroma .line { display: flex; }
|
||||||
/* Keyword */ .chroma .k { color: #ff79c6 }
|
/* Keyword */ .chroma .k { color: #ff79c6 }
|
||||||
/* KeywordConstant */ .chroma .kc { color: #ff79c6 }
|
/* KeywordConstant */ .chroma .kc { color: #ff79c6 }
|
||||||
/* KeywordDeclaration */ .chroma .kd { color: #8be9fd; font-style: italic }
|
/* KeywordDeclaration */ .chroma .kd { color: #8be9fd; font-style: italic }
|
||||||
@@ -68,11 +71,11 @@
|
|||||||
/* CommentPreproc */ .chroma .cp { color: #ff79c6 }
|
/* CommentPreproc */ .chroma .cp { color: #ff79c6 }
|
||||||
/* CommentPreprocFile */ .chroma .cpf { color: #ff79c6 }
|
/* CommentPreprocFile */ .chroma .cpf { color: #ff79c6 }
|
||||||
/* Generic */ .chroma .g { }
|
/* Generic */ .chroma .g { }
|
||||||
/* GenericDeleted */ .chroma .gd { color: #8b080b }
|
/* GenericDeleted */ .chroma .gd { color: #ff5555 }
|
||||||
/* GenericEmph */ .chroma .ge { text-decoration: underline }
|
/* GenericEmph */ .chroma .ge { text-decoration: underline }
|
||||||
/* GenericError */ .chroma .gr { }
|
/* GenericError */ .chroma .gr { }
|
||||||
/* GenericHeading */ .chroma .gh { font-weight: bold }
|
/* GenericHeading */ .chroma .gh { font-weight: bold }
|
||||||
/* GenericInserted */ .chroma .gi { font-weight: bold }
|
/* GenericInserted */ .chroma .gi { color: #50fa7b; font-weight: bold }
|
||||||
/* GenericOutput */ .chroma .go { color: #44475a }
|
/* GenericOutput */ .chroma .go { color: #44475a }
|
||||||
/* GenericPrompt */ .chroma .gp { }
|
/* GenericPrompt */ .chroma .gp { }
|
||||||
/* GenericStrong */ .chroma .gs { }
|
/* GenericStrong */ .chroma .gs { }
|
||||||
@@ -80,20 +83,3 @@
|
|||||||
/* GenericTraceback */ .chroma .gt { }
|
/* GenericTraceback */ .chroma .gt { }
|
||||||
/* GenericUnderline */ .chroma .gl { text-decoration: underline }
|
/* GenericUnderline */ .chroma .gl { text-decoration: underline }
|
||||||
/* TextWhitespace */ .chroma .w { }
|
/* TextWhitespace */ .chroma .w { }
|
||||||
|
|
||||||
.lntd:first-of-type > .chroma {
|
|
||||||
padding-right: 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
.chroma code {
|
|
||||||
font-family: 'Fira Code' !important;
|
|
||||||
font-size: 0.85em;
|
|
||||||
line-height: 1em;
|
|
||||||
background: none;
|
|
||||||
padding: 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
.chroma {
|
|
||||||
border-radius: 3px;
|
|
||||||
margin: 0;
|
|
||||||
}
|
|
||||||
85
assets/styles/_light_syntax.scss
Normal file
85
assets/styles/_light_syntax.scss
Normal file
@@ -0,0 +1,85 @@
|
|||||||
|
/* Background */ .bg { color: #272822; background-color: #fafafa; }
|
||||||
|
/* PreWrapper */ .chroma { color: #272822; background-color: #fafafa; }
|
||||||
|
/* Other */ .chroma .x { }
|
||||||
|
/* Error */ .chroma .err { }
|
||||||
|
/* CodeLine */ .chroma .cl { }
|
||||||
|
/* LineTableTD */ .chroma .lntd { vertical-align: top; padding: 0; margin: 0; border: 0; }
|
||||||
|
/* LineTable */ .chroma .lntable { border-spacing: 0; padding: 0; margin: 0; border: 0; }
|
||||||
|
/* LineHighlight */ .chroma .hl { background-color: #ffffcc }
|
||||||
|
/* LineNumbersTable */ .chroma .lnt { white-space: pre; user-select: none; margin-right: 0.4em; padding: 0 0.4em 0 0.4em;color: #7f7f7f }
|
||||||
|
/* LineNumbers */ .chroma .ln { white-space: pre; user-select: none; margin-right: 0.4em; padding: 0 0.4em 0 0.4em;color: #7f7f7f }
|
||||||
|
/* Line */ .chroma .line { display: flex; }
|
||||||
|
/* Keyword */ .chroma .k { color: #00a8c8 }
|
||||||
|
/* KeywordConstant */ .chroma .kc { color: #00a8c8 }
|
||||||
|
/* KeywordDeclaration */ .chroma .kd { color: #00a8c8 }
|
||||||
|
/* KeywordNamespace */ .chroma .kn { color: #f92672 }
|
||||||
|
/* KeywordPseudo */ .chroma .kp { color: #00a8c8 }
|
||||||
|
/* KeywordReserved */ .chroma .kr { color: #00a8c8 }
|
||||||
|
/* KeywordType */ .chroma .kt { color: #00a8c8 }
|
||||||
|
/* Name */ .chroma .n { color: #111111 }
|
||||||
|
/* NameAttribute */ .chroma .na { color: #75af00 }
|
||||||
|
/* NameBuiltin */ .chroma .nb { color: #111111 }
|
||||||
|
/* NameBuiltinPseudo */ .chroma .bp { color: #111111 }
|
||||||
|
/* NameClass */ .chroma .nc { color: #75af00 }
|
||||||
|
/* NameConstant */ .chroma .no { color: #00a8c8 }
|
||||||
|
/* NameDecorator */ .chroma .nd { color: #75af00 }
|
||||||
|
/* NameEntity */ .chroma .ni { color: #111111 }
|
||||||
|
/* NameException */ .chroma .ne { color: #75af00 }
|
||||||
|
/* NameFunction */ .chroma .nf { color: #75af00 }
|
||||||
|
/* NameFunctionMagic */ .chroma .fm { color: #111111 }
|
||||||
|
/* NameLabel */ .chroma .nl { color: #111111 }
|
||||||
|
/* NameNamespace */ .chroma .nn { color: #111111 }
|
||||||
|
/* NameOther */ .chroma .nx { color: #75af00 }
|
||||||
|
/* NameProperty */ .chroma .py { color: #111111 }
|
||||||
|
/* NameTag */ .chroma .nt { color: #f92672 }
|
||||||
|
/* NameVariable */ .chroma .nv { color: #111111 }
|
||||||
|
/* NameVariableClass */ .chroma .vc { color: #111111 }
|
||||||
|
/* NameVariableGlobal */ .chroma .vg { color: #111111 }
|
||||||
|
/* NameVariableInstance */ .chroma .vi { color: #111111 }
|
||||||
|
/* NameVariableMagic */ .chroma .vm { color: #111111 }
|
||||||
|
/* Literal */ .chroma .l { color: #ae81ff }
|
||||||
|
/* LiteralDate */ .chroma .ld { color: #d88200 }
|
||||||
|
/* LiteralString */ .chroma .s { color: #d88200 }
|
||||||
|
/* LiteralStringAffix */ .chroma .sa { color: #d88200 }
|
||||||
|
/* LiteralStringBacktick */ .chroma .sb { color: #d88200 }
|
||||||
|
/* LiteralStringChar */ .chroma .sc { color: #d88200 }
|
||||||
|
/* LiteralStringDelimiter */ .chroma .dl { color: #d88200 }
|
||||||
|
/* LiteralStringDoc */ .chroma .sd { color: #d88200 }
|
||||||
|
/* LiteralStringDouble */ .chroma .s2 { color: #d88200 }
|
||||||
|
/* LiteralStringEscape */ .chroma .se { color: #8045ff }
|
||||||
|
/* LiteralStringHeredoc */ .chroma .sh { color: #d88200 }
|
||||||
|
/* LiteralStringInterpol */ .chroma .si { color: #d88200 }
|
||||||
|
/* LiteralStringOther */ .chroma .sx { color: #d88200 }
|
||||||
|
/* LiteralStringRegex */ .chroma .sr { color: #d88200 }
|
||||||
|
/* LiteralStringSingle */ .chroma .s1 { color: #d88200 }
|
||||||
|
/* LiteralStringSymbol */ .chroma .ss { color: #d88200 }
|
||||||
|
/* LiteralNumber */ .chroma .m { color: #ae81ff }
|
||||||
|
/* LiteralNumberBin */ .chroma .mb { color: #ae81ff }
|
||||||
|
/* LiteralNumberFloat */ .chroma .mf { color: #ae81ff }
|
||||||
|
/* LiteralNumberHex */ .chroma .mh { color: #ae81ff }
|
||||||
|
/* LiteralNumberInteger */ .chroma .mi { color: #ae81ff }
|
||||||
|
/* LiteralNumberIntegerLong */ .chroma .il { color: #ae81ff }
|
||||||
|
/* LiteralNumberOct */ .chroma .mo { color: #ae81ff }
|
||||||
|
/* Operator */ .chroma .o { color: #f92672 }
|
||||||
|
/* OperatorWord */ .chroma .ow { color: #f92672 }
|
||||||
|
/* Punctuation */ .chroma .p { color: #111111 }
|
||||||
|
/* Comment */ .chroma .c { color: #75715e }
|
||||||
|
/* CommentHashbang */ .chroma .ch { color: #75715e }
|
||||||
|
/* CommentMultiline */ .chroma .cm { color: #75715e }
|
||||||
|
/* CommentSingle */ .chroma .c1 { color: #75715e }
|
||||||
|
/* CommentSpecial */ .chroma .cs { color: #75715e }
|
||||||
|
/* CommentPreproc */ .chroma .cp { color: #75715e }
|
||||||
|
/* CommentPreprocFile */ .chroma .cpf { color: #75715e }
|
||||||
|
/* Generic */ .chroma .g { }
|
||||||
|
/* GenericDeleted */ .chroma .gd { }
|
||||||
|
/* GenericEmph */ .chroma .ge { font-style: italic }
|
||||||
|
/* GenericError */ .chroma .gr { }
|
||||||
|
/* GenericHeading */ .chroma .gh { }
|
||||||
|
/* GenericInserted */ .chroma .gi { }
|
||||||
|
/* GenericOutput */ .chroma .go { }
|
||||||
|
/* GenericPrompt */ .chroma .gp { }
|
||||||
|
/* GenericStrong */ .chroma .gs { font-weight: bold }
|
||||||
|
/* GenericSubheading */ .chroma .gu { }
|
||||||
|
/* GenericTraceback */ .chroma .gt { }
|
||||||
|
/* GenericUnderline */ .chroma .gl { }
|
||||||
|
/* TextWhitespace */ .chroma .w { }
|
||||||
@@ -1,21 +1,63 @@
|
|||||||
|
// Replace this with your own font imports!
|
||||||
|
@import url('https://fonts.googleapis.com/css2?family=Fira+Code:wght@400;700&family=Inter:wght@400;600;700&family=Source+Sans+Pro:wght@400;600&display=swap');
|
||||||
:root {
|
:root {
|
||||||
--lt-colours-light: var(--light) !important;
|
--font-body: "Source Sans Pro";
|
||||||
--lt-colours-lightgray: var(--lightgray) !important;
|
--font-header: "Inter";
|
||||||
--lt-colours-dark: var(--secondary) !important;
|
--font-mono: "Fira Code"
|
||||||
--lt-colours-secondary: var(--tertiary) !important;
|
|
||||||
--lt-colours-gray: var(--outlinegray) !important;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
h1, h2, h3, h4, ol, ul, thead {
|
// typography
|
||||||
font-family: Inter;
|
html {
|
||||||
|
scroll-behavior: smooth;
|
||||||
|
&:lang(ar) {
|
||||||
|
& p, & h1, & h2, & h3, article, header {
|
||||||
|
direction: rtl;
|
||||||
|
text-align: right;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
& footer > p {
|
||||||
|
text-align: center !important;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.singlePage {
|
||||||
|
padding: 4em 30vw;
|
||||||
|
@media all and (max-width: 1200px) {
|
||||||
|
padding: 25px 5vw;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
body {
|
||||||
|
margin: 0;
|
||||||
|
height: 100vh;
|
||||||
|
width: 100vw;
|
||||||
|
max-width: 100%;
|
||||||
|
box-sizing: border-box;
|
||||||
|
background-color: var(--light);
|
||||||
|
}
|
||||||
|
|
||||||
|
h1, h2, h3, h4, h5, h6, thead {
|
||||||
|
font-family: var(--font-header);
|
||||||
color: var(--dark);
|
color: var(--dark);
|
||||||
font-weight: revert;
|
font-weight: revert;
|
||||||
margin: revert;
|
margin: 2rem 0 0;
|
||||||
padding: revert;
|
padding: 2rem auto 1rem;
|
||||||
|
|
||||||
|
&:hover > .hanchor {
|
||||||
|
color: var(--secondary);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
p, ul, text {
|
.hanchor {
|
||||||
font-family: 'Source Sans Pro', sans-serif;
|
font-family: var(--font-header);
|
||||||
|
opacity: 0.8;
|
||||||
|
transition: color 0.3s ease;
|
||||||
|
color: var(--dark);
|
||||||
|
}
|
||||||
|
|
||||||
|
p, ul, text, a, tr, td, li, ol, ul {
|
||||||
|
font-family: var(--font-body);
|
||||||
color: var(--gray);
|
color: var(--gray);
|
||||||
fill: var(--gray);
|
fill: var(--gray);
|
||||||
font-weight: revert;
|
font-weight: revert;
|
||||||
@@ -23,6 +65,28 @@ p, ul, text {
|
|||||||
padding: revert;
|
padding: revert;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
tbody, li, p {
|
||||||
|
line-height: 1.5em;
|
||||||
|
}
|
||||||
|
|
||||||
|
.mainTOC {
|
||||||
|
border-radius: 5px;
|
||||||
|
padding: 0.75em 0;
|
||||||
|
|
||||||
|
& details {
|
||||||
|
& summary {
|
||||||
|
cursor: zoom-in;
|
||||||
|
font-family: var(--font-header);
|
||||||
|
color: var(--dark);
|
||||||
|
font-weight: 700;
|
||||||
|
}
|
||||||
|
|
||||||
|
&[open] summary {
|
||||||
|
cursor: zoom-out;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#TableOfContents > ol {
|
#TableOfContents > ol {
|
||||||
counter-reset: section;
|
counter-reset: section;
|
||||||
margin-left: 0em;
|
margin-left: 0em;
|
||||||
@@ -45,28 +109,30 @@ p, ul, text {
|
|||||||
}
|
}
|
||||||
|
|
||||||
& > li::marker, & > li > ol > li::marker {
|
& > li::marker, & > li > ol > li::marker {
|
||||||
font-family: Source Sans Pro;
|
font-family: var(--font-body);
|
||||||
font-weight: 700;
|
font-weight: 700;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
footer {
|
table {
|
||||||
margin-top: 4em;
|
border: 1px solid var(--outlinegray);
|
||||||
text-align: center;
|
width: 100%;
|
||||||
|
padding: 1.5em;
|
||||||
|
border-collapse: collapse;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
td, th {
|
||||||
table {
|
padding: 0.2em 1em;
|
||||||
width: 100%;
|
border: 1px solid var(--outlinegray);
|
||||||
}
|
}
|
||||||
|
|
||||||
img {
|
img {
|
||||||
width: 100%;
|
max-width: 100%;
|
||||||
border-radius: 3px;
|
border-radius: 3px;
|
||||||
margin: 1em 0;
|
margin: 1em 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
p>img+em {
|
p > img + em {
|
||||||
display: block;
|
display: block;
|
||||||
transform: translateY(-1em);
|
transform: translateY(-1em);
|
||||||
}
|
}
|
||||||
@@ -75,33 +141,11 @@ sup {
|
|||||||
line-height: 0
|
line-height: 0
|
||||||
}
|
}
|
||||||
|
|
||||||
p, tbody, li {
|
|
||||||
font-family: Source Sans Pro;
|
|
||||||
color: var(--gray);
|
|
||||||
line-height: 1.5em;
|
|
||||||
}
|
|
||||||
|
|
||||||
h2, h3 {
|
|
||||||
opacity: 0.9;
|
|
||||||
}
|
|
||||||
|
|
||||||
blockquote {
|
blockquote {
|
||||||
margin-left: 0em;
|
margin-left: 0em;
|
||||||
border-left: 3px solid var(--secondary);
|
border-left: 3px solid var(--secondary);
|
||||||
padding-left: 1em;
|
padding-left: 1em;
|
||||||
transition: border-color 0.2s ease;
|
transition: border-color 0.2s ease;
|
||||||
|
|
||||||
&:hover {
|
|
||||||
border-color: var(--tertiary);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
table {
|
|
||||||
padding: 1.5em;
|
|
||||||
}
|
|
||||||
|
|
||||||
td, th {
|
|
||||||
padding: 0.1em 0.5em;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.footnotes p {
|
.footnotes p {
|
||||||
@@ -116,6 +160,10 @@ td, th {
|
|||||||
gap: 1.5em;
|
gap: 1.5em;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
|
|
||||||
|
.disabled {
|
||||||
|
opacity: 0.2;
|
||||||
|
}
|
||||||
|
|
||||||
& > li {
|
& > li {
|
||||||
text-align: center;
|
text-align: center;
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
@@ -124,59 +172,24 @@ td, th {
|
|||||||
background-color: transparent !important;
|
background-color: transparent !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
& a[href$="#"] {
|
& a[href$="#"], &.active a {
|
||||||
opacity: 0.2;
|
opacity: 0.2;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.section {
|
|
||||||
& h3 > a {
|
|
||||||
font-weight: 700;
|
|
||||||
font-family: Inter;
|
|
||||||
margin: 0;
|
|
||||||
}
|
|
||||||
& p {
|
|
||||||
margin-top: 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
article {
|
article {
|
||||||
|
& > h1 {
|
||||||
|
margin-top: 2em;
|
||||||
|
font-size: 2em;
|
||||||
|
}
|
||||||
|
|
||||||
& > .meta {
|
& > .meta {
|
||||||
margin: -1.5em 0 1em 0;
|
margin: 0 0 1em 0;
|
||||||
opacity: 0.7;
|
opacity: 0.7;
|
||||||
}
|
}
|
||||||
|
|
||||||
& > .tags {
|
|
||||||
list-style: none;
|
|
||||||
padding-left: 0;
|
|
||||||
|
|
||||||
& .meta {
|
|
||||||
& > h1 {
|
|
||||||
margin: 0;
|
|
||||||
}
|
|
||||||
& > p {
|
|
||||||
margin: 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
& > li {
|
|
||||||
display: inline-block;
|
|
||||||
}
|
|
||||||
& > li > a {
|
|
||||||
border-radius: 8px;
|
|
||||||
border: var(--outlinegray) 1px solid;
|
|
||||||
padding: 0.2em 0.5em;
|
|
||||||
&::before {
|
|
||||||
content: "#";
|
|
||||||
margin-right: 0.3em;
|
|
||||||
color: var(--outlinegray);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
& a {
|
& a {
|
||||||
font-family: Source Sans Pro;
|
|
||||||
font-weight: 600;
|
font-weight: 600;
|
||||||
|
|
||||||
&.internal-link {
|
&.internal-link {
|
||||||
@@ -185,6 +198,46 @@ article {
|
|||||||
padding: 0 0.1em;
|
padding: 0 0.1em;
|
||||||
margin: auto -0.1em;
|
margin: auto -0.1em;
|
||||||
border-radius: 3px;
|
border-radius: 3px;
|
||||||
|
|
||||||
|
&.broken {
|
||||||
|
opacity: 0.5;
|
||||||
|
background-color: transparent;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
& p {
|
||||||
|
overflow-wrap: anywhere;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.tags {
|
||||||
|
list-style: none;
|
||||||
|
padding-left: 0;
|
||||||
|
|
||||||
|
& .meta {
|
||||||
|
margin: 1.5em 0;
|
||||||
|
& > h1 {
|
||||||
|
margin: 0;
|
||||||
|
}
|
||||||
|
& > p {
|
||||||
|
margin: 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
& > li {
|
||||||
|
display: inline-block;
|
||||||
|
margin: 0.4em 0.2em;
|
||||||
|
}
|
||||||
|
|
||||||
|
& > li > a {
|
||||||
|
border-radius: 8px;
|
||||||
|
border: var(--outlinegray) 1px solid;
|
||||||
|
padding: 0.2em 0.5em;
|
||||||
|
&::before {
|
||||||
|
content: "#";
|
||||||
|
margin-right: 0.3em;
|
||||||
|
color: var(--outlinegray);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -199,46 +252,39 @@ sup > a {
|
|||||||
padding: 0 0.1em 0 0.2em;
|
padding: 0 0.1em 0 0.2em;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#page-title {
|
||||||
|
margin: 0;
|
||||||
|
& > a {
|
||||||
|
font-family: var(--font-header);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
a {
|
a {
|
||||||
font-family: Inter, sans-serif;
|
|
||||||
font-size: 1em;
|
font-size: 1em;
|
||||||
font-weight: 700;
|
font-weight: 700;
|
||||||
text-decoration: none;
|
text-decoration: none;
|
||||||
transition: all 0.2s ease;
|
transition: all 0.2s ease;
|
||||||
color: var(--secondary);
|
color: var(--secondary);
|
||||||
|
|
||||||
&:hover {
|
&:hover {
|
||||||
color: var(--tertiary) !important;
|
color: var(--tertiary) !important;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pre {
|
pre {
|
||||||
font-family: 'Fira Code';
|
font-family: var(--font-mono);
|
||||||
padding: 0.75em;
|
padding: 0.75em;
|
||||||
border-radius: 3px;
|
border-radius: 3px;
|
||||||
overflow-x: scroll;
|
overflow-x: scroll;
|
||||||
}
|
}
|
||||||
|
|
||||||
code {
|
code {
|
||||||
font-family: 'Fira Code';
|
font-family: var(--font-mono);
|
||||||
font-size: 0.85em;
|
font-size: 0.85em;
|
||||||
padding: 0.15em 0.3em;
|
padding: 0.15em 0.3em;
|
||||||
border-radius: 5px;
|
border-radius: 5px;
|
||||||
background: var(--lightgray);
|
background: var(--lightgray);
|
||||||
}
|
}
|
||||||
|
|
||||||
html {
|
|
||||||
scroll-behavior: smooth;
|
|
||||||
}
|
|
||||||
|
|
||||||
body {
|
|
||||||
margin: 0;
|
|
||||||
height: 100vh;
|
|
||||||
width: 100vw;
|
|
||||||
overflow-x: hidden;
|
|
||||||
background-color: var(--light);
|
|
||||||
}
|
|
||||||
|
|
||||||
@keyframes fadeIn {
|
@keyframes fadeIn {
|
||||||
0% {opacity:0;}
|
0% {opacity:0;}
|
||||||
100% {opacity:1;}
|
100% {opacity:1;}
|
||||||
@@ -246,12 +292,10 @@ body {
|
|||||||
|
|
||||||
footer {
|
footer {
|
||||||
margin-top: 4em;
|
margin-top: 4em;
|
||||||
|
text-align: center;
|
||||||
& > a {
|
& ul {
|
||||||
font-size: 1em;
|
padding-left: 0;
|
||||||
color: var(--secondary);
|
}
|
||||||
padding: 0 0.5em 3em 0.5em;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
hr {
|
hr {
|
||||||
@@ -264,14 +308,6 @@ hr {
|
|||||||
background-color: var(--dark);
|
background-color: var(--dark);
|
||||||
}
|
}
|
||||||
|
|
||||||
.singlePage {
|
|
||||||
margin: 4em 30vw;
|
|
||||||
|
|
||||||
@media all and (max-width: 1200px) {
|
|
||||||
margin: 25px 5vw;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.page-end {
|
.page-end {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: row;
|
flex-direction: row;
|
||||||
@@ -288,7 +324,8 @@ hr {
|
|||||||
& > .backlinks-container {
|
& > .backlinks-container {
|
||||||
& > ul {
|
& > ul {
|
||||||
list-style: none;
|
list-style: none;
|
||||||
padding-left: 0;
|
padding: 0;
|
||||||
|
margin: 0;
|
||||||
|
|
||||||
& > li {
|
& > li {
|
||||||
margin: 0.5em 0;
|
margin: 0.5em 0;
|
||||||
@@ -302,6 +339,14 @@ hr {
|
|||||||
& #graph-container {
|
& #graph-container {
|
||||||
border: var(--outlinegray) 1px solid;
|
border: var(--outlinegray) 1px solid;
|
||||||
border-radius: 5px;
|
border-radius: 5px;
|
||||||
|
box-sizing: border-box;
|
||||||
|
min-height: 250px;
|
||||||
|
margin: 0.5em 0;
|
||||||
|
|
||||||
|
& > svg {
|
||||||
|
margin-bottom: -5px;
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -309,14 +354,15 @@ hr {
|
|||||||
margin-top: 30vh;
|
margin-top: 30vh;
|
||||||
}
|
}
|
||||||
|
|
||||||
article > h1 {
|
.spacer {
|
||||||
font-size: 2em;
|
flex: 1 1 auto;
|
||||||
}
|
}
|
||||||
|
|
||||||
header {
|
header {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: row;
|
flex-direction: row;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
|
margin: 1em 0 2em;
|
||||||
|
|
||||||
& > h1 {
|
& > h1 {
|
||||||
font-size: 2em;
|
font-size: 2em;
|
||||||
@@ -328,15 +374,24 @@ header {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
& > .spacer {
|
#search-icon {
|
||||||
flex: 1 1 auto;
|
background-color: var(--lightgray);
|
||||||
|
border-radius: 4px;
|
||||||
|
height: 2em;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
cursor: pointer;
|
||||||
|
& > p {
|
||||||
|
display: inline;
|
||||||
|
padding: 0 1.5em 0 2em;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
& > svg {
|
& svg {
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
width: 18px;
|
width: 18px;
|
||||||
min-width: 18px;
|
min-width: 18px;
|
||||||
margin: 0 1em;
|
margin: 0 0.5em;
|
||||||
|
|
||||||
&:hover .search-path {
|
&:hover .search-path {
|
||||||
stroke: var(--tertiary);
|
stroke: var(--tertiary);
|
||||||
@@ -383,7 +438,7 @@ header {
|
|||||||
& > input {
|
& > input {
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
padding: 0.5em 1em;
|
padding: 0.5em 1em;
|
||||||
font-family: Inter, sans-serif;
|
font-family: var(--font-body);
|
||||||
color: var(--dark);
|
color: var(--dark);
|
||||||
font-size: 1.1em;
|
font-size: 1.1em;
|
||||||
border: 1px solid var(--outlinegray);
|
border: 1px solid var(--outlinegray);
|
||||||
@@ -394,7 +449,7 @@ header {
|
|||||||
}
|
}
|
||||||
|
|
||||||
& > #results-container {
|
& > #results-container {
|
||||||
& > .result-card {
|
& .result-card {
|
||||||
padding: 1em;
|
padding: 1em;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
transition: background 0.2s ease;
|
transition: background 0.2s ease;
|
||||||
@@ -431,66 +486,136 @@ header {
|
|||||||
& > h3, & > p {
|
& > h3, & > p {
|
||||||
margin: 0;
|
margin: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
& .search-highlight {
|
|
||||||
background-color: #afbfc966;
|
|
||||||
padding: 0.05em 0.2em;
|
|
||||||
border-radius: 3px;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.search-highlight {
|
||||||
|
background-color: #afbfc966;
|
||||||
|
padding: 0.05em 0.2em;
|
||||||
|
border-radius: 3px;
|
||||||
|
}
|
||||||
|
|
||||||
.section-ul {
|
.section-ul {
|
||||||
list-style: none;
|
list-style: none;
|
||||||
|
margin-top: 2em;
|
||||||
padding-left: 0;
|
padding-left: 0;
|
||||||
|
|
||||||
& > li {
|
}
|
||||||
border: 1px solid var(--outlinegray);
|
|
||||||
border-radius: 5px;
|
|
||||||
padding: 0 1em;
|
|
||||||
margin-bottom: 1em;
|
|
||||||
|
|
||||||
& h3 {
|
.section-li {
|
||||||
opacity: 1;
|
margin-bottom: 1em;
|
||||||
|
|
||||||
|
& > .section {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
|
||||||
|
@media all and (max-width: 600px) {
|
||||||
|
& .tags {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
& h3 > a {
|
||||||
font-weight: 700;
|
font-weight: 700;
|
||||||
margin-bottom: 0em;
|
margin: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
& p {
|
||||||
|
margin: 0;
|
||||||
|
padding-right: 1em;
|
||||||
|
flex-basis: 6em;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
& .meta {
|
& h3 {
|
||||||
opacity: 0.6;
|
opacity: 1;
|
||||||
}
|
font-weight: 700;
|
||||||
|
margin: 0em;
|
||||||
|
}
|
||||||
|
|
||||||
|
& .meta {
|
||||||
|
opacity: 0.6;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@keyframes dropin {
|
||||||
|
0% {
|
||||||
|
display: none;
|
||||||
|
opacity: 0;
|
||||||
|
visibility: hidden;
|
||||||
|
}
|
||||||
|
1% {
|
||||||
|
display: inline-block;
|
||||||
|
opacity: 0;
|
||||||
|
}
|
||||||
|
100% {
|
||||||
|
opacity: 1;
|
||||||
|
visibility: visible;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.popover {
|
.popover {
|
||||||
z-index: 999;
|
z-index: 999;
|
||||||
position: absolute;
|
position: absolute;
|
||||||
width: 15em;
|
width: 20rem;
|
||||||
display: inline;
|
display: none;
|
||||||
background-color: var(--light);
|
background-color: var(--light);
|
||||||
padding: 1em;
|
padding: 1rem;
|
||||||
|
margin: 1rem;
|
||||||
border: 1px solid var(--outlinegray);
|
border: 1px solid var(--outlinegray);
|
||||||
border-radius: 5px;
|
border-radius: 5px;
|
||||||
transform: translate(-50%, 40%);
|
|
||||||
opacity: 0;
|
|
||||||
pointer-events: none;
|
pointer-events: none;
|
||||||
transition: opacity 0.2s ease, transform 0.2s ease;
|
transition: opacity 0.2s ease, transform 0.2s ease;
|
||||||
transition-delay: 0.3s;
|
|
||||||
user-select: none;
|
user-select: none;
|
||||||
|
overflow-wrap: anywhere;
|
||||||
|
box-shadow: 6px 6px 36px 0px rgba(0,0,0,0.25);
|
||||||
|
|
||||||
|
@media all and (max-width: 600px) {
|
||||||
|
display: none !important;
|
||||||
|
}
|
||||||
|
|
||||||
&.visible {
|
&.visible {
|
||||||
opacity: 1;
|
opacity: 1;
|
||||||
transform: translate(-50%, 20%);
|
visibility: visible;
|
||||||
|
display: inline-block;
|
||||||
|
animation: dropin 0.2s ease;
|
||||||
}
|
}
|
||||||
|
|
||||||
& > h3 {
|
& > h3 {
|
||||||
margin: 0.5em 0;
|
font-size: 1rem;
|
||||||
|
margin: 0.25rem 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
& > .meta {
|
||||||
|
margin-top: 0.25rem;
|
||||||
|
opacity: 0.5;
|
||||||
|
font-family: var(--font-mono);
|
||||||
|
font-size: 0.8rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
& > p {
|
& > p {
|
||||||
margin: 0;
|
margin: 0;
|
||||||
|
padding: 0.5rem 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
& > p, & > a {
|
||||||
|
font-size: 1rem;
|
||||||
font-weight: 400;
|
font-weight: 400;
|
||||||
|
user-select: none;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#contact_buttons ul {
|
||||||
|
list-style-type: none;
|
||||||
|
|
||||||
|
li {
|
||||||
|
display: inline-block;
|
||||||
|
}
|
||||||
|
|
||||||
|
li a {
|
||||||
|
padding: 0 1em;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
47
assets/styles/clipboard.scss
Normal file
47
assets/styles/clipboard.scss
Normal file
@@ -0,0 +1,47 @@
|
|||||||
|
.clipboard-button {
|
||||||
|
position: absolute;
|
||||||
|
display: flex;
|
||||||
|
float: right;
|
||||||
|
right: 0;
|
||||||
|
padding: 0.69em;
|
||||||
|
margin: 0.5em;
|
||||||
|
color: var(--outlinegray);
|
||||||
|
border-color: var(--dark);
|
||||||
|
background-color: var(--lightgray);
|
||||||
|
filter: contrast(1.1);
|
||||||
|
border: 2px solid;
|
||||||
|
border-radius: 6px;
|
||||||
|
font-size: 0.8em;
|
||||||
|
z-index: 1;
|
||||||
|
opacity: 0;
|
||||||
|
transition: 0.12s;
|
||||||
|
|
||||||
|
& > svg {
|
||||||
|
fill: var(--light);
|
||||||
|
filter: contrast(0.3);
|
||||||
|
}
|
||||||
|
|
||||||
|
&:hover {
|
||||||
|
cursor: pointer;
|
||||||
|
border-color: var(--primary);
|
||||||
|
|
||||||
|
& > svg {
|
||||||
|
fill: var(--primary);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
&:focus {
|
||||||
|
outline: 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.highlight {
|
||||||
|
position: relative;
|
||||||
|
|
||||||
|
&:hover > .clipboard-button {
|
||||||
|
opacity: 1;
|
||||||
|
transition: 0.2s;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
20
assets/styles/code-title.scss
Normal file
20
assets/styles/code-title.scss
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
.code-title {
|
||||||
|
color: var(--primary) ;
|
||||||
|
font-family: var(--font-mono);
|
||||||
|
width: max-content;
|
||||||
|
overflow-x: auto;
|
||||||
|
display: inline-block;
|
||||||
|
vertical-align: middle;
|
||||||
|
font-weight: normal;
|
||||||
|
line-height: 1em;
|
||||||
|
position: relative;
|
||||||
|
padding: 0.5em 0.6em 0.6em; // + 1.2 em
|
||||||
|
max-width: calc(100% - 1.2em); // (-1.2 em) fits article width exactly
|
||||||
|
margin-bottom: -0.2em;
|
||||||
|
z-index: -1;
|
||||||
|
border-top-left-radius: 0.3em;
|
||||||
|
border-top-right-radius: 0.3em;
|
||||||
|
font-size: 0.9em;
|
||||||
|
background-color: var(--lightgray);
|
||||||
|
filter: hue-rotate(-30deg) contrast(1.0) opacity(0.8);
|
||||||
|
}
|
||||||
@@ -1,4 +1,5 @@
|
|||||||
// Add your own CSS here!
|
// Add your own CSS here!
|
||||||
|
|
||||||
:root {
|
:root {
|
||||||
--light: #faf8f8;
|
--light: #faf8f8;
|
||||||
--dark: #141021;
|
--dark: #141021;
|
||||||
@@ -9,6 +10,7 @@
|
|||||||
--gray: #4e4e4e;
|
--gray: #4e4e4e;
|
||||||
--lightgray: #f0f0f0;
|
--lightgray: #f0f0f0;
|
||||||
--outlinegray: #dadada;
|
--outlinegray: #dadada;
|
||||||
|
--million-progress-bar-color: var(--secondary);
|
||||||
}
|
}
|
||||||
|
|
||||||
[saved-theme="dark"] {
|
[saved-theme="dark"] {
|
||||||
@@ -21,4 +23,7 @@
|
|||||||
--gray: #d4d4d4 !important;
|
--gray: #d4d4d4 !important;
|
||||||
--lightgray: #292633 !important;
|
--lightgray: #292633 !important;
|
||||||
--outlinegray: #343434 !important;
|
--outlinegray: #343434 !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
62
assets/styles/syntax.scss
Normal file
62
assets/styles/syntax.scss
Normal file
@@ -0,0 +1,62 @@
|
|||||||
|
// Overrides
|
||||||
|
/* Background */
|
||||||
|
.chroma {
|
||||||
|
overflow: hidden !important;
|
||||||
|
background-color: var(--lightgray) !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* LineTable */
|
||||||
|
.chroma .lntable {
|
||||||
|
width: auto !important;
|
||||||
|
overflow: auto !important;
|
||||||
|
display: block !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* LineHighlight */
|
||||||
|
.chroma .hl {
|
||||||
|
display: block !important;
|
||||||
|
width: 100% !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* LineNumbersTable */
|
||||||
|
.chroma .lnt {
|
||||||
|
margin-right: 0.0em !important;
|
||||||
|
padding: 0 0.0em 0 0.0em !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* LineNumbers */
|
||||||
|
.chroma .ln {
|
||||||
|
margin-right: 0.0em !important;
|
||||||
|
padding: 0 0.0em 0 0.0em !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* GenericDeleted */
|
||||||
|
.chroma .gd {
|
||||||
|
color: #8b080b !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* GenericInserted */
|
||||||
|
.chroma .gi {
|
||||||
|
font-weight: bold !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.lntd:first-of-type > .chroma {
|
||||||
|
padding-right: 0 !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.chroma code {
|
||||||
|
font-family: var(--font-mono) !important;
|
||||||
|
font-size: 0.85em !important;
|
||||||
|
line-height: 2em !important;
|
||||||
|
background: none !important;
|
||||||
|
padding: 0 !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.chroma {
|
||||||
|
border-radius: 3px !important;
|
||||||
|
margin: 0 !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
pre.chroma {
|
||||||
|
-moz-tab-size:4;-o-tab-size:4;tab-size:4;
|
||||||
|
}
|
||||||
@@ -1,7 +1,6 @@
|
|||||||
baseURL = "https://quartz.jzhao.xyz/"
|
baseURL = "https://quartz.jzhao.xyz/"
|
||||||
languageCode = "en-us"
|
languageCode = "en-us"
|
||||||
googleAnalytics = "G-XYFD95KB4J"
|
googleAnalytics = "G-XYFD95KB4J"
|
||||||
pygmentsUseClasses = true
|
|
||||||
relativeURLs = false
|
relativeURLs = false
|
||||||
disablePathToLower = true
|
disablePathToLower = true
|
||||||
ignoreFiles = [
|
ignoreFiles = [
|
||||||
@@ -18,6 +17,7 @@ enableGitInfo = true
|
|||||||
ordered = true
|
ordered = true
|
||||||
startLevel = 2
|
startLevel = 2
|
||||||
[markup.highlight]
|
[markup.highlight]
|
||||||
|
noClasses = false
|
||||||
anchorLineNos = false
|
anchorLineNos = false
|
||||||
codeFences = true
|
codeFences = true
|
||||||
guessSyntax = true
|
guessSyntax = true
|
||||||
@@ -27,4 +27,8 @@ enableGitInfo = true
|
|||||||
lineNos = true
|
lineNos = true
|
||||||
lineNumbersInTable = true
|
lineNumbersInTable = true
|
||||||
style = "dracula"
|
style = "dracula"
|
||||||
tabWidth = 4
|
[frontmatter]
|
||||||
|
lastmod = ["lastmod", ":git", "date", "publishDate"]
|
||||||
|
publishDate = ["publishDate", "date"]
|
||||||
|
[markup.goldmark.renderer]
|
||||||
|
unsafe = true
|
||||||
|
|||||||
@@ -1,25 +1,26 @@
|
|||||||
---
|
---
|
||||||
title: 🪴 Quartz 3
|
title: 🪴 Quartz 3.2
|
||||||
---
|
---
|
||||||
Host your second brain and [digital garden](https://jzhao.xyz/posts/digital-gardening) for free. Quartz features
|
|
||||||
1. Extremely fast full-text search by pressing `/`
|
Host your second brain and [digital garden](https://jzhao.xyz/posts/networked-thought) for free. Quartz features
|
||||||
2. Display for backlinks of each note
|
|
||||||
3. Fully customizable local graph view
|
1. Extremely fast natural-language [[notes/search|search]]
|
||||||
4. Endlessly powerful page and theme customization using CSS
|
2. Customizable and hackable design based on [Hugo](https://gohugo.io/)
|
||||||
5. Automatically generated tag and section lists of content
|
3. Automatically generated backlinks, link previews, and local graph
|
||||||
6. Beautiful link previews
|
4. Built-in [[notes/CJK + Latex Support (测试) | CJK + Latex Support]] and [[notes/callouts | Admonition-style callouts]]
|
||||||
|
5. Support for both Markdown Links and Wikilinks
|
||||||
|
|
||||||
|
Check out some of the [amazing gardens that community members](notes/showcase.md) have published with Quartz or read about [why I made Quartz](notes/philosophy.md) to begin with.
|
||||||
|
|
||||||
## Get Started
|
## Get Started
|
||||||
> 📚 [Setup your own digital garden using Quartz](notes/setup.md)
|
> 📚 Step 1: [Setup your own digital garden using Quartz](notes/setup.md)
|
||||||
|
|
||||||
Not convinced yet? Look at some [community digital gardens](moc/showcase) built with Quartz, or read about [why I made Quartz](notes/philosophy.md) to begin with!
|
Returning user? Figure out how to [[notes/updating|update]] your existing Quartz garden.
|
||||||
|
|
||||||
## Content Lists
|
If you prefer browsing the contents of this site through a list instead of a graph, you see a list of all [setup-related notes](/tags/setup).
|
||||||
If you prefer browsing the contents of this site through a list instead of a graph, you can find content lists here too:
|
|
||||||
|
|
||||||
- [All Notes](/notes)
|
### Troubleshooting
|
||||||
- [Setup-related Notes](/tags/setup)
|
|
||||||
|
|
||||||
## Troubleshooting
|
|
||||||
- 🚧 [Troubleshooting and FAQ](notes/troubleshooting.md)
|
- 🚧 [Troubleshooting and FAQ](notes/troubleshooting.md)
|
||||||
- 🐛 [Submit an Issue](https://github.com/jackyzha0/quartz/issues)
|
- 🐛 [Submit an Issue](https://github.com/jackyzha0/quartz/issues)
|
||||||
|
- 👀 [Discord Community](https://discord.gg/cRFFHYye7t)
|
||||||
|
|
||||||
|
|||||||
40
content/notes/CJK + Latex Support (测试).md
Normal file
40
content/notes/CJK + Latex Support (测试).md
Normal file
@@ -0,0 +1,40 @@
|
|||||||
|
---
|
||||||
|
title: "CJK + Latex Support (测试)"
|
||||||
|
---
|
||||||
|
|
||||||
|
## Chinese, Japanese, Korean Support
|
||||||
|
几乎在我们意识到之前,我们已经离开了地面。
|
||||||
|
|
||||||
|
우리가 그것을 알기도 전에 우리는 땅을 떠났습니다.
|
||||||
|
|
||||||
|
私たちがそれを知るほぼ前に、私たちは地面を離れていました。
|
||||||
|
|
||||||
|
## Latex
|
||||||
|
|
||||||
|
Block math works with two dollar signs `$$...$$`
|
||||||
|
|
||||||
|
$$f(x) = \int_{-\infty}^\infty
|
||||||
|
f\hat(\xi),e^{2 \pi i \xi x}
|
||||||
|
\,d\xi$$
|
||||||
|
|
||||||
|
Inline math also works with single dollar signs `$...$`. For example, Euler's identity but inline: $e^{i\pi} = 0$
|
||||||
|
|
||||||
|
Aligned equations work quite well:
|
||||||
|
|
||||||
|
$$
|
||||||
|
\begin{aligned}
|
||||||
|
a &= b + c \\ &= e + f \\
|
||||||
|
\end{aligned}
|
||||||
|
$$
|
||||||
|
|
||||||
|
And matrices
|
||||||
|
|
||||||
|
$$
|
||||||
|
\begin{bmatrix}
|
||||||
|
1 & 2 & 3 \\
|
||||||
|
a & b & c
|
||||||
|
\end{bmatrix}
|
||||||
|
$$
|
||||||
|
|
||||||
|
## RTL
|
||||||
|
More information on configuring RTL languages like Arabic in the [config](notes/config.md) page.
|
||||||
@@ -1,28 +0,0 @@
|
|||||||
---
|
|
||||||
title: "Obsidian Vault Integration"
|
|
||||||
tags:
|
|
||||||
- setup
|
|
||||||
---
|
|
||||||
|
|
||||||
## Setup
|
|
||||||
Obsidian is the preferred way to use Quartz. You can either create a new Obsidian Vault or link one that your already have.
|
|
||||||
|
|
||||||
### New Vault
|
|
||||||
If you don't have an existing Vault, [download Obsidian](https://obsidian.md/) and create a new Vault in the `/content` folder that you created and cloned during the [setup](notes/setup.md).
|
|
||||||
|
|
||||||
### Linking an existing Vault
|
|
||||||
The easiest way to use an existing Vault is to copy all of our files (directory and hierarchies intact) into the `/content` folder.
|
|
||||||
|
|
||||||
## Settings
|
|
||||||
Great, now that you have your Obsidian linked to your Quartz, let's fix some settings so that they play well.
|
|
||||||
|
|
||||||
Under Options > Files and Links, set the New link format to always be Absolute Path in Vault and disabled WikiLinks so Obsidian generates regular Markdown links.
|
|
||||||
|
|
||||||
*Obsidian Settings*
|
|
||||||
|
|
||||||
## Templates
|
|
||||||
Inserting front matter everytime you want to create a new Note gets annoying really quickly. Luckily, Obsidian supports templates which makes inserting new content really easily.
|
|
||||||
|
|
||||||
**If you decide to overwrite the `/content` folder completely, don't remove the `/content/templates` folder!**
|
|
||||||
|
|
||||||
Head over to Options > Core Plugins and enable the Templates plugin. Then go to Options > Hotkeys and set a hotkey for 'Insert Template'. That way, when you create a new note, you can just press the hotkey for a new template and be ready to go!
|
|
||||||
63
content/notes/callouts.md
Normal file
63
content/notes/callouts.md
Normal file
@@ -0,0 +1,63 @@
|
|||||||
|
---
|
||||||
|
title: "Callouts"
|
||||||
|
---
|
||||||
|
|
||||||
|
## Callout support
|
||||||
|
|
||||||
|
Quartz supports the same Admonition-callout syntax as Obsidian.
|
||||||
|
|
||||||
|
This includes
|
||||||
|
- 12 Distinct callout types (each with several aliases)
|
||||||
|
- Collapsable callouts
|
||||||
|
|
||||||
|
See [documentation on supported types and syntax here](https://help.obsidian.md/How+to/Use+callouts#Types).
|
||||||
|
|
||||||
|
## Showcase
|
||||||
|
|
||||||
|
> [!EXAMPLE] Examples
|
||||||
|
>
|
||||||
|
> Aliases: example
|
||||||
|
|
||||||
|
> [!note] Notes
|
||||||
|
>
|
||||||
|
> Aliases: note
|
||||||
|
|
||||||
|
> [!abstract] Summaries
|
||||||
|
>
|
||||||
|
> Aliases: abstract, summary, tldr
|
||||||
|
|
||||||
|
> [!info] Info
|
||||||
|
>
|
||||||
|
> Aliases: info, todo
|
||||||
|
|
||||||
|
> [!tip] Hint
|
||||||
|
>
|
||||||
|
> Aliases: tip, hint, important
|
||||||
|
|
||||||
|
> [!success] Success
|
||||||
|
>
|
||||||
|
> Aliases: success, check, done
|
||||||
|
|
||||||
|
> [!question] Question
|
||||||
|
>
|
||||||
|
> Aliases: question, help, faq
|
||||||
|
|
||||||
|
> [!warning] Warning
|
||||||
|
>
|
||||||
|
> Aliases: warning, caution, attention
|
||||||
|
|
||||||
|
> [!failure] Failure
|
||||||
|
>
|
||||||
|
> Aliases: failure, fail, missing
|
||||||
|
|
||||||
|
> [!danger] Error
|
||||||
|
>
|
||||||
|
> Aliases: danger, error
|
||||||
|
|
||||||
|
> [!bug] Bug
|
||||||
|
>
|
||||||
|
> Aliases: bug
|
||||||
|
|
||||||
|
> [!quote] Quote
|
||||||
|
>
|
||||||
|
> Aliases: quote, cite
|
||||||
@@ -2,47 +2,222 @@
|
|||||||
title: "Configuration"
|
title: "Configuration"
|
||||||
tags:
|
tags:
|
||||||
- setup
|
- setup
|
||||||
|
weight: 0
|
||||||
---
|
---
|
||||||
|
|
||||||
## Configuration
|
## Configuration
|
||||||
Quartz is designed to be extremely configurable. You can find the bulk of the configuration scattered throughout the repository depending on how in-depth you'd like to get.
|
Quartz is designed to be extremely configurable. You can find the bulk of the configuration scattered throughout the repository depending on how in-depth you'd like to get.
|
||||||
|
|
||||||
The majority of configuration can be be found under `data/config.yaml`. An annotated example configuration is shown below.
|
The majority of configuration can be found under `data/config.yaml`. An annotated example configuration is shown below.
|
||||||
|
|
||||||
```yaml
|
```yaml {title="data/config.yaml"}
|
||||||
name: Your name here! # Shows in the footer
|
# The name to display in the footer
|
||||||
enableToc: true # Whether to show a Table of Contents
|
name: Jacky Zhao
|
||||||
description: Page description to show to search engines
|
|
||||||
page_title: Quartz Example Page # Default Page Title
|
|
||||||
|
|
||||||
links: # Links to show in footer
|
# whether to globally show the table of contents on each page
|
||||||
|
# this can be turned off on a per-page basis by adding this to the
|
||||||
|
# front-matter of that note
|
||||||
|
enableToc: true
|
||||||
|
|
||||||
|
# whether to by-default open or close the table of contents on each page
|
||||||
|
openToc: false
|
||||||
|
|
||||||
|
# whether to display on-hover link preview cards
|
||||||
|
enableLinkPreview: true
|
||||||
|
|
||||||
|
# whether to render titles for code blocks
|
||||||
|
enableCodeBlockTitle: true
|
||||||
|
|
||||||
|
# whether to render copy buttons for code blocks
|
||||||
|
enableCodeBlockCopy: true
|
||||||
|
|
||||||
|
# whether to render callouts
|
||||||
|
enableCallouts: true
|
||||||
|
|
||||||
|
# whether to try to process Latex
|
||||||
|
enableLatex: true
|
||||||
|
|
||||||
|
# whether to enable single-page-app style rendering
|
||||||
|
# this prevents flashes of unstyled content and improves
|
||||||
|
# smoothness of Quartz. More info in issue #109 on GitHub
|
||||||
|
enableSPA: true
|
||||||
|
|
||||||
|
# whether to render a footer
|
||||||
|
enableFooter: true
|
||||||
|
|
||||||
|
# whether backlinks of pages should show the context in which
|
||||||
|
# they were mentioned
|
||||||
|
enableContextualBacklinks: true
|
||||||
|
|
||||||
|
# whether to show a section of recent notes on the home page
|
||||||
|
enableRecentNotes: false
|
||||||
|
|
||||||
|
# whether to display an 'edit' button next to the last edited field
|
||||||
|
# that links to github
|
||||||
|
enableGitHubEdit: true
|
||||||
|
GitHubLink: https://github.com/jackyzha0/quartz/tree/hugo/content
|
||||||
|
|
||||||
|
# whether to use Operand to power semantic search
|
||||||
|
# IMPORTANT: replace this API key with your own if you plan on using
|
||||||
|
# Operand search!
|
||||||
|
enableSemanticSearch: false
|
||||||
|
operandApiKey: "REPLACE-WITH-YOUR-OPERAND-API-KEY"
|
||||||
|
|
||||||
|
# page description used for SEO
|
||||||
|
description:
|
||||||
|
Host your second brain and digital garden for free. Quartz features extremely fast full-text search,
|
||||||
|
Wikilink support, backlinks, local graph, tags, and link previews.
|
||||||
|
|
||||||
|
# title of the home page (also for SEO)
|
||||||
|
page_title:
|
||||||
|
"🪴 Quartz 3.2"
|
||||||
|
|
||||||
|
# links to show in the footer
|
||||||
|
links:
|
||||||
- link_name: Twitter
|
- link_name: Twitter
|
||||||
link: https://twitter.com/_jzhao
|
link: https://twitter.com/_jzhao
|
||||||
- link_name: Github
|
- link_name: Github
|
||||||
link: https://github.com/jackyzha0
|
link: https://github.com/jackyzha0
|
||||||
```
|
```
|
||||||
|
|
||||||
|
### Code Block Titles
|
||||||
|
To add code block titles with Quartz:
|
||||||
|
|
||||||
|
1. Ensure that code block titles are enabled in Quartz's configuration:
|
||||||
|
|
||||||
|
```yaml {title="data/config.yaml", linenos=false}
|
||||||
|
enableCodeBlockTitle: true
|
||||||
|
```
|
||||||
|
|
||||||
|
2. Add the `title` attribute to the desired [code block
|
||||||
|
fence](https://gohugo.io/content-management/syntax-highlighting/#highlighting-in-code-fences):
|
||||||
|
|
||||||
|
```markdown {linenos=false}
|
||||||
|
```yaml {title="data/config.yaml"}
|
||||||
|
enableCodeBlockTitle: true # example from step 1
|
||||||
|
```
|
||||||
|
```
|
||||||
|
|
||||||
|
**Note** that if `{title=<my-title>}` is included, and code block titles are not
|
||||||
|
enabled, no errors will occur, and the title attribute will be ignored.
|
||||||
|
|
||||||
|
### HTML Favicons
|
||||||
|
If you would like to customize the favicons of your Quartz-based website, you
|
||||||
|
can add them to the `data/config.yaml` file. The **default** without any set
|
||||||
|
`favicon` key is:
|
||||||
|
|
||||||
|
```html {title="layouts/partials/head.html", linenostart=15}
|
||||||
|
<link rel="shortcut icon" href="icon.png" type="image/png">
|
||||||
|
```
|
||||||
|
|
||||||
|
The default can be overridden by defining a value to the `favicon` key in your
|
||||||
|
`data/config.yaml` file. For example, here is a `List[Dictionary]` example format, which is
|
||||||
|
equivalent to the default:
|
||||||
|
|
||||||
|
```yaml {title="data/config.yaml", linenos=false}
|
||||||
|
favicon:
|
||||||
|
- { rel: "shortcut icon", href: "icon.png", type: "image/png" }
|
||||||
|
# - { ... } # Repeat for each additional favicon you want to add
|
||||||
|
```
|
||||||
|
|
||||||
|
In this format, the keys are identical to their HTML representations.
|
||||||
|
|
||||||
|
If you plan to add multiple favicons generated by a website (see list below), it
|
||||||
|
may be easier to define it as HTML. Here is an example which appends the
|
||||||
|
**Apple touch icon** to Quartz's default favicon:
|
||||||
|
|
||||||
|
```yaml {title="data/config.yaml", linenos=false}
|
||||||
|
favicon: |
|
||||||
|
<link rel="shortcut icon" href="icon.png" type="image/png">
|
||||||
|
<link rel="apple-touch-icon" sizes="180x180" href="/apple-touch-icon.png">
|
||||||
|
```
|
||||||
|
|
||||||
|
This second favicon will now be used as a web page icon when someone adds your
|
||||||
|
webpage to the home screen of their Apple device. If you are interested in more
|
||||||
|
information about the current and past standards of favicons, you can read
|
||||||
|
[this article](https://www.emergeinteractive.com/insights/detail/the-essentials-of-favicons/).
|
||||||
|
|
||||||
|
**Note** that all generated favicon paths, defined by the `href`
|
||||||
|
attribute, are relative to the `static/` directory.
|
||||||
|
|
||||||
### Graph View
|
### Graph View
|
||||||
To customize the Interactive Graph view, you can poke around `data/graphConfig.yaml`.
|
To customize the Interactive Graph view, you can poke around `data/graphConfig.yaml`.
|
||||||
|
|
||||||
```yaml
|
```yaml {title="data/graphConfig.yaml"}
|
||||||
enableLegend: false # automatically generate a legend
|
# if true, a Global Graph will be shown on home page with full width, no backlink.
|
||||||
enableDrag: true # allow dragging nodes in the graph
|
# A different set of Local Graphs will be shown on sub pages.
|
||||||
enableZoom: true # allow zooming and panning the graph
|
# if false, Local Graph will be default on every page as usual
|
||||||
depth: -1 # how many neighbours of the current node to show (-1 is all nodes)
|
enableGlobalGraph: false
|
||||||
paths: # colour specific nodes path off of their path
|
|
||||||
|
### Local Graph ###
|
||||||
|
localGraph:
|
||||||
|
# whether automatically generate a legend
|
||||||
|
enableLegend: false
|
||||||
|
|
||||||
|
# whether to allow dragging nodes in the graph
|
||||||
|
enableDrag: true
|
||||||
|
|
||||||
|
# whether to allow zooming and panning the graph
|
||||||
|
enableZoom: true
|
||||||
|
|
||||||
|
# how many neighbours of the current node to show (-1 is all nodes)
|
||||||
|
depth: 1
|
||||||
|
|
||||||
|
# initial zoom factor of the graph
|
||||||
|
scale: 1.2
|
||||||
|
|
||||||
|
# how strongly nodes should repel each other
|
||||||
|
repelForce: 2
|
||||||
|
|
||||||
|
# how strongly should nodes be attracted to the center of gravity
|
||||||
|
centerForce: 1
|
||||||
|
|
||||||
|
# what the default link length should be
|
||||||
|
linkDistance: 1
|
||||||
|
|
||||||
|
# how big the node labels should be
|
||||||
|
fontSize: 0.6
|
||||||
|
|
||||||
|
# scale at which to start fading the labes on nodes
|
||||||
|
opacityScale: 3
|
||||||
|
|
||||||
|
### Global Graph ###
|
||||||
|
globalGraph:
|
||||||
|
# same settings as above
|
||||||
|
|
||||||
|
### For all graphs ###
|
||||||
|
# colour specific nodes path off of their path
|
||||||
|
paths:
|
||||||
- /moc: "#4388cc"
|
- /moc: "#4388cc"
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
## Styling
|
## Styling
|
||||||
Want to go even more in-depth? You can add custom CSS styling and change existing colours through editing `assets/custom.scss`. If you'd like to target specific parts of the site, you can add ids and classes to the HTML partials in `/layouts/partials`.
|
Want to go even more in-depth? You can add custom CSS styling and change existing colours through editing `assets/styles/custom.scss`. If you'd like to target specific parts of the site, you can add ids and classes to the HTML partials in `/layouts/partials`.
|
||||||
|
|
||||||
### Partials
|
### Partials
|
||||||
Partials are what dictate what actually gets rendered to the page. Want to change how pages are styled and structured? You can edit the appropriate layout in `/layouts`.
|
Partials are what dictate what gets rendered to the page. Want to change how pages are styled and structured? You can edit the appropriate layout in `/layouts`.
|
||||||
|
|
||||||
For example, the structure of the home page can be edited through `/layouts/index.html`. To customize the footer, you can edit `/layouts/partials/footer.html`
|
For example, the structure of the home page can be edited through `/layouts/index.html`. To customize the footer, you can edit `/layouts/partials/footer.html`
|
||||||
|
|
||||||
More info about partials on [Hugo's website.](https://gohugo.io/templates/partials/)
|
More info about partials on [Hugo's website.](https://gohugo.io/templates/partials/)
|
||||||
|
|
||||||
Still having problems? Checkout our [FAQ and Troubleshooting guide](notes/troubleshooting.md).
|
Still having problems? Checkout our [FAQ and Troubleshooting guide](notes/troubleshooting.md).
|
||||||
|
|
||||||
|
## Language Support
|
||||||
|
[CJK + Latex Support (测试)](notes/CJK%20+%20Latex%20Support%20(测试).md) comes out of the box with Quartz.
|
||||||
|
|
||||||
|
Want to support languages that read from right-to-left (like Arabic)? Hugo (and by proxy, Quartz) supports this natively.
|
||||||
|
|
||||||
|
Follow the steps [Hugo provides here](https://gohugo.io/content-management/multilingual/#configure-languages) and modify your `config.toml`
|
||||||
|
|
||||||
|
For example:
|
||||||
|
|
||||||
|
```toml
|
||||||
|
defaultContentLanguage = 'ar'
|
||||||
|
[languages]
|
||||||
|
[languages.ar]
|
||||||
|
languagedirection = 'rtl'
|
||||||
|
title = 'مدونتي'
|
||||||
|
weight = 1
|
||||||
|
```
|
||||||
|
|||||||
17
content/notes/custom Domain.md
Normal file
17
content/notes/custom Domain.md
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
---
|
||||||
|
title: "Custom Domain"
|
||||||
|
---
|
||||||
|
|
||||||
|
### Registrar
|
||||||
|
This step is only applicable if you are using a **custom domain**! If you are using a `<YOUR-USERNAME>.github.io` domain, you can skip this step.
|
||||||
|
|
||||||
|
For this last bit to take effect, you also need to create a CNAME record with the DNS provider you register your domain with (i.e. NameCheap, Google Domains).
|
||||||
|
|
||||||
|
GitHub has some [documentation on this](https://docs.github.com/en/pages/configuring-a-custom-domain-for-your-github-pages-site/managing-a-custom-domain-for-your-github-pages-site), but the tldr; is to
|
||||||
|
|
||||||
|
1. Go to your forked repository (`github.com/<YOUR-GITHUB-USERNAME>/quartz`) settings page and go to the Pages tab. Under "Custom domain", type your custom domain, then click **Save**.
|
||||||
|
2. Go to your DNS Provider and create a CNAME record that points from your domain to `<YOUR-GITHUB-USERNAME.github.io.` (yes, with the trailing period).
|
||||||
|
|
||||||
|
*Example Configuration for Quartz*
|
||||||
|
3. Wait 30 minutes to an hour for the network changes to kick in.
|
||||||
|
4. Done!
|
||||||
@@ -2,29 +2,18 @@
|
|||||||
title: "Editing Content in Quartz"
|
title: "Editing Content in Quartz"
|
||||||
tags:
|
tags:
|
||||||
- setup
|
- setup
|
||||||
|
weight: -4
|
||||||
---
|
---
|
||||||
|
|
||||||
## Editing
|
## Editing
|
||||||
Quartz runs on top of [Hugo](https://gohugo.io/) so all notes are written in [Markdown](https://www.markdownguide.org/getting-started/).
|
Quartz runs on top of [Hugo](https://gohugo.io/) so all notes are written in [Markdown](https://www.markdownguide.org/getting-started/).
|
||||||
|
|
||||||
### Obsidian
|
|
||||||
I *strongly* recommend using [Obsidian](http://obsidian.md/) as a way to edit and grow your digital garden. It comes with a really nice editor and graphical interface to preview all of my local files.
|
|
||||||
|
|
||||||
🔗 How to link your Obsidian Vault](notes/Obsidian.md)
|
|
||||||
|
|
||||||
Of course, all the files are in Markdown so you could just use your favourite text editor of choice.
|
|
||||||
|
|
||||||
### Ignoring Files
|
|
||||||
Only want to publish a subset of all of your notes? Don't worry, Quartz makes this a simple two-step process.
|
|
||||||
|
|
||||||
❌ [Excluding pages from being published](notes/ignore%20notes.md)
|
|
||||||
|
|
||||||
### Folder Structure
|
### Folder Structure
|
||||||
Here's a rough overview of what's what.
|
Here's a rough overview of what's what.
|
||||||
|
|
||||||
**All content in your garden can found in the `/content` folder.** To make edits, you can open any of the files and make changes directly and save it. You can organize content into any folder you'd like.
|
**All content in your garden can found in the `/content` folder.** To make edits, you can open any of the files and make changes directly and save it. You can organize content into any folder you'd like.
|
||||||
|
|
||||||
**To edit the main home page, open `/content/_index.md`.** This is the home page which is slightly special. You don't need front matter here!
|
**To edit the main home page, open `/content/_index.md`.**
|
||||||
|
|
||||||
To create a link between notes in your garden, just create a normal link using Markdown pointing to the document in question. Please note that **all links should be relative to the root `/content` path**.
|
To create a link between notes in your garden, just create a normal link using Markdown pointing to the document in question. Please note that **all links should be relative to the root `/content` path**.
|
||||||
|
|
||||||
@@ -33,27 +22,45 @@ For example, I want to link this current document to `notes/config.md`.
|
|||||||
[A link to the config page](notes/config.md)
|
[A link to the config page](notes/config.md)
|
||||||
```
|
```
|
||||||
|
|
||||||
### Front Matter
|
Similarly, you can put local images anywhere in the `/content` folder.
|
||||||
Hugo is picky when it comes to metadata for files. Make sure that your title is double-quoted and that you have a title defined at the top of your file like so:
|
|
||||||
|
|
||||||
```markdown
|
```markdown
|
||||||
|
Example image (source is in content/notes/images/example.png)
|
||||||
|

|
||||||
|
```
|
||||||
|
|
||||||
|
You can also use wikilinks if that is what you are more comfortable with!
|
||||||
|
|
||||||
|
### Front Matter
|
||||||
|
Hugo is picky when it comes to metadata for files. Make sure that your title is double-quoted and that you have a title defined at the top of your file like so. You can also add tags here as well.
|
||||||
|
|
||||||
|
```yaml
|
||||||
---
|
---
|
||||||
title: "Example Title"
|
title: "Example Title"
|
||||||
|
tags:
|
||||||
|
- example-tag
|
||||||
---
|
---
|
||||||
|
|
||||||
Rest of your content here...
|
Rest of your content here...
|
||||||
```
|
```
|
||||||
|
|
||||||
## Previewing Changes
|
### Obsidian
|
||||||
This step is purely optional and mostly for those who want to see the published version of their digital garden locally before opening it up to the internet. This is *highly recommended*.
|
I recommend using [Obsidian](http://obsidian.md/) as a way to edit and grow your digital garden. It comes with a really nice editor and graphical interface to preview all of your local files.
|
||||||
|
|
||||||
👀 [Preview Quartz Changes](notes/preview%20changes.md)
|
This step is **highly recommended**.
|
||||||
|
|
||||||
|
> 🔗 Step 3: [How to setup your Obsidian Vault to work with Quartz](notes/obsidian.md)
|
||||||
|
|
||||||
|
## Previewing Changes
|
||||||
|
This step is purely optional and mostly for those who want to see the published version of their digital garden locally before opening it up to the internet. This is *highly recommended* but not required.
|
||||||
|
|
||||||
|
> 👀 Step 4: [Preview Quartz Changes](notes/preview%20changes.md)
|
||||||
|
|
||||||
For those who like to live life more on the edge, viewing the garden through Obsidian gets you pretty close to the real thing.
|
For those who like to live life more on the edge, viewing the garden through Obsidian gets you pretty close to the real thing.
|
||||||
|
|
||||||
## Publishing Changes
|
## Publishing Changes
|
||||||
Now that you know the basics of managing your digital garden using Quartz, you can publish it to the internet!
|
Now that you know the basics of managing your digital garden using Quartz, you can publish it to the internet!
|
||||||
|
|
||||||
🌍 [Hosting Quartz online!](notes/hosting.md)
|
> 🌍 Step 5: [Hosting Quartz online!](notes/hosting.md)
|
||||||
|
|
||||||
Having problems? Checkout our [FAQ and Troubleshooting guide](notes/troubleshooting.md).
|
Having problems? Checkout our [FAQ and Troubleshooting guide](notes/troubleshooting.md).
|
||||||
|
|||||||
@@ -2,27 +2,30 @@
|
|||||||
title: "Deploying Quartz to the Web"
|
title: "Deploying Quartz to the Web"
|
||||||
tags:
|
tags:
|
||||||
- setup
|
- setup
|
||||||
|
weight: -1
|
||||||
|
aliases:
|
||||||
|
- hosting
|
||||||
---
|
---
|
||||||
|
|
||||||
## GitHub Pages
|
## Hosting on GitHub Pages
|
||||||
Quartz is designed to be effortless to deploy. If you forked and cloned Quartz directly from the repository, everything should already be good to go! You can head to `<YOUR-GITHUB-USERNAME.github.io/quartz` to see it live.
|
Quartz is designed to be effortless to deploy. If you forked and cloned Quartz directly from the repository, everything should already be good to go! Follow the steps below.
|
||||||
|
|
||||||
### Enable GitHub Actions
|
### Enable GitHub Actions
|
||||||
By default, GitHub disables workflows from running automatically on Forked Repostories. Head to the 'Actions' tab of your forked repository and Enable Workflows to setup deploying your Quartz site!
|
By default, GitHub disables workflows from running automatically on Forked Repostories. Head to the 'Actions' tab of your forked repository and Enable Workflows to setup deploying your Quartz site!
|
||||||
|
|
||||||
*Enable GitHub Actions*
|
*Enable GitHub Actions*
|
||||||
|
|
||||||
### Enable GitHub Pages
|
### Enable GitHub Pages
|
||||||
|
|
||||||
Head to the 'Settings' tab of your forked repository and go to the 'Pages' tab.
|
Head to the 'Settings' tab of your forked repository and go to the 'Pages' tab.
|
||||||
|
|
||||||
1. Set the source to deploy from `master` using `/ (root)`
|
1. (IMPORTANT) Set the source to deploy from `master` (and not `hugo`) using `/ (root)`
|
||||||
2. Set a custom domain here if you have one!
|
2. Set a custom domain here if you have one!
|
||||||
|
|
||||||
*Enable GitHub Pages*
|
*Enable GitHub Pages*
|
||||||
|
|
||||||
### Pushing Changes
|
### Pushing Changes
|
||||||
To see your changes on the internet, we need to push it them to GitHub. Quartz is essentially a `git` repository so updating it is the same workflow as you would follow as normal.
|
To see your changes on the internet, we need to push it them to GitHub. Quartz is a `git` repository so updating it is the same workflow as you would follow as if it were just a regular software project.
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
# Navigate to Quartz folder
|
# Navigate to Quartz folder
|
||||||
@@ -36,10 +39,14 @@ git commit -m "message describing changes"
|
|||||||
git push origin hugo
|
git push origin hugo
|
||||||
```
|
```
|
||||||
|
|
||||||
|
Note: we specifically push to the `hugo` branch here. Our GitHub action automatically runs everytime a push to is detected to that branch and then updates the `master` branch for redeployment.
|
||||||
|
|
||||||
### Setting up the Site
|
### Setting up the Site
|
||||||
Now let's get this site up and running. Never hosted a site before? No problem. Have a fancy custom domain you already own or want to subdomain your Quartz? That's easy too.
|
Now let's get this site up and running. Never hosted a site before? No problem. Have a fancy custom domain you already own or want to subdomain your Quartz? That's easy too.
|
||||||
|
|
||||||
Here, we take advantage of GitHub's free page hosting to deploy our site. Change `baseURL` in `/config.toml`. If you don't have a custom domain to use, you can use `<YOUR-USERNAME>.github.io` (which GitHub gives to you for free!) as your domain.
|
Here, we take advantage of GitHub's free page hosting to deploy our site. Change `baseURL` in `/config.toml`.
|
||||||
|
|
||||||
|
Make sure that your `baseURL` has a trailing `/`!
|
||||||
|
|
||||||
[Reference `config.toml` here](https://github.com/jackyzha0/quartz/blob/hugo/config.toml)
|
[Reference `config.toml` here](https://github.com/jackyzha0/quartz/blob/hugo/config.toml)
|
||||||
|
|
||||||
@@ -47,7 +54,7 @@ Here, we take advantage of GitHub's free page hosting to deploy our site. Change
|
|||||||
baseURL = "https://<YOUR-DOMAIN>/"
|
baseURL = "https://<YOUR-DOMAIN>/"
|
||||||
```
|
```
|
||||||
|
|
||||||
If you are using this under a subdomain (e.g. `<YOUR-GITHUB-USERNAME>.github.io/quartz`), include the trailing path.
|
If you are using this under a subdomain (e.g. `<YOUR-GITHUB-USERNAME>.github.io/quartz`), include the trailing `/`. **You need to do this especially if you are using GitHub!**
|
||||||
|
|
||||||
```toml
|
```toml
|
||||||
baseURL = "https://<YOUR-GITHUB-USERNAME>.github.io/quartz/"
|
baseURL = "https://<YOUR-GITHUB-USERNAME>.github.io/quartz/"
|
||||||
@@ -55,9 +62,11 @@ baseURL = "https://<YOUR-GITHUB-USERNAME>.github.io/quartz/"
|
|||||||
|
|
||||||
Change `cname` in `/.github/workflows/deploy.yaml`. Again, if you don't have a custom domain to use, you can use `<YOUR-USERNAME>.github.io`.
|
Change `cname` in `/.github/workflows/deploy.yaml`. Again, if you don't have a custom domain to use, you can use `<YOUR-USERNAME>.github.io`.
|
||||||
|
|
||||||
|
Please note that the `cname` field should *not* have any path `e.g. end with /quartz` or have a trailing `/`.
|
||||||
|
|
||||||
[Reference `deploy.yaml` here](https://github.com/jackyzha0/quartz/blob/hugo/.github/workflows/deploy.yaml)
|
[Reference `deploy.yaml` here](https://github.com/jackyzha0/quartz/blob/hugo/.github/workflows/deploy.yaml)
|
||||||
|
|
||||||
```yaml
|
```yaml {title=".github/workflows/deploy.yaml"}
|
||||||
- name: Deploy
|
- name: Deploy
|
||||||
uses: peaceiris/actions-gh-pages@v3
|
uses: peaceiris/actions-gh-pages@v3
|
||||||
with:
|
with:
|
||||||
@@ -67,27 +76,17 @@ Change `cname` in `/.github/workflows/deploy.yaml`. Again, if you don't have a c
|
|||||||
cname: <YOUR-DOMAIN>
|
cname: <YOUR-DOMAIN>
|
||||||
```
|
```
|
||||||
|
|
||||||
### Registrar
|
Have a custom domain? [Learn how to set it up with Quartz ](notes/custom%20Domain.md).
|
||||||
This step is only applicable if you are using a **custom domain**! If you are using `<YOUR-USERNAME>.github.io`, you can skip this step.
|
|
||||||
|
|
||||||
For this last bit to take effect, you also need to create a CNAME record with the DNS provider you register your domain with (i.e. NameCheap, Google Domains).
|
### Ignoring Files
|
||||||
|
Only want to publish a subset of all of your notes? Don't worry, Quartz makes this a simple two-step process.
|
||||||
|
|
||||||
GitHub has some [documentation on this](https://docs.github.com/en/pages/configuring-a-custom-domain-for-your-github-pages-site/managing-a-custom-domain-for-your-github-pages-site), but the tldr; is to
|
❌ [Excluding pages from being published](notes/ignore%20notes.md)
|
||||||
|
|
||||||
1. Go to your forked repository (`github.com/<YOUR-GITHUB-USERNAME>/quartz`) settings page and go to the Pages tab. Under "Custom domain", type your custom domain, then click **Save**.
|
|
||||||
2. Go to your DNS Provider and create a CNAME record that points from your domain to `<YOUR-GITHUB-USERNAME.github.io.` (yes, with the trailing period).
|
|
||||||
|
|
||||||
*Example Configuration for Quartz*
|
|
||||||
3. Wait 30 minutes to an hour for the network changes to kick in.
|
|
||||||
4. Done!
|
|
||||||
|
|
||||||
## External Hosting
|
|
||||||
Don't want to use GitHub Pages? Hugo builds everything for you! Everything is a packaged set of static files ready to deploy in `/public`. You can then upload this folder to a cloud provider to deploy. Alternatively, most providers also give users the option to link a GitHub repository and a folder to deploy. When doing this, ensure you select `/public` folder under the `master` branch.
|
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
Now that your Quartz is live, let's figure out how to make Quartz really *yours*!
|
Now that your Quartz is live, let's figure out how to make Quartz really *yours*!
|
||||||
|
|
||||||
🎨 [Customizing Quartz](notes/config.md)
|
> Step 6: 🎨 [Customizing Quartz](notes/config.md)
|
||||||
|
|
||||||
Having problems? Checkout our [FAQ and Troubleshooting guide](notes/troubleshooting.md).
|
Having problems? Checkout our [FAQ and Troubleshooting guide](notes/troubleshooting.md).
|
||||||
|
|||||||
@@ -2,21 +2,23 @@
|
|||||||
title: "Obsidian Vault Integration"
|
title: "Obsidian Vault Integration"
|
||||||
tags:
|
tags:
|
||||||
- setup
|
- setup
|
||||||
|
weight: -3
|
||||||
---
|
---
|
||||||
|
|
||||||
## Setup
|
## Setup
|
||||||
Obsidian is the preferred way to use Quartz. You can either create a new Obsidian Vault or link one that your already have.
|
Obsidian is the preferred way to use Quartz. You can either create a new Obsidian Vault or link one that your already have.
|
||||||
|
|
||||||
### New Vault
|
### New Vault
|
||||||
If you don't have an existing Vault, [download Obsidian](https://obsidian.md/) and create a new Vault in the `/content` folder that you created and cloned during the [setup](notes/setup.md).
|
If you don't have an existing Vault, [download Obsidian](https://obsidian.md/) and create a new Vault in the `/content` folder that you created and cloned during the [setup](notes/setup.md) step.
|
||||||
|
|
||||||
### Linking an existing Vault
|
### Linking an existing Vault
|
||||||
The easiest way to use an existing Vault is to copy all of our files (directory and hierarchies intact) into the `/content` folder.
|
The easiest way to use an existing Vault is to copy all of your files (directory and hierarchies intact) into the `/content` folder.
|
||||||
|
|
||||||
## Settings
|
## Settings
|
||||||
Great, now that you have your Obsidian linked to your Quartz, let's fix some settings so that they play well.
|
Great, now that you have your Obsidian linked to your Quartz, let's fix some settings so that they play well.
|
||||||
|
|
||||||
Under Options > Files and Links, set the New link format to always be Absolute Path in Vault and disabled WikiLinks so Obsidian generates regular Markdown links.
|
1. Under Options > Files and Links, set the New link format to always use Absolute Path in Vault.
|
||||||
|
2. Go to Settings > Files & Links > Turn "on" automatically update internal links.
|
||||||
|
|
||||||
*Obsidian Settings*
|
*Obsidian Settings*
|
||||||
|
|
||||||
@@ -25,4 +27,6 @@ Inserting front matter everytime you want to create a new Note gets annoying rea
|
|||||||
|
|
||||||
**If you decide to overwrite the `/content` folder completely, don't remove the `/content/templates` folder!**
|
**If you decide to overwrite the `/content` folder completely, don't remove the `/content/templates` folder!**
|
||||||
|
|
||||||
Head over to Options > Core Plugins and enable the Templates plugin. Then go to Options > Hotkeys and set a hotkey for 'Insert Template'. That way, when you create a new note, you can just press the hotkey for a new template and be ready to go!
|
Head over to Options > Core Plugins and enable the Templates plugin. Then go to Options > Hotkeys and set a hotkey for 'Insert Template' (I recommend `[cmd]+T`). That way, when you create a new note, you can just press the hotkey for a new template and be ready to go!
|
||||||
|
|
||||||
|
> 👀 Step 4: [Preview Quartz Changes](notes/preview%20changes.md)
|
||||||
@@ -1,34 +1,37 @@
|
|||||||
---
|
---
|
||||||
title: "Preview Changes"
|
title: "Preview Changes"
|
||||||
|
tags:
|
||||||
|
- setup
|
||||||
|
weight: -2
|
||||||
---
|
---
|
||||||
|
|
||||||
If you'd like to preview what your Quartz site looks like before deploying it to the internet, here's exactly how to do that!
|
If you'd like to preview what your Quartz site looks like before deploying it to the internet, here's exactly how to do that!
|
||||||
|
|
||||||
|
Note that both of these steps need to be completed.
|
||||||
|
|
||||||
## Install `hugo-obsidian`
|
## Install `hugo-obsidian`
|
||||||
This step will generate the list of backlinks for Hugo to parse. Ensure you have [Go](https://golang.org/doc/install) (>= 1.16) installed.
|
This step will generate the list of backlinks for Hugo to parse. Ensure you have [Go](https://golang.org/doc/install) (>= 1.16) installed.
|
||||||
|
|
||||||
```shell
|
```bash
|
||||||
# Install and link `hugo-obsidian` locally
|
# Install and link `hugo-obsidian` locally
|
||||||
$ go install github.com/jackyzha0/hugo-obsidian
|
go install github.com/jackyzha0/hugo-obsidian@latest
|
||||||
|
|
||||||
# Navigate to your local Quartz folder
|
|
||||||
$ cd <location-of-your-local-quartz>
|
|
||||||
|
|
||||||
# Scrape all links in your Quartz folder and generate info for Quartz
|
|
||||||
$ hugo-obsidian -input=content -output=data -index=true
|
|
||||||
```
|
```
|
||||||
|
|
||||||
|
If you are running into an error saying that `command not found: hugo-obsidian`, make sure you set your `GOPATH` correctly! This will allow your terminal to correctly recognize hugo-obsidian as an executable.
|
||||||
|
|
||||||
Afterwards, start the Hugo server as shown above and your local backlinks and interactive graph should be populated!
|
Afterwards, start the Hugo server as shown above and your local backlinks and interactive graph should be populated!
|
||||||
|
|
||||||
## Installing Hugo
|
## Installing Hugo
|
||||||
Hugo is the static site generator that powers Quartz. If you'd like to preview your site locally, [install Hugo](https://gohugo.io/getting-started/installing/).
|
Hugo is the static site generator that powers Quartz. [Install Hugo with "extended" Sass/SCSS version](https://gohugo.io/getting-started/installing/) first. Then,
|
||||||
|
|
||||||
```
|
```bash
|
||||||
# Navigate to your local Quartz folder
|
# Navigate to your local Quartz folder
|
||||||
$ cd <location-of-your-local-quartz>
|
cd <location-of-your-local-quartz>
|
||||||
|
|
||||||
# Start local server
|
# Start local server
|
||||||
$ hugo server
|
make serve
|
||||||
|
|
||||||
# View your site in a browser at http://localhost:1313/
|
# View your site in a browser at http://localhost:1313/
|
||||||
```
|
```
|
||||||
|
|
||||||
|
> 🌍 Step 5: [Hosting Quartz online!](notes/hosting.md)
|
||||||
50
content/notes/search.md
Normal file
50
content/notes/search.md
Normal file
@@ -0,0 +1,50 @@
|
|||||||
|
---
|
||||||
|
title: "Search"
|
||||||
|
---
|
||||||
|
|
||||||
|
Quartz supports two modes of searching through content.
|
||||||
|
|
||||||
|
## Full-text
|
||||||
|
Full-text search is the default in Quartz. It produces results that *exactly* match the search query. This is easier to setup but usually produces lower quality matches.
|
||||||
|
|
||||||
|
```yaml {title="data/config.yaml"}
|
||||||
|
# the default option
|
||||||
|
enableSemanticSearch: false
|
||||||
|
```
|
||||||
|
|
||||||
|
## Natural Language
|
||||||
|
Natural language search is powered by [Operand](https://operand.ai/). It understands language like a person does and finds results that best match user intent. In this sense, it is closer to how Google Search works.
|
||||||
|
|
||||||
|
Natural language search tends to produce higher quality results than full-text search.
|
||||||
|
|
||||||
|
Here's how to set it up.
|
||||||
|
|
||||||
|
1. Create an Operand Account on [their website](https://operand.ai/).
|
||||||
|
2. Go to Dashboard > Settings > Integrations.
|
||||||
|
3. Follow the steps to setup the GitHub integration. Operand needs access to GitHub in order to index your digital garden properly!
|
||||||
|
4. Head over to Dashboard > Objects and press `(Cmd + K)` to open the omnibar and select 'Create Collection'.
|
||||||
|
1. Set the 'Collection Label' to something that will help you remember it.
|
||||||
|
2. You can leave the 'Parent Collection' field empty.
|
||||||
|
5. Click into your newly made Collection.
|
||||||
|
1. Press the 'share' button that looks like three dots connected by lines.
|
||||||
|
2. Set the 'Interface Type' to `object-search` and click 'Create'.
|
||||||
|
3. This will bring you to a new page with a search bar. Ignore this for now.
|
||||||
|
6. Go back to Dashboard > Settings > API Keys and find your Quartz-specific Operand API key under 'Other keys'.
|
||||||
|
1. Copy the key (which looks something like `0e733a7f-9b9c-48c6-9691-b54fa1c8b910`).
|
||||||
|
2. Open `data/config.yaml`. Set `enableSemanticSearch` to `true` and `operandApiKey` to your copied key.
|
||||||
|
|
||||||
|
```yaml {title="data/config.yaml"}
|
||||||
|
# the default option
|
||||||
|
enableSemanticSearch: true
|
||||||
|
operandApiKey: "0e733a7f-9b9c-48c6-9691-b54fa1c8b910"
|
||||||
|
```
|
||||||
|
7. Make a commit and push your changes to GitHub. See the [[notes/hosting|hosting]] page if you haven't done this already.
|
||||||
|
1. This step is *required* for Operand to be able to properly index your content.
|
||||||
|
2. Head over to Dashboard > Objects and select the collection that you made earlier
|
||||||
|
8. Press `(Cmd + K)` to open the omnibar again and select 'Create GitHub Repo'
|
||||||
|
1. Set the 'Repository Label' to `Quartz`
|
||||||
|
2. Set the 'Repository Owner' to your GitHub username
|
||||||
|
3. Set the 'Repository Ref' to `master`
|
||||||
|
4. Set the 'Repository Name' to the name of your repository (usually just `quartz` if you forked the repository without changing the name)
|
||||||
|
5. Leave 'Root Path' and 'Root URL' empty
|
||||||
|
9. Wait for your repository to index and enjoy natural language search in Quartz! Operand refreshes the index every 2h so all you need to do is just push to GitHub to update the contents in the search.
|
||||||
@@ -2,6 +2,7 @@
|
|||||||
title: "Setup"
|
title: "Setup"
|
||||||
tags:
|
tags:
|
||||||
- setup
|
- setup
|
||||||
|
weight: -5
|
||||||
---
|
---
|
||||||
|
|
||||||
## Making your own Quartz
|
## Making your own Quartz
|
||||||
@@ -20,12 +21,12 @@ Then, Fork the repository into your own GitHub account. If you don't have an acc
|
|||||||
After you've made a fork of the repository, you need to download the files locally onto your machine. Ensure you have `git`, then type the following command replacing `YOUR-USERNAME` with your GitHub username.
|
After you've made a fork of the repository, you need to download the files locally onto your machine. Ensure you have `git`, then type the following command replacing `YOUR-USERNAME` with your GitHub username.
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
$ git clone https://github.com/YOUR-USERNAME/quartz
|
git clone https://github.com/YOUR-USERNAME/quartz
|
||||||
```
|
```
|
||||||
|
|
||||||
## Editing
|
## Editing
|
||||||
Great! Now you have everything you need to start editing and growing your digital garden. If you're ready to start writing content already, check out the recommended flow for editing notes in Quartz.
|
Great! Now you have everything you need to start editing and growing your digital garden. If you're ready to start writing content already, check out the recommended flow for editing notes in Quartz.
|
||||||
|
|
||||||
✏️ [Editing Notes in Quartz](notes/editing.md)
|
> ✏️ Step 2: [Editing Notes in Quartz](notes/editing.md)
|
||||||
|
|
||||||
Having problems? Checkout our [FAQ and Troubleshooting guide](notes/troubleshooting.md).
|
Having problems? Checkout our [FAQ and Troubleshooting guide](notes/troubleshooting.md).
|
||||||
|
|||||||
@@ -5,12 +5,14 @@ title: "Showcase"
|
|||||||
Want to see what Quartz can do? Here are some cool community gardens :)
|
Want to see what Quartz can do? Here are some cool community gardens :)
|
||||||
|
|
||||||
- [Quartz Documentation (this site!)](https://quartz.jzhao.xyz/)
|
- [Quartz Documentation (this site!)](https://quartz.jzhao.xyz/)
|
||||||
- [Strengthening Online Social Bonds: Research Garden](https://communities.digital/)
|
- [Jacky Zhao's Garden](https://jzhao.xyz/)
|
||||||
- [Jacky Zhao's Garden](https://garden.jzhao.xyz/)
|
- [Scaling Synthesis - A hypertext research notebook](https://scalingsynthesis.com/)
|
||||||
- [Anson Yu's Garden](http://garden.ansonyu.me/)
|
- [AWAGMI Intern Notes](https://notes.awagmi.xyz/)
|
||||||
- [Shihyu's PKM](https://shihyuho.github.io/pkm/)
|
- [Shihyu's PKM](https://shihyuho.github.io/pkm/)
|
||||||
- [Chloe's Garden](https://garden.chloeabrasada.online/)
|
- [Chloe's Garden](https://garden.chloeabrasada.online/)
|
||||||
- [SlRvb's Site](https://slrvb.github.io/Site/)
|
- [SlRvb's Site](https://slrvb.github.io/Site/)
|
||||||
- [Course notes for Information Technology Advanced Theory](https://a2itnotes.github.io/quartz/)
|
- [Course notes for Information Technology Advanced Theory](https://a2itnotes.github.io/quartz/)
|
||||||
|
- [Brandon Boswell's Garden](https://brandonkboswell.com)
|
||||||
|
- [Siyang's Courtyard](https://siyangsun.github.io/courtyard/)
|
||||||
|
|
||||||
If you want to see your own on here, submit a [Pull Request adding yourself to this file](https://github.com/jackyzha0/quartz/blob/hugo/content/moc/showcase.md)!
|
If you want to see your own on here, submit a [Pull Request adding yourself to this file](https://github.com/jackyzha0/quartz/blob/hugo/content/notes/showcase.md)!
|
||||||
@@ -2,7 +2,21 @@
|
|||||||
title: "Troubleshooting and FAQ"
|
title: "Troubleshooting and FAQ"
|
||||||
---
|
---
|
||||||
|
|
||||||
## Common Pitfalls
|
Still having trouble? Here are a list of common questions and problems people encounter when installing Quartz.
|
||||||
|
|
||||||
|
While you're here, join our [Discord](https://discord.gg/cRFFHYye7t) :)
|
||||||
|
|
||||||
|
### Does Quartz have Latex support?
|
||||||
|
Yes! See [CJK + Latex Support (测试)](notes/CJK%20+%20Latex%20Support%20(测试).md) for a brief demo.
|
||||||
|
|
||||||
|
### Can I use \<Obsidian Plugin\> in Quartz?
|
||||||
|
Unless it produces direct Markdown output in the file, no. There currently is no way to bundle plugin code with Quartz.
|
||||||
|
|
||||||
|
The easiest way would be to add your own HTML partial that supports the functionality you are looking for.
|
||||||
|
|
||||||
|
### My GitHub pages is just showing the README and not Quartz
|
||||||
|
Make sure you set the source to deploy from `master` (and not `hugo`) using `/ (root)`! See more in the [hosting](/notes/hosting) guide
|
||||||
|
|
||||||
### Some of my pages have 'January 1, 0001' as the last modified date
|
### Some of my pages have 'January 1, 0001' as the last modified date
|
||||||
This is a problem caused by `git` treating files as case-insensitive by default and some of your posts probably have capitalized file names. You can turn this off in your Quartz by running this command.
|
This is a problem caused by `git` treating files as case-insensitive by default and some of your posts probably have capitalized file names. You can turn this off in your Quartz by running this command.
|
||||||
|
|
||||||
@@ -20,9 +34,6 @@ Yes! Quartz makes selective publishing really easy. Heres a guide on [excluding
|
|||||||
### Can I host this myself and not on GitHub Pages?
|
### Can I host this myself and not on GitHub Pages?
|
||||||
Yes! All built files can be found under `/public` in the `master` branch. More details under [hosting](notes/hosting.md).
|
Yes! All built files can be found under `/public` in the `master` branch. More details under [hosting](notes/hosting.md).
|
||||||
|
|
||||||
### Do I need a website already?
|
|
||||||
No! Setting up Quartz means you set up a site too :)
|
|
||||||
|
|
||||||
### `command not found: hugo-obsidian`
|
### `command not found: hugo-obsidian`
|
||||||
Make sure you set your `GOPATH` correctly! This will allow your terminal to correctly recognize `hugo-obsidian` as an executable.
|
Make sure you set your `GOPATH` correctly! This will allow your terminal to correctly recognize `hugo-obsidian` as an executable.
|
||||||
|
|
||||||
@@ -36,7 +47,7 @@ source ~/.bash_profile
|
|||||||
```
|
```
|
||||||
|
|
||||||
### How come my notes aren't being rendered?
|
### How come my notes aren't being rendered?
|
||||||
You probably forgot to include front matter in your Markdown files. You can either setup [Obsidian](notes/Obsidian.md) to do this for you or you need to manually define it. More details in [the 'how to edit' guide](notes/editing.md).
|
You probably forgot to include front matter in your Markdown files. You can either setup [Obsidian](notes/obsidian.md) to do this for you or you need to manually define it. More details in [the 'how to edit' guide](notes/editing.md).
|
||||||
|
|
||||||
### My custom domain isn't working!
|
### My custom domain isn't working!
|
||||||
Walk through the steps in [the hosting guide](notes/hosting.md) again. Make sure you wait 30 min to 1 hour for changes to take effect.
|
Walk through the steps in [the hosting guide](notes/hosting.md) again. Make sure you wait 30 min to 1 hour for changes to take effect.
|
||||||
@@ -51,7 +62,7 @@ To edit the main home page, open `/content/_index.md`.
|
|||||||
You can change the theme by editing `assets/custom.scss`. More details on customization and themeing can be found in the [customization guide](notes/config.md).
|
You can change the theme by editing `assets/custom.scss`. More details on customization and themeing can be found in the [customization guide](notes/config.md).
|
||||||
|
|
||||||
### How do I add images?
|
### How do I add images?
|
||||||
You can put images anywhere in the `/content` folder. The only caveat is that you should reference them in your Markdown by prefixing it with a `/`.
|
You can put images anywhere in the `/content` folder.
|
||||||
|
|
||||||
```markdown
|
```markdown
|
||||||
Example image (source is in content/notes/images/example.png)
|
Example image (source is in content/notes/images/example.png)
|
||||||
@@ -59,7 +70,7 @@ Example image (source is in content/notes/images/example.png)
|
|||||||
```
|
```
|
||||||
|
|
||||||
### My Interactive Graph and Backlinks aren't up to date
|
### My Interactive Graph and Backlinks aren't up to date
|
||||||
By default, the `linkIndex.yaml` (which Quartz needs to generate the Interactive Graph and Backlinks) are not regenerated locally. To set that up, see the guide on [local editing](notes/editing.md)
|
By default, the `linkIndex.json` (which Quartz needs to generate the Interactive Graph and Backlinks) are not regenerated locally. To set that up, see the guide on [local editing](notes/editing.md)
|
||||||
|
|
||||||
### Can I use React/Vue/some other framework?
|
### Can I use React/Vue/some other framework?
|
||||||
Not out of the box. You could probably make it work by editing `/layouts/_default/single.html` but that's not what Quartz is designed to work with. 99% of things you are trying to do with those frameworks you can accomplish perfectly fine using just vanilla HTML/CSS/JS.
|
Not out of the box. You could probably make it work by editing `/layouts/_default/single.html` but that's not what Quartz is designed to work with. 99% of things you are trying to do with those frameworks you can accomplish perfectly fine using just vanilla HTML/CSS/JS.
|
||||||
|
|||||||
34
content/notes/updating.md
Normal file
34
content/notes/updating.md
Normal file
@@ -0,0 +1,34 @@
|
|||||||
|
---
|
||||||
|
title: "Updating"
|
||||||
|
aliases:
|
||||||
|
- update
|
||||||
|
---
|
||||||
|
|
||||||
|
Haven't updated Quartz in a while and want all the cool new optimizations? On Unix/Mac systems you can run the following command for a one-line update! This command will show you a log summary of all commits since you last updated, press `q` to acknowledge this. Then, it will show you each change in turn and press `y` to accept the patch or `n` to reject it. Usually you should press `y` for most of these unless it conflicts with existing changes you've made!
|
||||||
|
|
||||||
|
```shell
|
||||||
|
make update
|
||||||
|
```
|
||||||
|
|
||||||
|
Or, if you don't want the interactive parts and just want to force update your local garden (this assumed that you are okay with some of your personalizations been overriden!)
|
||||||
|
|
||||||
|
```shell
|
||||||
|
make update-force
|
||||||
|
```
|
||||||
|
|
||||||
|
Or, manually checkout the changes yourself.
|
||||||
|
|
||||||
|
> [!warning] Warning!
|
||||||
|
>
|
||||||
|
> If you customized the files in `data/`, or anything inside `layouts/`, your customization may be overwritten!
|
||||||
|
> Make sure you have a copy of these changes if you don't want to lose them.
|
||||||
|
|
||||||
|
|
||||||
|
```shell
|
||||||
|
# add Quartz as a remote host
|
||||||
|
git remote add upstream git@github.com:jackyzha0/quartz.git
|
||||||
|
|
||||||
|
# index and fetch changes
|
||||||
|
git fetch upstream
|
||||||
|
git checkout -p upstream/hugo -- layouts .github Makefile assets/js assets/styles/base.scss assets/styles/darkmode.scss config.toml data
|
||||||
|
```
|
||||||
@@ -1,13 +1,26 @@
|
|||||||
name: Jacky Zhao
|
name: Jacky Zhao
|
||||||
enableToc: true
|
enableToc: true
|
||||||
|
openToc: false
|
||||||
enableLinkPreview: true
|
enableLinkPreview: true
|
||||||
|
enableLatex: true
|
||||||
|
enableCodeBlockTitle: true
|
||||||
|
enableCodeBlockCopy: true
|
||||||
|
enableCallouts: true
|
||||||
|
enableSPA: true
|
||||||
|
enableFooter: true
|
||||||
|
enableContextualBacklinks: true
|
||||||
|
enableRecentNotes: false
|
||||||
|
enableGitHubEdit: true
|
||||||
|
GitHubLink: https://github.com/jackyzha0/quartz/tree/hugo/content
|
||||||
|
enableSemanticSearch: false
|
||||||
|
operandApiKey: "REPLACE-WITH-YOUR-OPERAND-API-KEY"
|
||||||
description:
|
description:
|
||||||
Here is the page description. This is an example Quartz site that details installation,
|
Host your second brain and digital garden for free. Quartz features extremely fast full-text search,
|
||||||
setup, customization, and troubleshooting for Quartz itself.
|
Wikilink support, backlinks, local graph, tags, and link previews.
|
||||||
page_title:
|
page_title:
|
||||||
"🪴 Quartz 3"
|
"🪴 Quartz 3.2"
|
||||||
links:
|
links:
|
||||||
- link_name: Twitter
|
- link_name: Twitter
|
||||||
link: https://twitter.com/_jzhao
|
link: https://twitter.com/_jzhao
|
||||||
- link_name: Github
|
- link_name: Github
|
||||||
link: https://github.com/jackyzha0
|
link: https://github.com/jackyzha0
|
||||||
|
|||||||
@@ -1,6 +1,37 @@
|
|||||||
enableLegend: false
|
# if true, a Global Graph will be shown on home page with full width, no backlink.
|
||||||
enableDrag: true
|
# A different set of Local Graphs will be shown on sub pages.
|
||||||
enableZoom: true
|
# if false, Local Graph will be default on every page as usual
|
||||||
depth: -1 # set to -1 to show full graph
|
enableGlobalGraph: false
|
||||||
|
|
||||||
|
### Local Graph ###
|
||||||
|
|
||||||
|
localGraph:
|
||||||
|
enableLegend: false
|
||||||
|
enableDrag: true
|
||||||
|
enableZoom: true
|
||||||
|
depth: 1 # set to -1 to show full graph
|
||||||
|
scale: 1.2
|
||||||
|
repelForce: 2
|
||||||
|
centerForce: 1
|
||||||
|
linkDistance: 1
|
||||||
|
fontSize: 0.6
|
||||||
|
opacityScale: 3
|
||||||
|
|
||||||
|
### Global Graph ###
|
||||||
|
|
||||||
|
globalGraph:
|
||||||
|
enableLegend: false
|
||||||
|
enableDrag: true
|
||||||
|
enableZoom: true
|
||||||
|
depth: -1 # set to -1 to show full graph
|
||||||
|
scale: 1.4
|
||||||
|
repelForce: 1
|
||||||
|
centerForce: 1
|
||||||
|
linkDistance: 1
|
||||||
|
fontSize: 0.5
|
||||||
|
opacityScale: 3
|
||||||
|
|
||||||
|
### For all graphs ###
|
||||||
|
|
||||||
paths:
|
paths:
|
||||||
- /moc: "#4388cc"
|
- /moc: "#4388cc"
|
||||||
|
|||||||
65
i18n/ar.toml
Normal file
65
i18n/ar.toml
Normal file
@@ -0,0 +1,65 @@
|
|||||||
|
[404_message]
|
||||||
|
other = "يبدو أنك ضللت الطريق. هذه الصفحة غير موجودة (أو قد تكون خاصة)."
|
||||||
|
|
||||||
|
[404_back]
|
||||||
|
other = "↳ العودة للرئيسية."
|
||||||
|
|
||||||
|
[all_posts]
|
||||||
|
other = "كل منشورات {{.Title}}"
|
||||||
|
|
||||||
|
[last_updated]
|
||||||
|
other = "آخر تعديل"
|
||||||
|
|
||||||
|
[notes_count]
|
||||||
|
other = "ملاحظات بهذه التسمية"
|
||||||
|
|
||||||
|
[first_10]
|
||||||
|
other = "(تعرض أول 10 نتائج فقط)"
|
||||||
|
|
||||||
|
[tag]
|
||||||
|
other = "التسمية"
|
||||||
|
|
||||||
|
[backlinks]
|
||||||
|
other = "الروابط الخلفية"
|
||||||
|
|
||||||
|
[no_backlinks]
|
||||||
|
other = "لا توجد روابط خلفية"
|
||||||
|
|
||||||
|
[home]
|
||||||
|
other = "الرئيسية"
|
||||||
|
|
||||||
|
[light_mode]
|
||||||
|
other = "السمة الفاتحة"
|
||||||
|
|
||||||
|
[dark_mode]
|
||||||
|
other = "السمة الداكنة"
|
||||||
|
|
||||||
|
[edit_source]
|
||||||
|
other = "تعديل المصدر"
|
||||||
|
|
||||||
|
[interactive_graph]
|
||||||
|
other = "المخطط التفاعلي"
|
||||||
|
|
||||||
|
[search]
|
||||||
|
other = "البحث"
|
||||||
|
|
||||||
|
[search_icon]
|
||||||
|
other = "أيقونة البحث"
|
||||||
|
|
||||||
|
[icon_search]
|
||||||
|
other = "أيقونة فتح نافذة البحث"
|
||||||
|
|
||||||
|
[recent_notes]
|
||||||
|
other = "الملاحظات اﻷخيرة"
|
||||||
|
|
||||||
|
[first_3_notes]
|
||||||
|
other = "أول 3 {{ .notes }}"
|
||||||
|
|
||||||
|
[search_for_something]
|
||||||
|
other = "ابحث عن شيء ما..."
|
||||||
|
|
||||||
|
[toc]
|
||||||
|
other = "الفهرس"
|
||||||
|
|
||||||
|
[copyright]
|
||||||
|
other = "صُمم بواسطة {{ .name }} باستخدام <a href='https://github.com/jackyzha0/quartz'>كوارتز</a>، {{ .year }} ©"
|
||||||
65
i18n/en.toml
Normal file
65
i18n/en.toml
Normal file
@@ -0,0 +1,65 @@
|
|||||||
|
[404_message]
|
||||||
|
other = "Hey! You look a little lost. This page doesn't exist (or may be private)."
|
||||||
|
|
||||||
|
[404_back]
|
||||||
|
other = "↳ Let's get you home."
|
||||||
|
|
||||||
|
[all_posts]
|
||||||
|
other = "All {{.Title}}"
|
||||||
|
|
||||||
|
[last_updated]
|
||||||
|
other = "Last updated"
|
||||||
|
|
||||||
|
[notes_count]
|
||||||
|
other = "notes with this tag"
|
||||||
|
|
||||||
|
[first_10]
|
||||||
|
other = "showing first 10 results"
|
||||||
|
|
||||||
|
[tag]
|
||||||
|
other = "Tag"
|
||||||
|
|
||||||
|
[backlinks]
|
||||||
|
other = "Backlinks"
|
||||||
|
|
||||||
|
[no_backlinks]
|
||||||
|
other = "No backlinks found"
|
||||||
|
|
||||||
|
[home]
|
||||||
|
other = "Home"
|
||||||
|
|
||||||
|
[light_mode]
|
||||||
|
other = "Light Mode"
|
||||||
|
|
||||||
|
[dark_mode]
|
||||||
|
other = "Dark Mode"
|
||||||
|
|
||||||
|
[edit_source]
|
||||||
|
other = "Edit Source"
|
||||||
|
|
||||||
|
[interactive_graph]
|
||||||
|
other = "Interactive Graph"
|
||||||
|
|
||||||
|
[search]
|
||||||
|
other = "Search"
|
||||||
|
|
||||||
|
[search_icon]
|
||||||
|
other = "Search Icon"
|
||||||
|
|
||||||
|
[icon_search]
|
||||||
|
other = "Icon to open search"
|
||||||
|
|
||||||
|
[recent_notes]
|
||||||
|
other = "Recent Notes"
|
||||||
|
|
||||||
|
[first_3_notes]
|
||||||
|
other = "first 3 {{ .notes }}"
|
||||||
|
|
||||||
|
[search_for_something]
|
||||||
|
other = "Search for something..."
|
||||||
|
|
||||||
|
[toc]
|
||||||
|
other = "Table of Contents"
|
||||||
|
|
||||||
|
[copyright]
|
||||||
|
other = "Made by {{ .name }} using <a href=\"https://github.com/jackyzha0/quartz\">Quartz</a>, © {{ .year }}"
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html lang="en">
|
<html lang="{{ .Lang }}">
|
||||||
{{ partial "head.html" . }}
|
{{ partial "head.html" . }}
|
||||||
|
|
||||||
<body>
|
<body>
|
||||||
@@ -7,10 +7,9 @@
|
|||||||
{{partial "darkmode.html" .}}
|
{{partial "darkmode.html" .}}
|
||||||
<div class="centered">
|
<div class="centered">
|
||||||
<h1>404.</h1>
|
<h1>404.</h1>
|
||||||
<h3>Hey! You look a little lost. This page doesn't exist (or may be private).</h3>
|
<h3>{{ i18n "404_message" }}</h3>
|
||||||
<a href="/">↳ Let's get you home.</a>
|
<a href="{{ .Site.BaseURL }}">{{ i18n "404_back" }}</a>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</body>
|
</body>
|
||||||
|
|
||||||
</html>
|
</html>
|
||||||
|
|||||||
9
layouts/_default/_markup/render-image.html
Normal file
9
layouts/_default/_markup/render-image.html
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
{{$src := .Destination | safeURL }}
|
||||||
|
{{$width := index (split .Text "|") 1 | default "auto" }}
|
||||||
|
{{$external := strings.HasPrefix $src "http" }}
|
||||||
|
{{- if $external -}}
|
||||||
|
<img src="{{ $src }}" width="{{ $width }}" alt="{{ .Text }}" {{ with .Title }} title="{{ . }}" {{ end }} />
|
||||||
|
{{- else -}}
|
||||||
|
{{$fixedUrl := (cond (hasPrefix $src "/") $src (print "/" $src)) | urlize}}
|
||||||
|
<img src="{{.Page.Site.BaseURL}}{{ $fixedUrl }}" width="{{ $width }}" alt="{{ .Text }}" {{ with .Title }} title="{{ . }}" {{ end }} />
|
||||||
|
{{- end -}}
|
||||||
@@ -1,9 +1,16 @@
|
|||||||
{{$trimmed := strings.TrimSuffix ".md" (.Destination | safeURL)}}
|
{{$trimmed := strings.TrimSuffix ".md" (.Destination | safeURL)}}
|
||||||
{{$trimmed = replace $trimmed "%20" "-" }}
|
{{$dashedurl := replace $trimmed "%20" "-" }}
|
||||||
{{$external := strings.HasPrefix $trimmed "http" }}
|
{{$external := strings.HasPrefix $dashedurl "http" }}
|
||||||
{{- if $external -}}
|
{{- if $external -}}
|
||||||
<a href="{{ $trimmed }}" rel="noopener">{{ .Text | safeHTML }}</a>
|
<a href="{{ $dashedurl }}" rel="noopener">{{ .Text | safeHTML }}</a>
|
||||||
{{- else -}}
|
{{- else -}}
|
||||||
{{$fixedUrl := (cond (hasPrefix $trimmed "/") $trimmed (print "/" $trimmed)) | urlize}}
|
{{$spacedurl := replace $trimmed "%20" " " }}
|
||||||
<a href="{{$fixedUrl}}" rel="noopener" class="internal-link" data-src="{{$fixedUrl}}">{{ .Text | safeHTML }}</a>
|
{{$fixedUrl := (cond (hasPrefix $spacedurl "/") $spacedurl (print "/" $spacedurl)) | urlize}}
|
||||||
{{- end -}}
|
{{$nonexistent := eq (.Page.GetPage $spacedurl).RelPermalink ""}}
|
||||||
|
{{$rooted := default $spacedurl ((.Page.GetPage $spacedurl).RelPermalink) }}
|
||||||
|
<a
|
||||||
|
{{if not $nonexistent}}href="{{$rooted}}"{{end}}
|
||||||
|
rel="noopener" class="internal-link{{if $nonexistent}} broken{{end}}"
|
||||||
|
data-src="{{$rooted}}">{{- .Text | safeHTML -}}
|
||||||
|
</a>
|
||||||
|
{{- end -}}
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html lang="en">
|
<html lang="{{ .Lang }}">
|
||||||
{{ block "head" . }}
|
{{ block "head" . }}
|
||||||
{{ end }}
|
{{ end }}
|
||||||
|
|
||||||
|
|||||||
@@ -1,24 +1,21 @@
|
|||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html lang="en">
|
<html lang="{{ .Lang }}">
|
||||||
{{ partial "head.html" . }}
|
{{ partial "head.html" . }}
|
||||||
|
|
||||||
<body>
|
<body>
|
||||||
{{partial "search.html" .}}
|
{{partial "search.html" .}}
|
||||||
<div class="singlePage">
|
<div class="singlePage">
|
||||||
<!-- Begin actual content -->
|
<!-- Begin actual content -->
|
||||||
<header>
|
{{partial "header.html" .}}
|
||||||
<h1 id="page-title"><a href="{{ .Site.BaseURL }}">{{ .Site.Data.config.page_title }}</a></h1>
|
|
||||||
<svg tabindex="0" id="search-icon" aria-labelledby="title desc" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 19.9 19.7"><title id="title">Search Icon</title><desc id="desc">Icon to open search</desc><g class="search-path" fill="none"><path stroke-linecap="square" d="M18.5 18.3l-5.4-5.4"/><circle cx="8" cy="8" r="7"/></g></svg>
|
|
||||||
<div class="spacer"></div>
|
|
||||||
{{partial "darkmode.html" .}}
|
|
||||||
</header>
|
|
||||||
<article>
|
<article>
|
||||||
<h1>All {{.Title}}</h1>
|
<h1>{{ i18n "all_posts" . }}</h1>
|
||||||
|
{{with .Params.description}}
|
||||||
|
<p>{{.}}</p>
|
||||||
|
{{end}}
|
||||||
{{partial "page-list.html" .Paginator.Pages.ByLastmod.Reverse }}
|
{{partial "page-list.html" .Paginator.Pages.ByLastmod.Reverse }}
|
||||||
{{ template "_internal/pagination.html" .}}
|
{{ template "_internal/pagination.html" .}}
|
||||||
</article>
|
</article>
|
||||||
{{partial "contact.html" .}}
|
{{partial "contact.html" .}}
|
||||||
</div>
|
</div>
|
||||||
</body>
|
</body>
|
||||||
|
|
||||||
</html>
|
</html>
|
||||||
|
|||||||
@@ -1,38 +1,27 @@
|
|||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html lang="en">
|
<html lang="{{ .Lang }}">
|
||||||
{{ partial "head.html" . }}
|
{{ partial "head.html" . }}
|
||||||
|
|
||||||
<body>
|
<body>
|
||||||
{{partial "search.html" .}}
|
{{partial "search.html" .}}
|
||||||
<div class="singlePage">
|
<div class="singlePage">
|
||||||
<!-- Begin actual content -->
|
<!-- Begin actual content -->
|
||||||
<header>
|
{{partial "header.html" .}}
|
||||||
<h1 id="page-title"><a href="{{ .Site.BaseURL }}">{{ .Site.Data.config.page_title }}</a></h1>
|
<article>
|
||||||
<svg tabindex="0" id="search-icon" aria-labelledby="title desc" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 19.9 19.7"><title id="title">Search Icon</title><desc id="desc">Icon to open search</desc><g class="search-path" fill="none"><path stroke-linecap="square" d="M18.5 18.3l-5.4-5.4"/><circle cx="8" cy="8" r="7"/></g></svg>
|
|
||||||
<div class="spacer"></div>
|
|
||||||
{{partial "darkmode.html" .}}
|
|
||||||
</header>
|
|
||||||
<article>
|
|
||||||
{{if .Title}}<h1>{{ .Title }}</h1>{{end}}
|
{{if .Title}}<h1>{{ .Title }}</h1>{{end}}
|
||||||
<p class="meta">
|
<p class="meta">
|
||||||
Last updated {{if ne .Date .Lastmod}}{{ .Lastmod.Format "January 2, 2006" }}{{else}}Unknown{{end}}
|
{{ i18n "last_updated" }} {{ partial "date-fmt.html" .}}
|
||||||
|
{{ partial "github.html" . }}
|
||||||
</p>
|
</p>
|
||||||
<ul class="tags">
|
<ul class="tags">
|
||||||
{{ range (.GetTerms "tags") }}
|
{{ range (.GetTerms "tags") }}
|
||||||
<li><a href="{{ .Permalink }}">{{ .LinkTitle | humanize }}</a></li>
|
<li><a href="{{ .Permalink }}">{{ .LinkTitle | humanize }}</a></li>
|
||||||
{{ end }}
|
{{ end }}
|
||||||
</ul>
|
</ul>
|
||||||
{{if $.Site.Data.config.enableToc}}
|
{{partial "toc.html" .}}
|
||||||
<aside class="mainTOC">
|
{{partial "textprocessing.html" . }}
|
||||||
<h3>Table of Contents</h3>
|
|
||||||
{{ .TableOfContents }}
|
|
||||||
</aside>
|
|
||||||
{{end}}
|
|
||||||
{{.Content}}
|
|
||||||
|
|
||||||
</article>
|
</article>
|
||||||
{{partial "footer.html" .}}
|
{{partial "footer.html" .}}
|
||||||
</div>
|
</div>
|
||||||
</body>
|
</body>
|
||||||
|
|
||||||
</html>
|
</html>
|
||||||
|
|||||||
@@ -1,27 +1,25 @@
|
|||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html lang="en">
|
<html lang="{{ .Lang }}">
|
||||||
{{ partial "head.html" . }}
|
{{ partial "head.html" . }}
|
||||||
|
|
||||||
<body>
|
<body>
|
||||||
{{partial "search.html" .}}
|
{{partial "search.html" .}}
|
||||||
<div class="singlePage">
|
<div class="singlePage">
|
||||||
<!-- Begin actual content -->
|
<!-- Begin actual content -->
|
||||||
<header>
|
{{partial "header.html" .}}
|
||||||
<h1 id="page-title"><a href="{{ .Site.BaseURL }}">{{ .Site.Data.config.page_title }}</a></h1>
|
|
||||||
<svg tabindex="0" id="search-icon" aria-labelledby="title desc" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 19.9 19.7"><title id="title">Search Icon</title><desc id="desc">Icon to open search</desc><g class="search-path" fill="none"><path stroke-linecap="square" d="M18.5 18.3l-5.4-5.4"/><circle cx="8" cy="8" r="7"/></g></svg>
|
|
||||||
<div class="spacer"></div>
|
|
||||||
{{partial "darkmode.html" .}}
|
|
||||||
</header>
|
|
||||||
<article>
|
<article>
|
||||||
<h1>All {{.Title}}</h1>
|
<h1>{{ i18n "all_posts" . }}</h1>
|
||||||
|
{{with .Params.description}}
|
||||||
|
<p>{{.}}</p>
|
||||||
|
{{end}}
|
||||||
<div class="tags">
|
<div class="tags">
|
||||||
{{ range .Site.Taxonomies.tags.ByCount }}
|
{{ range .Site.Taxonomies.tags.ByCount }}
|
||||||
<div class="meta">
|
<div class="meta">
|
||||||
<h1><a href="{{ .Page.Permalink }}">{{ .Page.Title }}</a></h1>
|
<h1><a href="{{ .Page.Permalink }}">{{ .Page.Title | humanize }}</a></h1>
|
||||||
<p><b>{{ .Count }}</b> notes with this tag {{if gt .Count 2}}(showing first 2 results){{end}}</p>
|
<p><b>{{ .Count }}</b> {{ i18n "notes_count" }} {{if gt .Count 10}}({{ i18n "first_10"}}){{end}}</p>
|
||||||
</div>
|
</div>
|
||||||
{{ with ($.Site.GetPage (printf "/tags/%s" .Page.Title)) }}
|
{{ with ($.Site.GetPage (printf "/tags/%s" .Page.Title)) }}
|
||||||
{{partial "page-list.html" (first 2 .Pages.ByLastmod.Reverse)}}
|
{{partial "page-list.html" (first 10 .Pages.ByLastmod.Reverse)}}
|
||||||
{{ end }}
|
{{ end }}
|
||||||
{{ end }}
|
{{ end }}
|
||||||
</div>
|
</div>
|
||||||
@@ -29,5 +27,4 @@
|
|||||||
{{partial "contact.html" .}}
|
{{partial "contact.html" .}}
|
||||||
</div>
|
</div>
|
||||||
</body>
|
</body>
|
||||||
|
|
||||||
</html>
|
</html>
|
||||||
|
|||||||
@@ -1,24 +1,21 @@
|
|||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html lang="en">
|
<html lang="{{ .Lang }}">
|
||||||
{{ partial "head.html" . }}
|
{{ partial "head.html" . }}
|
||||||
|
|
||||||
<body>
|
<body>
|
||||||
{{partial "search.html" .}}
|
{{partial "search.html" .}}
|
||||||
<div class="singlePage">
|
<div class="singlePage">
|
||||||
<!-- Begin actual content -->
|
<!-- Begin actual content -->
|
||||||
<header>
|
{{partial "header.html" .}}
|
||||||
<h1 id="page-title"><a href="{{ .Site.BaseURL }}">{{ .Site.Data.config.page_title }}</a></h1>
|
|
||||||
<svg tabindex="0" id="search-icon" aria-labelledby="title desc" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 19.9 19.7"><title id="title">Search Icon</title><desc id="desc">Icon to open search</desc><g class="search-path" fill="none"><path stroke-linecap="square" d="M18.5 18.3l-5.4-5.4"/><circle cx="8" cy="8" r="7"/></g></svg>
|
|
||||||
<div class="spacer"></div>
|
|
||||||
{{partial "darkmode.html" .}}
|
|
||||||
</header>
|
|
||||||
<article>
|
<article>
|
||||||
<h1>Tag: {{.Title | humanize}}</h1>
|
<h1>{{ i18n "tag" }}: {{ .Title }}</h1>
|
||||||
|
{{with .Params.description}}
|
||||||
|
<p>{{.}}</p>
|
||||||
|
{{end}}
|
||||||
{{partial "page-list.html" .Paginator.Pages}}
|
{{partial "page-list.html" .Paginator.Pages}}
|
||||||
{{ template "_internal/pagination.html" . }}
|
{{ template "_internal/pagination.html" . }}
|
||||||
</article>
|
</article>
|
||||||
{{partial "contact.html" .}}
|
{{partial "contact.html" .}}
|
||||||
</div>
|
</div>
|
||||||
</body>
|
</body>
|
||||||
|
|
||||||
</html>
|
</html>
|
||||||
|
|||||||
@@ -1,28 +1,20 @@
|
|||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html lang="en">
|
<html lang="{{ .Lang }}">
|
||||||
{{ partial "head.html" . }}
|
{{ partial "head.html" . }}
|
||||||
|
|
||||||
<body>
|
<body>
|
||||||
{{partial "search.html" .}}
|
{{partial "search.html" .}}
|
||||||
<div class="singlePage">
|
<div class="singlePage">
|
||||||
<!-- Begin actual content -->
|
<!-- Begin actual content -->
|
||||||
<header>
|
{{partial "header.html" .}}
|
||||||
<h1>{{if .Title}}{{ .Title }}{{else}}Untitled{{end}}</h1>
|
|
||||||
<svg tabindex="0" id="search-icon" aria-labelledby="title desc" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 19.9 19.7"><title id="title">Search Icon</title><desc id="desc">Icon to open search</desc><g class="search-path" fill="none"><path stroke-linecap="square" d="M18.5 18.3l-5.4-5.4"/><circle cx="8" cy="8" r="7"/></g></svg>
|
|
||||||
<div class="spacer"></div>
|
|
||||||
{{partial "darkmode.html" .}}
|
|
||||||
</header>
|
|
||||||
<article>
|
<article>
|
||||||
{{if $.Site.Data.config.enableToc}}
|
{{partial "toc.html" .}}
|
||||||
<aside class="mainTOC">
|
{{partial "textprocessing.html" . }}
|
||||||
<h3>Table of Contents</h3>
|
{{if $.Site.Data.config.enableRecentNotes}}
|
||||||
{{ .TableOfContents }}
|
{{partial "recent.html" . }}
|
||||||
</aside>
|
|
||||||
{{end}}
|
{{end}}
|
||||||
{{- .Content -}}
|
|
||||||
</article>
|
</article>
|
||||||
{{partial "footer.html" .}}
|
{{partial "footerIndex.html" .}}
|
||||||
</div>
|
</div>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
||||||
|
|||||||
@@ -1,20 +1,30 @@
|
|||||||
<h3>Backlinks</h3>
|
<h3>{{ i18n "backlinks" }}</h3>
|
||||||
<ul class="backlinks">
|
<ul class="backlinks">
|
||||||
{{$url := urls.Parse .Site.BaseURL }}
|
{{$url := urls.Parse .Site.BaseURL }}
|
||||||
{{$host := strings.TrimRight "/" $url.Path }}
|
{{$host := strings.TrimRight "/" $url.Path }}
|
||||||
{{$curPage := strings.TrimPrefix $host (strings.TrimRight "/" .Page.RelPermalink) }}
|
{{$curPage := strings.TrimPrefix $host (strings.TrimRight "/" .Page.RelPermalink)}}
|
||||||
{{$inbound := index $.Site.Data.linkIndex.index.backlinks $curPage}}
|
{{$linkIndex := getJSON "/assets/indices/linkIndex.json"}}
|
||||||
{{$contentTable := $.Site.Data.contentIndex}}
|
{{$inbound := index $linkIndex.index.backlinks $curPage}}
|
||||||
|
{{$contentTable := getJSON "/assets/indices/contentIndex.json"}}
|
||||||
{{if $inbound}}
|
{{if $inbound}}
|
||||||
{{$cleanedInbound := apply (apply $inbound "index" "." "source") "replace" "." " " "-"}}
|
{{$backlinks := dict "SENTINEL" "SENTINEL"}}
|
||||||
{{- range $cleanedInbound | uniq -}}
|
{{range $k, $v := $inbound}}
|
||||||
<li>
|
{{$cleanedInbound := replace $v.source " " "-"}}
|
||||||
<a href="{{.}}">{{index (index $contentTable .) "title"}}</a>
|
{{$ctx := $v.text}}
|
||||||
</li>
|
{{$backlinks = merge $backlinks (dict $cleanedInbound $ctx)}}
|
||||||
|
{{end}}
|
||||||
|
{{- range $lnk, $ctx := $backlinks -}}
|
||||||
|
{{$l := printf "%s%s/" $host $lnk}}
|
||||||
|
{{$l = cond (eq $l "//") "/" $l}}
|
||||||
|
{{with (index $contentTable $lnk)}}
|
||||||
|
<li>
|
||||||
|
<a href="{{$l}}" data-ctx="{{$ctx}}" data-src="{{$lnk}}" class="internal-link">{{index (index . "title")}}</a>
|
||||||
|
</li>
|
||||||
|
{{end}}
|
||||||
{{- end -}}
|
{{- end -}}
|
||||||
{{else}}
|
{{else}}
|
||||||
<li>
|
<li>
|
||||||
No backlinks found
|
{{ i18n "no_backlinks" }}
|
||||||
</li>
|
</li>
|
||||||
{{end}}
|
{{end}}
|
||||||
</ul>
|
</ul>
|
||||||
|
|||||||
@@ -1,12 +1,19 @@
|
|||||||
|
<!-- set data/config yaml file based on website language -->
|
||||||
|
{{ $config := cond (eq $.Site.Language.Lang "en") "config" (printf "config.%s" $.Site.Language.Lang) }}
|
||||||
|
{{ $data := index $.Site.Data $config }}
|
||||||
<!-- Contact Info -->
|
<!-- Contact Info -->
|
||||||
<div id="contact_buttons">
|
<div id="contact_buttons">
|
||||||
<footer>
|
<footer>
|
||||||
<p>Made by {{ $.Site.Data.config.name }} using <a href="https://github.com/jackyzha0/quartz">Quartz</a>, © {{ dateFormat "2006" now }}</p>
|
{{ $name := $data.name | default $.Site.Data.config.name }}
|
||||||
{{ if not .IsHome }}
|
{{ $year := dateFormat "2006" now }}
|
||||||
<a href="/">Home</a>
|
<p>{{ i18n "copyright" (dict "name" $name "year" $year) | safeHTML}}</p>
|
||||||
{{end}}
|
<ul>
|
||||||
{{- range $.Site.Data.config.links -}}
|
{{ if not .IsHome }}
|
||||||
<a href="{{.link}}">{{.link_name}}</a>
|
<li><a href="{{ $.Site.BaseURL}}">{{ i18n "home" }}</a></li>
|
||||||
{{- end -}}
|
{{end}}
|
||||||
|
{{- range $data.links | default $.Site.Data.config.links -}}
|
||||||
|
<li><a href="{{.link}}">{{.link_name}}</a></li>
|
||||||
|
{{- end -}}
|
||||||
|
</ul>
|
||||||
</footer>
|
</footer>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -2,13 +2,13 @@
|
|||||||
<input class='toggle' id='darkmode-toggle' type='checkbox' tabindex="-1">
|
<input class='toggle' id='darkmode-toggle' type='checkbox' tabindex="-1">
|
||||||
<label id="toggle-label-light" for='darkmode-toggle' tabindex="-1">
|
<label id="toggle-label-light" for='darkmode-toggle' tabindex="-1">
|
||||||
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" id="dayIcon" x="0px" y="0px" viewBox="0 0 35 35" style="enable-background:new 0 0 35 35;" xml:space="preserve">
|
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" id="dayIcon" x="0px" y="0px" viewBox="0 0 35 35" style="enable-background:new 0 0 35 35;" xml:space="preserve">
|
||||||
<title>Light Mode</title>
|
<title>{{ i18n "light_mode" }}</title>
|
||||||
<path d="M6,17.5C6,16.672,5.328,16,4.5,16h-3C0.672,16,0,16.672,0,17.5 S0.672,19,1.5,19h3C5.328,19,6,18.328,6,17.5z M7.5,26c-0.414,0-0.789,0.168-1.061,0.439l-2,2C4.168,28.711,4,29.086,4,29.5 C4,30.328,4.671,31,5.5,31c0.414,0,0.789-0.168,1.06-0.44l2-2C8.832,28.289,9,27.914,9,27.5C9,26.672,8.329,26,7.5,26z M17.5,6 C18.329,6,19,5.328,19,4.5v-3C19,0.672,18.329,0,17.5,0S16,0.672,16,1.5v3C16,5.328,16.671,6,17.5,6z M27.5,9 c0.414,0,0.789-0.168,1.06-0.439l2-2C30.832,6.289,31,5.914,31,5.5C31,4.672,30.329,4,29.5,4c-0.414,0-0.789,0.168-1.061,0.44 l-2,2C26.168,6.711,26,7.086,26,7.5C26,8.328,26.671,9,27.5,9z M6.439,8.561C6.711,8.832,7.086,9,7.5,9C8.328,9,9,8.328,9,7.5 c0-0.414-0.168-0.789-0.439-1.061l-2-2C6.289,4.168,5.914,4,5.5,4C4.672,4,4,4.672,4,5.5c0,0.414,0.168,0.789,0.439,1.06 L6.439,8.561z M33.5,16h-3c-0.828,0-1.5,0.672-1.5,1.5s0.672,1.5,1.5,1.5h3c0.828,0,1.5-0.672,1.5-1.5S34.328,16,33.5,16z M28.561,26.439C28.289,26.168,27.914,26,27.5,26c-0.828,0-1.5,0.672-1.5,1.5c0,0.414,0.168,0.789,0.439,1.06l2,2 C28.711,30.832,29.086,31,29.5,31c0.828,0,1.5-0.672,1.5-1.5c0-0.414-0.168-0.789-0.439-1.061L28.561,26.439z M17.5,29 c-0.829,0-1.5,0.672-1.5,1.5v3c0,0.828,0.671,1.5,1.5,1.5s1.5-0.672,1.5-1.5v-3C19,29.672,18.329,29,17.5,29z M17.5,7 C11.71,7,7,11.71,7,17.5S11.71,28,17.5,28S28,23.29,28,17.5S23.29,7,17.5,7z M17.5,25c-4.136,0-7.5-3.364-7.5-7.5 c0-4.136,3.364-7.5,7.5-7.5c4.136,0,7.5,3.364,7.5,7.5C25,21.636,21.636,25,17.5,25z" />
|
<path d="M6,17.5C6,16.672,5.328,16,4.5,16h-3C0.672,16,0,16.672,0,17.5 S0.672,19,1.5,19h3C5.328,19,6,18.328,6,17.5z M7.5,26c-0.414,0-0.789,0.168-1.061,0.439l-2,2C4.168,28.711,4,29.086,4,29.5 C4,30.328,4.671,31,5.5,31c0.414,0,0.789-0.168,1.06-0.44l2-2C8.832,28.289,9,27.914,9,27.5C9,26.672,8.329,26,7.5,26z M17.5,6 C18.329,6,19,5.328,19,4.5v-3C19,0.672,18.329,0,17.5,0S16,0.672,16,1.5v3C16,5.328,16.671,6,17.5,6z M27.5,9 c0.414,0,0.789-0.168,1.06-0.439l2-2C30.832,6.289,31,5.914,31,5.5C31,4.672,30.329,4,29.5,4c-0.414,0-0.789,0.168-1.061,0.44 l-2,2C26.168,6.711,26,7.086,26,7.5C26,8.328,26.671,9,27.5,9z M6.439,8.561C6.711,8.832,7.086,9,7.5,9C8.328,9,9,8.328,9,7.5 c0-0.414-0.168-0.789-0.439-1.061l-2-2C6.289,4.168,5.914,4,5.5,4C4.672,4,4,4.672,4,5.5c0,0.414,0.168,0.789,0.439,1.06 L6.439,8.561z M33.5,16h-3c-0.828,0-1.5,0.672-1.5,1.5s0.672,1.5,1.5,1.5h3c0.828,0,1.5-0.672,1.5-1.5S34.328,16,33.5,16z M28.561,26.439C28.289,26.168,27.914,26,27.5,26c-0.828,0-1.5,0.672-1.5,1.5c0,0.414,0.168,0.789,0.439,1.06l2,2 C28.711,30.832,29.086,31,29.5,31c0.828,0,1.5-0.672,1.5-1.5c0-0.414-0.168-0.789-0.439-1.061L28.561,26.439z M17.5,29 c-0.829,0-1.5,0.672-1.5,1.5v3c0,0.828,0.671,1.5,1.5,1.5s1.5-0.672,1.5-1.5v-3C19,29.672,18.329,29,17.5,29z M17.5,7 C11.71,7,7,11.71,7,17.5S11.71,28,17.5,28S28,23.29,28,17.5S23.29,7,17.5,7z M17.5,25c-4.136,0-7.5-3.364-7.5-7.5 c0-4.136,3.364-7.5,7.5-7.5c4.136,0,7.5,3.364,7.5,7.5C25,21.636,21.636,25,17.5,25z" />
|
||||||
</svg>
|
</svg>
|
||||||
</label>
|
</label>
|
||||||
<label id="toggle-label-dark" for='darkmode-toggle' tabindex="-1">
|
<label id="toggle-label-dark" for='darkmode-toggle' tabindex="-1">
|
||||||
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" id="nightIcon" x="0px" y="0px" viewBox="0 0 100 100" style="enable-background='new 0 0 100 100'" xml:space="preserve">
|
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" id="nightIcon" x="0px" y="0px" viewBox="0 0 100 100" style="enable-background='new 0 0 100 100'" xml:space="preserve">
|
||||||
<title>Dark Mode</title>
|
<title>{{ i18n "dark_mode" }}</title>
|
||||||
<path d="M96.76,66.458c-0.853-0.852-2.15-1.064-3.23-0.534c-6.063,2.991-12.858,4.571-19.655,4.571 C62.022,70.495,50.88,65.88,42.5,57.5C29.043,44.043,25.658,23.536,34.076,6.47c0.532-1.08,0.318-2.379-0.534-3.23 c-0.851-0.852-2.15-1.064-3.23-0.534c-4.918,2.427-9.375,5.619-13.246,9.491c-9.447,9.447-14.65,22.008-14.65,35.369 c0,13.36,5.203,25.921,14.65,35.368s22.008,14.65,35.368,14.65c13.361,0,25.921-5.203,35.369-14.65 c3.872-3.871,7.064-8.328,9.491-13.246C97.826,68.608,97.611,67.309,96.76,66.458z" />
|
<path d="M96.76,66.458c-0.853-0.852-2.15-1.064-3.23-0.534c-6.063,2.991-12.858,4.571-19.655,4.571 C62.022,70.495,50.88,65.88,42.5,57.5C29.043,44.043,25.658,23.536,34.076,6.47c0.532-1.08,0.318-2.379-0.534-3.23 c-0.851-0.852-2.15-1.064-3.23-0.534c-4.918,2.427-9.375,5.619-13.246,9.491c-9.447,9.447-14.65,22.008-14.65,35.369 c0,13.36,5.203,25.921,14.65,35.368s22.008,14.65,35.368,14.65c13.361,0,25.921-5.203,35.369-14.65 c3.872-3.871,7.064-8.328,9.491-13.246C97.826,68.608,97.611,67.309,96.76,66.458z" />
|
||||||
</svg>
|
</svg>
|
||||||
</label>
|
</label>
|
||||||
|
|||||||
7
layouts/partials/date-fmt.html
Normal file
7
layouts/partials/date-fmt.html
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
{{if .Date}}
|
||||||
|
{{.Date.Format "Jan 2, 2006"}}
|
||||||
|
{{else if .Lastmod}}
|
||||||
|
{{.Lastmod.Format "Jan 2, 2006"}}
|
||||||
|
{{else}}
|
||||||
|
Unknown
|
||||||
|
{{end}}
|
||||||
@@ -1,5 +1,9 @@
|
|||||||
|
|
||||||
|
|
||||||
<hr/>
|
<hr/>
|
||||||
<div class="page-end">
|
|
||||||
|
{{if $.Site.Data.config.enableFooter}}
|
||||||
|
<div class="page-end" id="footer">
|
||||||
<div class="backlinks-container">
|
<div class="backlinks-container">
|
||||||
{{partial "backlinks.html" .}}
|
{{partial "backlinks.html" .}}
|
||||||
</div>
|
</div>
|
||||||
@@ -7,5 +11,6 @@
|
|||||||
{{partial "graph.html" .}}
|
{{partial "graph.html" .}}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
{{end}}
|
||||||
|
|
||||||
{{partial "contact.html" .}}
|
{{partial "contact.html" .}}
|
||||||
|
|||||||
24
layouts/partials/footerIndex.html
Normal file
24
layouts/partials/footerIndex.html
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
{{if $.Site.Data.config.enableFooter}}
|
||||||
|
{{if $.Site.Data.graphConfig.enableGlobalGraph}}
|
||||||
|
<div class="page-end" id="footer">
|
||||||
|
|
||||||
|
<div>
|
||||||
|
{{partial "graph.html" .}}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
{{else}}
|
||||||
|
<hr/>
|
||||||
|
<div class="page-end" id="footer">
|
||||||
|
<div class="backlinks-container">
|
||||||
|
{{partial "backlinks.html" .}}
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
{{partial "graph.html" .}}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
{{end}}
|
||||||
|
{{end}}
|
||||||
|
|
||||||
|
{{partial "contact.html" .}}
|
||||||
3
layouts/partials/github.html
Normal file
3
layouts/partials/github.html
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
{{if $.Site.Data.config.enableGitHubEdit}}
|
||||||
|
<a href="{{$.Site.Data.config.GitHubLink}}/{{.File.Path}}" rel="noopener">{{ i18n "edit_source" }}</a>
|
||||||
|
{{end}}
|
||||||
@@ -1,236 +1,18 @@
|
|||||||
<script src="https://cdn.jsdelivr.net/npm/d3@6"></script>
|
<script
|
||||||
<h3>Interactive Graph</h3>
|
src="https://cdn.jsdelivr.net/npm/d3@6.7.0/dist/d3.min.js"
|
||||||
|
integrity="sha256-+7jaYCp29O1JusNWHaYtgUn6EhuP0VaFuswhNV06MyI="
|
||||||
|
crossorigin="anonymous"
|
||||||
|
></script>
|
||||||
|
<h3>{{ i18n "interactive_graph" }}</h3>
|
||||||
<div id="graph-container"></div>
|
<div id="graph-container"></div>
|
||||||
<style>
|
<style>
|
||||||
:root {
|
:root {
|
||||||
--g-node: var(--secondary);
|
--g-node: var(--secondary);
|
||||||
--g-node-active: var(--primary);
|
--g-node-active: var(--primary);
|
||||||
--g-node-inactive: var(--visited);
|
--g-node-inactive: var(--visited);
|
||||||
--g-link: var(--outlinegray);
|
--g-link: var(--outlinegray);
|
||||||
--g-link-active: #5a7282;
|
--g-link-active: #5a7282;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
<script>
|
{{ $js := resources.Get "js/graph.js" | resources.Fingerprint "md5" }}
|
||||||
const curPage = {{ strings.TrimRight "/" .Page.RelPermalink }}
|
<script src="{{ $js.Permalink }}"></script>
|
||||||
const pathColors = {{$.Site.Data.graphConfig.paths}}
|
|
||||||
let depth = {{$.Site.Data.graphConfig.depth}}
|
|
||||||
|
|
||||||
const parseIdsFromLinks = (links) => [...(new Set(links.flatMap(link => ([link.source, link.target]))))]
|
|
||||||
|
|
||||||
const neighbours = new Set()
|
|
||||||
const wl = [curPage || "/", "__SENTINEL"]
|
|
||||||
if (depth >= 0) {
|
|
||||||
while (depth >= 0 && wl.length > 0) {
|
|
||||||
// compute neighbours
|
|
||||||
const cur = wl.shift()
|
|
||||||
if (cur === "__SENTINEL") {
|
|
||||||
depth--
|
|
||||||
wl.push("__SENTINEL")
|
|
||||||
} else {
|
|
||||||
neighbours.add(cur)
|
|
||||||
const outgoing = index.links[cur] || []
|
|
||||||
const incoming = index.backlinks[cur] || []
|
|
||||||
wl.push(...outgoing.map(l => l.target), ...incoming.map(l => l.source))
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
parseIdsFromLinks(links).forEach(id => neighbours.add(id))
|
|
||||||
}
|
|
||||||
|
|
||||||
const data = {
|
|
||||||
nodes: [...neighbours].map(id => ({id})),
|
|
||||||
links: links.filter(l => neighbours.has(l.source) && neighbours.has(l.target)),
|
|
||||||
}
|
|
||||||
|
|
||||||
const color = (d) => {
|
|
||||||
if (d.id === curPage || (d.id === "/" && curPage === "")) {
|
|
||||||
return "var(--g-node-active)"
|
|
||||||
}
|
|
||||||
|
|
||||||
for (const pathColor of pathColors) {
|
|
||||||
const path = Object.keys(pathColor)[0]
|
|
||||||
const colour = pathColor[path]
|
|
||||||
if (d.id.startsWith(path)) {
|
|
||||||
return colour
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return "var(--g-node)"
|
|
||||||
}
|
|
||||||
|
|
||||||
const drag = simulation => {
|
|
||||||
function dragstarted(event, d) {
|
|
||||||
if (!event.active) simulation.alphaTarget(1).restart();
|
|
||||||
d.fx = d.x;
|
|
||||||
d.fy = d.y;
|
|
||||||
}
|
|
||||||
|
|
||||||
function dragged(event,d) {
|
|
||||||
d.fx = event.x;
|
|
||||||
d.fy = event.y;
|
|
||||||
}
|
|
||||||
|
|
||||||
function dragended(event,d) {
|
|
||||||
if (!event.active) simulation.alphaTarget(0);
|
|
||||||
d.fx = null;
|
|
||||||
d.fy = null;
|
|
||||||
}
|
|
||||||
|
|
||||||
const enableDrag = {{$.Site.Data.graphConfig.enableDrag}}
|
|
||||||
const noop = () => {}
|
|
||||||
return d3.drag()
|
|
||||||
.on("start", enableDrag ? dragstarted : noop)
|
|
||||||
.on("drag", enableDrag ? dragged : noop)
|
|
||||||
.on("end", enableDrag ? dragended : noop);
|
|
||||||
}
|
|
||||||
|
|
||||||
const height = 250
|
|
||||||
const width = document.getElementById("graph-container").offsetWidth
|
|
||||||
|
|
||||||
const simulation = d3.forceSimulation(data.nodes)
|
|
||||||
.force("charge", d3.forceManyBody().strength(-30))
|
|
||||||
.force("link", d3.forceLink(data.links).id(d => d.id))
|
|
||||||
.force("center", d3.forceCenter());
|
|
||||||
|
|
||||||
const svg = d3.select('#graph-container')
|
|
||||||
.append('svg')
|
|
||||||
.attr('width', width)
|
|
||||||
.attr('height', height)
|
|
||||||
.attr("viewBox", [-width / 2, -height / 2, width, height]);
|
|
||||||
|
|
||||||
// legend
|
|
||||||
const enableLegend = {{$.Site.Data.graphConfig.enableLegend}}
|
|
||||||
if (enableLegend) {
|
|
||||||
const legend = [
|
|
||||||
{"Current": "var(--g-node-active)"},
|
|
||||||
{"Note": "var(--g-node)"},
|
|
||||||
...pathColors
|
|
||||||
]
|
|
||||||
legend.forEach((legendEntry, i) => {
|
|
||||||
const key = Object.keys(legendEntry)[0]
|
|
||||||
const colour = legendEntry[key]
|
|
||||||
svg.append("circle").attr("cx", -width/2 + 20).attr("cy", height/2 - 30 * (i+1)).attr("r", 6).style("fill", colour)
|
|
||||||
svg.append("text").attr("x", -width/2 + 40).attr("y", height/2 - 30 * (i+1)).text(key).style("font-size", "15px").attr("alignment-baseline","middle")
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
// draw links between nodes
|
|
||||||
const link = svg.append("g")
|
|
||||||
.selectAll("line")
|
|
||||||
.data(data.links)
|
|
||||||
.join("line")
|
|
||||||
.attr("class", "link")
|
|
||||||
.attr("stroke", "var(--g-link)")
|
|
||||||
.attr("stroke-width", 2)
|
|
||||||
.attr("data-source", d => d.source.id)
|
|
||||||
.attr("data-target", d => d.target.id)
|
|
||||||
|
|
||||||
// svg groups
|
|
||||||
const graphNode = svg.append("g")
|
|
||||||
.selectAll("g")
|
|
||||||
.data(data.nodes)
|
|
||||||
.enter().append("g")
|
|
||||||
|
|
||||||
// draw individual nodes
|
|
||||||
const node = graphNode.append("circle")
|
|
||||||
.attr("class", "node")
|
|
||||||
.attr("id", (d) => d.id)
|
|
||||||
.attr("r", (d) => {
|
|
||||||
const numOut = index.links[d.id]?.length || 0
|
|
||||||
const numIn = index.backlinks[d.id]?.length || 0
|
|
||||||
return 3 + (numOut + numIn) / 4
|
|
||||||
})
|
|
||||||
.attr("fill", color)
|
|
||||||
.style("cursor", "pointer")
|
|
||||||
.on("click", (_, d) => {
|
|
||||||
window.location.href = {{.Site.BaseURL}} + decodeURI(d.id).replace(/[\s_]+/g, '-')
|
|
||||||
})
|
|
||||||
.on("mouseover", function (_, d) {
|
|
||||||
d3.selectAll(".node")
|
|
||||||
.transition()
|
|
||||||
.duration(100)
|
|
||||||
.attr("fill", "var(--g-node-inactive)")
|
|
||||||
|
|
||||||
const neighbours = parseIdsFromLinks([...(index.links[d.id] || []), ...(index.backlinks[d.id] || [])])
|
|
||||||
const neighbourNodes = d3.selectAll(".node").filter(d => neighbours.includes(d.id))
|
|
||||||
const currentId = d.id
|
|
||||||
const linkNodes = d3.selectAll(".link").filter(d => d.source.id === currentId || d.target.id === currentId)
|
|
||||||
|
|
||||||
// highlight neighbour nodes
|
|
||||||
neighbourNodes
|
|
||||||
.transition()
|
|
||||||
.duration(200)
|
|
||||||
.attr("fill", color)
|
|
||||||
|
|
||||||
// highlight links
|
|
||||||
linkNodes
|
|
||||||
.transition()
|
|
||||||
.duration(200)
|
|
||||||
.attr("stroke", "var(--g-link-active)")
|
|
||||||
|
|
||||||
// show text for self
|
|
||||||
d3.select(this.parentNode)
|
|
||||||
.select("text")
|
|
||||||
.raise()
|
|
||||||
.transition()
|
|
||||||
.duration(200)
|
|
||||||
.style("opacity", 1)
|
|
||||||
}).on("mouseleave", function (_,d) {
|
|
||||||
d3.selectAll(".node")
|
|
||||||
.transition()
|
|
||||||
.duration(200)
|
|
||||||
.attr("fill", color)
|
|
||||||
|
|
||||||
const currentId = d.id
|
|
||||||
const linkNodes = d3.selectAll(".link").filter(d => d.source.id === currentId || d.target.id === currentId)
|
|
||||||
|
|
||||||
linkNodes
|
|
||||||
.transition()
|
|
||||||
.duration(200)
|
|
||||||
.attr("stroke", "var(--g-link)")
|
|
||||||
|
|
||||||
d3.select(this.parentNode)
|
|
||||||
.select("text")
|
|
||||||
.transition()
|
|
||||||
.duration(200)
|
|
||||||
.style("opacity", 0)
|
|
||||||
})
|
|
||||||
.call(drag(simulation));
|
|
||||||
|
|
||||||
// draw labels
|
|
||||||
const labels = graphNode.append("text")
|
|
||||||
.attr("dx", 12)
|
|
||||||
.attr("dy", ".35em")
|
|
||||||
.text((d) => content[decodeURI(d.id).replace(/[\s_]+/g, '-')]?.title || "Untitled")
|
|
||||||
.style("opacity", 0)
|
|
||||||
.style("pointer-events", "none")
|
|
||||||
.call(drag(simulation));
|
|
||||||
|
|
||||||
// set panning
|
|
||||||
const enableZoom = {{$.Site.Data.graphConfig.enableZoom}}
|
|
||||||
if (enableZoom) {
|
|
||||||
svg.call(d3.zoom()
|
|
||||||
.extent([[0, 0], [width, height]])
|
|
||||||
.scaleExtent([0.25, 4])
|
|
||||||
.on("zoom", ({transform}) => {
|
|
||||||
link.attr("transform", transform);
|
|
||||||
node.attr("transform", transform);
|
|
||||||
labels.attr("transform", transform);
|
|
||||||
}));
|
|
||||||
}
|
|
||||||
|
|
||||||
// progress the simulation
|
|
||||||
simulation.on("tick", () => {
|
|
||||||
link
|
|
||||||
.attr("x1", d => d.source.x)
|
|
||||||
.attr("y1", d => d.source.y)
|
|
||||||
.attr("x2", d => d.target.x)
|
|
||||||
.attr("y2", d => d.target.y);
|
|
||||||
node
|
|
||||||
.attr("cx", d => d.x)
|
|
||||||
.attr("cy", d => d.y);
|
|
||||||
labels
|
|
||||||
.attr("x", d => d.x)
|
|
||||||
.attr("y", d => d.y);
|
|
||||||
});
|
|
||||||
</script>
|
|
||||||
|
|||||||
@@ -1,35 +1,189 @@
|
|||||||
|
<!-- set data/config yaml file based on website language -->
|
||||||
|
{{ $config := cond (eq $.Site.Language.Lang "en") "config" (printf "config.%s" $.Site.Language.Lang) }}
|
||||||
|
{{ $data := index $.Site.Data $config }}
|
||||||
<head>
|
<head>
|
||||||
<!-- Meta tags -->
|
<!-- Meta tags -->
|
||||||
<meta charset="UTF-8">
|
<meta charset="UTF-8" />
|
||||||
<meta name="description" content="{{if .IsHome}}{{$.Site.Data.config.description}}{{else}}{{.Summary}}{{end}}">
|
<meta
|
||||||
<title>{{ if .Title }}{{ .Title }}{{ else }}{{ $.Site.Data.config.page_title }}{{ end }}</title>
|
name="description"
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
content="{{if .IsHome}}{{$data.description | default $.Site.Data.config.description}}{{else}}{{.Summary}}{{end}}"
|
||||||
<link rel="shortcut icon" type="image/png" href="/icon.png" />
|
/>
|
||||||
|
<title>
|
||||||
|
{{ if .Title }}{{ .Title }}{{ else }}{{ $data.page_title | default $.Site.Data.config.page_title }}{{
|
||||||
|
end }}
|
||||||
|
</title>
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||||||
|
|
||||||
<!-- CSS Stylesheets and Fonts -->
|
<!-- HTML Favicon -->
|
||||||
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;600;700&family=Source+Sans+Pro:wght@400;600;700&family=Fira+Code:wght@400;700&display=swap" rel="stylesheet">
|
{{ $favicon := $data.favicon | default $.Site.Data.config.favicon | default (slice (dict "rel" "shortcut icon" "type" "image/png" "href" "icon.png")) }}
|
||||||
{{ $css := slice "custom.scss" "base.scss" "darkmode.scss" "syntax.scss"}}
|
{{ $type := (printf "%T" $favicon) }}
|
||||||
{{range $css}}
|
{{ if eq $type "string" }}
|
||||||
{{$sass := resources.Get . | resources.ToCSS }}
|
{{ $favicon | safeHTML }}
|
||||||
{{with $sass | minify}}
|
{{ else }}
|
||||||
<style>
|
{{ range $favicon }}
|
||||||
{{.Content | safeCSS}}
|
<link rel="{{.rel}}" {{if .type}}type="{{.type}}"{{end}} {{if .sizes}}sizes="{{.sizes}}"{{end}} href="{{$.Site.BaseURL}}/{{.href}}" />
|
||||||
</style>
|
{{- end }}
|
||||||
{{end}}
|
{{ end }}
|
||||||
{{end}}
|
|
||||||
|
|
||||||
{{- with resources.Get "darkmode.js" | minify -}}
|
<!-- CSS Stylesheets and Fonts -->
|
||||||
<script>
|
{{$sass := resources.Match "styles/[!_]*.scss" }}
|
||||||
{{.Content | safeJS }}
|
{{$css := slice }}
|
||||||
</script>
|
{{range $sass}}
|
||||||
{{- end -}}
|
{{$scss := . | resources.ToCSS (dict "outputStyle" "compressed") }}
|
||||||
|
{{$css = $css | append $scss}}
|
||||||
|
{{end}}
|
||||||
|
{{if $data.enableCallouts | default $.Site.Data.config.enableCallouts}}
|
||||||
|
{{$scss := resources.Get "styles/_callouts.scss" | resources.ToCSS (dict "outputStyle" "compressed") }}
|
||||||
|
{{$css = $css | append $scss}}
|
||||||
|
{{end}}
|
||||||
|
{{$finalCss := $css | resources.Concat "styles.css" | resources.Fingerprint "md5" | resources.Minify }}
|
||||||
|
<link href="{{$finalCss.Permalink}}" rel="stylesheet" />
|
||||||
|
|
||||||
<!-- Preload page vars -->
|
{{$lightSyntax := resources.Get "styles/_light_syntax.scss" | resources.ToCSS (dict "outputStyle" "compressed") | resources.Fingerprint "md5" | resources.Minify }}
|
||||||
<script>
|
<link href="{{$lightSyntax.Permalink}}" rel="stylesheet" id="theme-link">
|
||||||
const content = {{$.Site.Data.contentIndex}}
|
|
||||||
const index = {{$.Site.Data.linkIndex.index}}
|
<!-- Base scripts -->
|
||||||
const links = {{$.Site.Data.linkIndex.links}}
|
{{$scripts := (slice "js/darkmode.js" "js/util.js")}}
|
||||||
</script>
|
{{range $scripts}}
|
||||||
|
{{$scriptname := .}}
|
||||||
|
{{ $s := resources.Get $scriptname | resources.ExecuteAsTemplate $scriptname . | resources.Fingerprint "md5" | resources.Minify }}
|
||||||
|
<script src="{{$s.Permalink}}"></script>
|
||||||
|
{{end}}
|
||||||
|
{{partial "katex.html" .}}
|
||||||
|
|
||||||
|
<script src="https://unpkg.com/@floating-ui/core@0.7.3"></script>
|
||||||
|
<script src="https://unpkg.com/@floating-ui/dom@0.5.4"></script>
|
||||||
|
{{ $popover := resources.Get "js/popover.js" | resources.Fingerprint "md5" |
|
||||||
|
resources.Minify }}
|
||||||
|
<script src="{{$popover.Permalink}}"></script>
|
||||||
|
|
||||||
|
<!-- Optional scripts -->
|
||||||
|
{{ if $data.enableCodeBlockTitle | default $.Site.Data.config.enableCallouts }}
|
||||||
|
{{ $codeTitle := resources.Get "js/code-title.js" | resources.Fingerprint "md5" | resources.Minify }}
|
||||||
|
<script src="{{$codeTitle.Permalink}}"></script>
|
||||||
|
{{end}}
|
||||||
|
|
||||||
|
{{ if $data.enableCodeBlockCopy | default $.Site.Data.config.enableCodeBlockCopy }}
|
||||||
|
{{ $clipboard := resources.Get "js/clipboard.js" | resources.Fingerprint "md5" | resources.Minify }}
|
||||||
|
<script src="{{$clipboard.Permalink}}"></script>
|
||||||
|
{{ end }}
|
||||||
|
|
||||||
|
{{ if $data.enableCallouts | default $.Site.Data.config.enableCallouts }}
|
||||||
|
{{ $callouts := resources.Get "js/callouts.js" | resources.Fingerprint "md5" | resources.Minify }}
|
||||||
|
<script src="{{$callouts.Permalink}}"></script>
|
||||||
|
{{ end }}
|
||||||
|
|
||||||
|
<!-- Preload page vars -->
|
||||||
|
{{$linkIndex := resources.Get "indices/linkIndex.json" | resources.Fingerprint
|
||||||
|
"md5" | resources.Minify | }} {{$contentIndex := resources.Get
|
||||||
|
"indices/contentIndex.json" | resources.Fingerprint "md5" | resources.Minify
|
||||||
|
}}
|
||||||
|
<script>
|
||||||
|
const BASE_URL = {{.Site.BaseURL}}
|
||||||
|
const fetchData = Promise.all([
|
||||||
|
fetch("{{ $linkIndex.Permalink }}")
|
||||||
|
.then(data => data.json())
|
||||||
|
.then(data => ({
|
||||||
|
index: data.index,
|
||||||
|
links: data.links,
|
||||||
|
})),
|
||||||
|
fetch("{{ $contentIndex.Permalink }}")
|
||||||
|
.then(data => data.json()),
|
||||||
|
])
|
||||||
|
.then(([{index, links}, content]) => ({
|
||||||
|
index,
|
||||||
|
links,
|
||||||
|
content,
|
||||||
|
}))
|
||||||
|
|
||||||
|
const render = () => {
|
||||||
|
// NOTE: everything within this callback will be executed for every page navigation. This is a good place to put JavaScript that loads or modifies data on the page, adds event listeners, etc. If you are only dealing with basic DOM replacement, use the init function
|
||||||
|
|
||||||
|
const siteBaseURL = new URL(BASE_URL);
|
||||||
|
const pathBase = siteBaseURL.pathname;
|
||||||
|
const pathWindow = window.location.pathname;
|
||||||
|
const isHome = pathBase == pathWindow;
|
||||||
|
|
||||||
|
{{if $data.enableCodeBlockCopy | default $.Site.Data.config.enableCodeBlockCopy -}}
|
||||||
|
addCopyButtons();
|
||||||
|
{{ end }}
|
||||||
|
|
||||||
|
{{if $data.enableSPA | default $.Site.Data.config.enableSPA -}}
|
||||||
|
addTitleToCodeBlocks();
|
||||||
|
{{ end }}
|
||||||
|
|
||||||
|
{{if $data.enableCallouts | default $.Site.Data.config.enableCallouts -}}
|
||||||
|
addCollapsibleCallouts();
|
||||||
|
{{ end }}
|
||||||
|
|
||||||
|
{{if $data.enableLinkPreview | default $.Site.Data.config.enableLinkPreview}}
|
||||||
|
initPopover(
|
||||||
|
{{strings.TrimRight "/" .Site.BaseURL }},
|
||||||
|
{{$data.enableContextualBacklinks | default $.Site.Data.config.enableContextualBacklinks}},
|
||||||
|
{{$data.enableLatex | default $.Site.Data.config.enableLatex}}
|
||||||
|
)
|
||||||
|
{{end}}
|
||||||
|
|
||||||
|
{{if $data.enableFooter | default $.Site.Data.config.enableFooter}}
|
||||||
|
const footer = document.getElementById("footer")
|
||||||
|
if (footer) {
|
||||||
|
const container = document.getElementById("graph-container")
|
||||||
|
// retry if the graph is not ready
|
||||||
|
if (!container) return requestAnimationFrame(render)
|
||||||
|
// clear the graph in case there is anything within it
|
||||||
|
container.textContent = ""
|
||||||
|
|
||||||
|
const drawGlobal = isHome && {{$.Site.Data.graphConfig.enableGlobalGraph}};
|
||||||
|
drawGraph(
|
||||||
|
{{strings.TrimRight "/" .Site.BaseURL}},
|
||||||
|
drawGlobal,
|
||||||
|
{{$.Site.Data.graphConfig.paths}},
|
||||||
|
drawGlobal ? {{$.Site.Data.graphConfig.globalGraph}} : {{$.Site.Data.graphConfig.localGraph}}
|
||||||
|
);
|
||||||
|
|
||||||
|
}
|
||||||
|
{{end}}
|
||||||
|
}
|
||||||
|
|
||||||
|
const init = (doc = document) => {
|
||||||
|
// NOTE: everything within this callback will be executed for initial page navigation. This is a good place to put JavaScript that only replaces DOM nodes.
|
||||||
|
{{if $data.enableCodeBlockCopy | default $.Site.Data.config.enableCodeBlockCopy -}}
|
||||||
|
addCopyButtons();
|
||||||
|
{{ end }}
|
||||||
|
|
||||||
|
{{if $data.enableCodeBlockTitle | default $.Site.Data.config.enableCodeBlockTitle -}}
|
||||||
|
addTitleToCodeBlocks();
|
||||||
|
{{- end -}}
|
||||||
|
{{if $data.enableLatex | default $.Site.Data.config.enableLatex}}
|
||||||
|
renderMathInElement(doc.body, {
|
||||||
|
delimiters: [
|
||||||
|
{left: '$$', right: '$$', display: true},
|
||||||
|
{left: '$', right: '$', display: false},
|
||||||
|
],
|
||||||
|
throwOnError : false
|
||||||
|
});
|
||||||
|
{{end}}
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
{{if $data.enableSPA | default $.Site.Data.config.enableSPA}}
|
||||||
|
{{ $router := resources.Get "js/router.js" | resources.Fingerprint "md5" |
|
||||||
|
resources.Minify }}
|
||||||
|
<script type="module">
|
||||||
|
import { attachSPARouting } from "{{$router.Permalink}}"
|
||||||
|
attachSPARouting(init, render)
|
||||||
|
</script>
|
||||||
|
{{else}}
|
||||||
|
<script>
|
||||||
|
window.Million = {
|
||||||
|
navigate: (url) => (window.location.href = url),
|
||||||
|
prefetch: () => {},
|
||||||
|
}
|
||||||
|
|
||||||
|
window.addEventListener("DOMContentLoaded", () => {
|
||||||
|
init()
|
||||||
|
render()
|
||||||
|
})
|
||||||
|
</script>
|
||||||
|
{{end}}
|
||||||
</head>
|
</head>
|
||||||
{{ template "_internal/google_analytics.html" . }}
|
{{ template "_internal/google_analytics.html" . }}
|
||||||
{{ partial "popover.html" .}}
|
|
||||||
|
|||||||
11
layouts/partials/header.html
Normal file
11
layouts/partials/header.html
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
<header>
|
||||||
|
{{ $config := cond (eq $.Site.Language.Lang "en") "config" (printf "config.%s" $.Site.Language.Lang) }}
|
||||||
|
<h1 id="page-title"><a href="{{ "" | absLangURL }}">{{ ( index $.Site.Data $config ).page_title | default $.Site.Data.config.page_title }}</a></h1>
|
||||||
|
<div class="spacer"></div>
|
||||||
|
<div id="search-icon">
|
||||||
|
<p>{{ i18n "search" }}</p>
|
||||||
|
<svg tabindex="0" aria-labelledby="title desc" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 19.9 19.7"><title id="title">{{ i18n "search_icon" }}</title><desc id="desc">{{ i18n "icon_search" }}</desc><g class="search-path" fill="none"><path stroke-linecap="square" d="M18.5 18.3l-5.4-5.4"/><circle cx="8" cy="8" r="7"/></g></svg>
|
||||||
|
</div>
|
||||||
|
{{partial "darkmode.html" .}}
|
||||||
|
</header>
|
||||||
|
|
||||||
5
layouts/partials/katex.html
Normal file
5
layouts/partials/katex.html
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
{{if $.Site.Data.config.enableLatex}}
|
||||||
|
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/katex@0.15.1/dist/katex.min.css" integrity="sha384-R4558gYOUz8mP9YWpZJjofhk+zx0AS11p36HnD2ZKj/6JR5z27gSSULCNHIRReVs" crossorigin="anonymous">
|
||||||
|
<script defer src="https://cdn.jsdelivr.net/npm/katex@0.15.1/dist/katex.min.js" integrity="sha384-z1fJDqw8ZApjGO3/unPWUPsIymfsJmyrDVWC8Tv/a1HeOtGmkwNd/7xUS0Xcnvsx" crossorigin="anonymous"></script>
|
||||||
|
<script defer src="https://cdn.jsdelivr.net/npm/katex@0.15.1/dist/contrib/auto-render.min.js" integrity="sha384-+XBljXPPiv+OzfbB3cVmLHf4hdUFHlWNZN5spNQ7rmHTXpd7WvJum6fIACpNNfIR" crossorigin="anonymous"></script>
|
||||||
|
{{end}}
|
||||||
@@ -2,14 +2,19 @@
|
|||||||
{{- range . -}}
|
{{- range . -}}
|
||||||
<li class="section-li">
|
<li class="section-li">
|
||||||
<div class="section">
|
<div class="section">
|
||||||
<div class="desc">
|
|
||||||
<h3><a href="{{ .Permalink }}">{{- .Title -}}</a></h3>
|
|
||||||
<p>{{- .Summary -}}{{if .Truncated}}...{{end}}</p>
|
|
||||||
</div>
|
|
||||||
<p class="meta">
|
<p class="meta">
|
||||||
{{ .ReadingTime }} minute read. Last updated {{if ne .Date .Lastmod}}{{ .Lastmod.Format "January 2, 2006" }}{{else}}Unknown{{end}}
|
{{partial "date-fmt.html" .}}
|
||||||
</p>
|
</p>
|
||||||
|
<div class="desc">
|
||||||
|
<h3><a href="{{ .Permalink }}" class="internal-link" data-src="{{ .RelPermalink }}">{{- .Title -}}</a></h3>
|
||||||
|
</div>
|
||||||
|
<div class="spacer"></div>
|
||||||
|
<ul class="tags">
|
||||||
|
{{ range (.GetTerms "tags") }}
|
||||||
|
<li><a href="{{ .Permalink }}">{{ .LinkTitle | title}}</a></li>
|
||||||
|
{{ end }}
|
||||||
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
</li>
|
</li>
|
||||||
{{- end -}}
|
{{- end -}}
|
||||||
</ul>
|
</ul>
|
||||||
|
|||||||
@@ -1,31 +0,0 @@
|
|||||||
{{if $.Site.Data.config.enableLinkPreview}}
|
|
||||||
<script>
|
|
||||||
function htmlToElement(html) {
|
|
||||||
const template = document.createElement('template')
|
|
||||||
html = html.trim()
|
|
||||||
template.innerHTML = html
|
|
||||||
return template.content.firstChild
|
|
||||||
}
|
|
||||||
|
|
||||||
document.addEventListener("DOMContentLoaded", () => {
|
|
||||||
[...document.getElementsByClassName("internal-link")]
|
|
||||||
.forEach(li => {
|
|
||||||
const linkDest = content[li.dataset.src]
|
|
||||||
if (linkDest) {
|
|
||||||
const popoverElement = `<div class="popover">
|
|
||||||
<h3>${linkDest.title}</h3>
|
|
||||||
<p>${removeMarkdown(linkDest.content).split(" ", 15).join(" ")}...</p>
|
|
||||||
</div>`
|
|
||||||
const el = htmlToElement(popoverElement)
|
|
||||||
li.appendChild(el)
|
|
||||||
li.addEventListener("mouseover", () => {
|
|
||||||
el.classList.add("visible")
|
|
||||||
})
|
|
||||||
li.addEventListener("mouseout", () => {
|
|
||||||
el.classList.remove("visible")
|
|
||||||
})
|
|
||||||
}
|
|
||||||
})
|
|
||||||
})
|
|
||||||
</script>
|
|
||||||
{{end}}
|
|
||||||
12
layouts/partials/recent.html
Normal file
12
layouts/partials/recent.html
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
<div class="content-list">
|
||||||
|
<h2>{{ i18n "recent_notes" }}</h2>
|
||||||
|
<!--
|
||||||
|
You can also configure this to find related pages!
|
||||||
|
All you need to pass into the "page-list.html" partial
|
||||||
|
is a collection of pages.
|
||||||
|
https://gohugo.io/content-management/related/
|
||||||
|
-->
|
||||||
|
{{$notes := .Site.RegularPages}}
|
||||||
|
{{partial "page-list.html" (first 3 $notes)}}
|
||||||
|
</div>
|
||||||
|
|
||||||
@@ -1,255 +1,18 @@
|
|||||||
<div id="search-container">
|
<div id="search-container">
|
||||||
<div id="search-space">
|
<div id="search-space">
|
||||||
<input autocomplete="off" id="search-bar" name="search" type="text" aria-label="Search" placeholder="Search for something...">
|
<input autocomplete="off" id="search-bar" name="search" type="text" aria-label="{{ i18n "search" }}"
|
||||||
<div id="results-container">
|
placeholder="{{ i18n "search_for_something" }}" dir="{{ $.Site.Language.LanguageDirection }}">
|
||||||
</div>
|
<div id="results-container">
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<script src="https://cdn.jsdelivr.net/gh/nextapps-de/flexsearch@0.7.2/dist/flexsearch.bundle.js"></script>
|
{{if $.Site.Data.config.enableSemanticSearch}}
|
||||||
<script>
|
{{ $js := resources.Get "js/semantic-search.js" | resources.ExecuteAsTemplate "js/semantic-search.js" . | resources.Fingerprint "md5" | resources.Minify }}
|
||||||
// code from https://github.com/danestves/markdown-to-text
|
<script defer src="{{ $js.Permalink }}"></script>
|
||||||
const removeMarkdown = (
|
{{else}}
|
||||||
markdown,
|
<script src="https://cdn.jsdelivr.net/npm/flexsearch@0.7.21/dist/flexsearch.bundle.js"
|
||||||
options = {
|
integrity="sha256-i3A0NZGkhsKjVMzFxv3ksk0DZh3aXqu0l49Bbh0MdjE=" crossorigin="anonymous" defer></script>
|
||||||
listUnicodeChar: false,
|
{{ $js := resources.Get "js/full-text-search.js" | resources.Fingerprint "md5" | resources.Minify }}
|
||||||
stripListLeaders: true,
|
<script defer src="{{ $js.Permalink }}"></script>
|
||||||
gfm: true,
|
{{end}}
|
||||||
useImgAltText: false,
|
|
||||||
preserveLinks: false,
|
|
||||||
}
|
|
||||||
) => {
|
|
||||||
let output = markdown || "";
|
|
||||||
output = output.replace(/^(-\s*?|\*\s*?|_\s*?){3,}\s*$/gm, "");
|
|
||||||
|
|
||||||
try {
|
|
||||||
if (options.stripListLeaders) {
|
|
||||||
if (options.listUnicodeChar)
|
|
||||||
output = output.replace(
|
|
||||||
/^([\s\t]*)([\*\-\+]|\d+\.)\s+/gm,
|
|
||||||
options.listUnicodeChar + " $1"
|
|
||||||
);
|
|
||||||
else output = output.replace(/^([\s\t]*)([\*\-\+]|\d+\.)\s+/gm, "$1");
|
|
||||||
}
|
|
||||||
if (options.gfm) {
|
|
||||||
output = output
|
|
||||||
.replace(/\n={2,}/g, "\n")
|
|
||||||
.replace(/~{3}.*\n/g, "")
|
|
||||||
.replace(/~~/g, "")
|
|
||||||
.replace(/`{3}.*\n/g, "");
|
|
||||||
}
|
|
||||||
if (options.preserveLinks) {
|
|
||||||
output = output.replace(/\[(.*?)\][\[\(](.*?)[\]\)]/g, "$1 ($2)")
|
|
||||||
}
|
|
||||||
output = output
|
|
||||||
.replace(/<[^>]*>/g, "")
|
|
||||||
.replace(/^[=\-]{2,}\s*$/g, "")
|
|
||||||
.replace(/\[\^.+?\](\: .*?$)?/g, "")
|
|
||||||
.replace(/\s{0,2}\[.*?\]: .*?$/g, "")
|
|
||||||
.replace(/\!\[(.*?)\][\[\(].*?[\]\)]/g, options.useImgAltText ? "$1" : "")
|
|
||||||
.replace(/\[(.*?)\][\[\(].*?[\]\)]/g, "$1")
|
|
||||||
.replace(/^\s{0,3}>\s?/g, "")
|
|
||||||
.replace(/(^|\n)\s{0,3}>\s?/g, "\n\n")
|
|
||||||
.replace(/^\s{1,2}\[(.*?)\]: (\S+)( ".*?")?\s*$/g, "")
|
|
||||||
.replace(
|
|
||||||
/^(\n)?\s{0,}#{1,6}\s+| {0,}(\n)?\s{0,}#{0,} {0,}(\n)?\s{0,}$/gm,
|
|
||||||
"$1$2$3"
|
|
||||||
)
|
|
||||||
.replace(/([\*_]{1,3})(\S.*?\S{0,1})\1/g, "$2")
|
|
||||||
.replace(/([\*_]{1,3})(\S.*?\S{0,1})\1/g, "$2")
|
|
||||||
.replace(/(`{3,})(.*?)\1/gm, "$2")
|
|
||||||
.replace(/`(.+?)`/g, "$1")
|
|
||||||
.replace(/\n{2,}/g, "\n\n");
|
|
||||||
} catch (e) {
|
|
||||||
console.error(e);
|
|
||||||
return markdown;
|
|
||||||
}
|
|
||||||
return output;
|
|
||||||
};
|
|
||||||
</script>
|
|
||||||
<script>
|
|
||||||
const contentIndex = new FlexSearch.Document({
|
|
||||||
cache: true,
|
|
||||||
charset: "latin:extra",
|
|
||||||
optimize: true,
|
|
||||||
worker: true,
|
|
||||||
document: {
|
|
||||||
index: [{
|
|
||||||
field: "content",
|
|
||||||
tokenize: "strict",
|
|
||||||
context: {
|
|
||||||
resolution: 5,
|
|
||||||
depth: 3,
|
|
||||||
bidirectional: true
|
|
||||||
},
|
|
||||||
suggest: true,
|
|
||||||
}, {
|
|
||||||
field: "title",
|
|
||||||
tokenize: "forward",
|
|
||||||
}]
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
for (const [key, value] of Object.entries(content)) {
|
|
||||||
contentIndex.add({
|
|
||||||
id: key,
|
|
||||||
title: value.title,
|
|
||||||
content: removeMarkdown(value.content),
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
const highlight = (content, term) => {
|
|
||||||
const highlightWindow = 20
|
|
||||||
const tokenizedTerm = term.split(/\s+/).filter(t => t !== "")
|
|
||||||
const splitText = content.split(/\s+/).filter(t => t !== "")
|
|
||||||
const includesCheck = (token) => tokenizedTerm.some(term => token.toLowerCase().startsWith(term.toLowerCase()))
|
|
||||||
|
|
||||||
const occurrencesIndices = splitText
|
|
||||||
.map(includesCheck)
|
|
||||||
|
|
||||||
// calculate best index
|
|
||||||
let bestSum = 0
|
|
||||||
let bestIndex = 0
|
|
||||||
for (let i = 0; i < Math.max(occurrencesIndices.length - highlightWindow, 0); i++) {
|
|
||||||
const window = occurrencesIndices.slice(i, i + highlightWindow)
|
|
||||||
const windowSum = window.reduce((total, cur) => total + cur, 0)
|
|
||||||
if (windowSum >= bestSum) {
|
|
||||||
bestSum = windowSum
|
|
||||||
bestIndex = i
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
const startIndex = Math.max(bestIndex - highlightWindow, 0)
|
|
||||||
const endIndex = Math.min(startIndex + 2 * highlightWindow, splitText.length)
|
|
||||||
const mappedText = splitText
|
|
||||||
.slice(startIndex, endIndex)
|
|
||||||
.map(token => {
|
|
||||||
if (includesCheck(token)) {
|
|
||||||
return `<span class="search-highlight">${token}</span>`
|
|
||||||
}
|
|
||||||
return token
|
|
||||||
})
|
|
||||||
.join(" ")
|
|
||||||
.replaceAll('</span> <span class="search-highlight">', " ")
|
|
||||||
return `${startIndex === 0 ? "" : "..."}${mappedText}${endIndex === splitText.length ? "" : "..."}`
|
|
||||||
}
|
|
||||||
|
|
||||||
const resultToHTML = ({url, title, content, term}) => {
|
|
||||||
const text = removeMarkdown(content)
|
|
||||||
const resultTitle = highlight(title, term)
|
|
||||||
const resultText = highlight(text, term)
|
|
||||||
return `<button class="result-card" id="${url}">
|
|
||||||
<h3>${resultTitle}</h3>
|
|
||||||
<p>${resultText}</p>
|
|
||||||
</button>`
|
|
||||||
}
|
|
||||||
|
|
||||||
const redir = (id, term) => {
|
|
||||||
window.location.href = "{{.Site.BaseURL}}" + `${id}#:~:text=${encodeURIComponent(term)}`
|
|
||||||
}
|
|
||||||
|
|
||||||
const fetch = id => ({
|
|
||||||
id,
|
|
||||||
url: id,
|
|
||||||
title: content[id].title,
|
|
||||||
content: content[id].content
|
|
||||||
})
|
|
||||||
|
|
||||||
const source = document.getElementById('search-bar')
|
|
||||||
const results = document.getElementById("results-container")
|
|
||||||
let term
|
|
||||||
source.addEventListener("keyup", (e) => {
|
|
||||||
if (e.key === "Enter") {
|
|
||||||
const anchor = document.getElementsByClassName("result-card")[0]
|
|
||||||
redir(anchor.id, term)
|
|
||||||
}
|
|
||||||
})
|
|
||||||
source.addEventListener('input', (e) => {
|
|
||||||
term = e.target.value
|
|
||||||
contentIndex.search(term, [
|
|
||||||
{
|
|
||||||
field: "content",
|
|
||||||
limit: 10,
|
|
||||||
suggest: true,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
field: "title",
|
|
||||||
limit: 5,
|
|
||||||
}
|
|
||||||
]).then(searchResults => {
|
|
||||||
const getByField = field => {
|
|
||||||
const results = searchResults.filter(x => x.field === field)
|
|
||||||
if (results.length === 0) {
|
|
||||||
return []
|
|
||||||
} else {
|
|
||||||
return [...results[0].result]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
const allIds = new Set([...getByField('title'), ...getByField('content')])
|
|
||||||
const finalResults = [...allIds].map(fetch)
|
|
||||||
|
|
||||||
// display
|
|
||||||
if (finalResults.length === 0) {
|
|
||||||
results.innerHTML = `<button class="result-card">
|
|
||||||
<h3>No results.</h3>
|
|
||||||
<p>Try another search term?</p>
|
|
||||||
</button>`
|
|
||||||
} else {
|
|
||||||
results.innerHTML = finalResults
|
|
||||||
.map(result => resultToHTML({
|
|
||||||
...result,
|
|
||||||
term,
|
|
||||||
}))
|
|
||||||
.join("\n")
|
|
||||||
const anchors = document.getElementsByClassName("result-card");
|
|
||||||
[...anchors].forEach(anchor => {
|
|
||||||
anchor.onclick = () => redir(anchor.id, term)
|
|
||||||
})
|
|
||||||
}
|
|
||||||
})
|
|
||||||
})
|
|
||||||
|
|
||||||
|
|
||||||
const searchContainer = document.getElementById("search-container")
|
|
||||||
function openSearch() {
|
|
||||||
if (searchContainer.style.display === "none" || searchContainer.style.display === "") {
|
|
||||||
source.value = ""
|
|
||||||
results.innerHTML = ""
|
|
||||||
searchContainer.style.display = "block"
|
|
||||||
source.focus()
|
|
||||||
} else {
|
|
||||||
searchContainer.style.display = "none"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function closeSearch() {
|
|
||||||
searchContainer.style.display = "none"
|
|
||||||
}
|
|
||||||
|
|
||||||
document.addEventListener('keydown', (event) => {
|
|
||||||
if (event.key === "/") {
|
|
||||||
event.preventDefault()
|
|
||||||
openSearch()
|
|
||||||
}
|
|
||||||
if (event.key === "Escape") {
|
|
||||||
event.preventDefault()
|
|
||||||
closeSearch()
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
window.addEventListener('DOMContentLoaded', () => {
|
|
||||||
const searchButton = document.getElementById("search-icon")
|
|
||||||
searchButton.addEventListener('click', (evt) => {
|
|
||||||
openSearch()
|
|
||||||
})
|
|
||||||
searchButton.addEventListener('keydown', (evt) => {
|
|
||||||
openSearch()
|
|
||||||
})
|
|
||||||
searchContainer.addEventListener('click', (evt) => {
|
|
||||||
closeSearch()
|
|
||||||
})
|
|
||||||
document.getElementById("search-space").addEventListener('click', (evt) => {
|
|
||||||
evt.stopPropagation()
|
|
||||||
})
|
|
||||||
})
|
|
||||||
|
|
||||||
</script>
|
|
||||||
|
|||||||
91
layouts/partials/textprocessing.html
Normal file
91
layouts/partials/textprocessing.html
Normal file
@@ -0,0 +1,91 @@
|
|||||||
|
{{ $content := .Content }}
|
||||||
|
{{ $raw := .RawContent }}
|
||||||
|
{{ $page := .Page }}
|
||||||
|
|
||||||
|
{{/* Escape slashes for Latex to fix line breaks */}}
|
||||||
|
{{$latex := findRE "\\$\\$([^\\$]+)\\$\\$" $content}}
|
||||||
|
{{range $latex}}
|
||||||
|
{{$fixed := replaceRE "\\\\(?: +|\\n)" "\\\\" .}}
|
||||||
|
{{$content = replace $content . $fixed}}
|
||||||
|
{{end}}
|
||||||
|
|
||||||
|
{{/* Wikilinks */}}
|
||||||
|
{{$wikilinks := $content | findRE "!?\\[\\[\\S[^\\[\\]\\|]*(?:\\|[^\\[\\]]*)?\\S\\]\\]" }}
|
||||||
|
{{$codefences := $raw | findRE "\\x60[^\\x60\\n]+\\x60"}}
|
||||||
|
{{$codeblocks := $raw | findRE "\\x60{3}[^\\x60]+\\x60{3}"}}
|
||||||
|
{{$code := union $codefences $codeblocks}}
|
||||||
|
{{range $wikilinks}}
|
||||||
|
{{$cur := .}}
|
||||||
|
{{$incode := false}}
|
||||||
|
{{range $code}}
|
||||||
|
{{if (in . $cur)}}
|
||||||
|
{{$incode = true}}
|
||||||
|
{{end}}
|
||||||
|
{{end}}
|
||||||
|
{{if not $incode}}
|
||||||
|
{{if (hasPrefix . "!")}}
|
||||||
|
{{$inner := . | strings.TrimPrefix "![[" | strings.TrimSuffix "]]" }}
|
||||||
|
{{$split := split $inner "|"}}
|
||||||
|
{{$path := index $split 0 | relURL}}
|
||||||
|
{{$width := index $split 1}}
|
||||||
|
{{$img := printf "<img src=\"%s\" width=\"%s\" />" $path (default "auto" $width)}}
|
||||||
|
{{$content = replace $content . $img}}
|
||||||
|
{{else}}
|
||||||
|
{{$inner := . | strings.TrimPrefix "[[" | strings.TrimSuffix "]]" }}
|
||||||
|
{{$split := split $inner "|"}}
|
||||||
|
{{$path := index $split 0}}
|
||||||
|
{{$reference := split $path "#"}}
|
||||||
|
{{$title := index $reference 0}}
|
||||||
|
{{$block := default "" (index $reference 1)}}
|
||||||
|
{{$block = strings.TrimRight "/" (cond (eq $block "") $block (printf "#%s" $block)) | urlize | lower}}
|
||||||
|
{{$href := strings.TrimRight "/" ($page.GetPage $title).RelPermalink}}
|
||||||
|
{{$display := default $title (index $split 1)}}
|
||||||
|
{{if not $href}}
|
||||||
|
{{$link := printf "<a class=\"internal-link broken\">%s</a>" $display}}
|
||||||
|
{{$content = replace $content . $link}}
|
||||||
|
{{else}}
|
||||||
|
{{$fullhref := printf "%s%s" $href $block }}
|
||||||
|
{{$link := printf "<a href=\"%s\" rel=\"noopener\" class=\"internal-link\" data-src=\"%s\">%s</a>" $fullhref $href $display}}
|
||||||
|
{{$content = replace $content . $link}}
|
||||||
|
{{end}}
|
||||||
|
{{end}}
|
||||||
|
{{end}}
|
||||||
|
{{end}}
|
||||||
|
|
||||||
|
{{/* Add jumpable anchors */}}
|
||||||
|
{{ $content = $content | replaceRE "(<h[1-9] id=\"([^\"]+)\">)(.+)(</h[1-9]>)" `<a href="#${2}">${1}<span class="hanchor" ariaLabel="Anchor"># </span>${3}${4}</a>` }}
|
||||||
|
|
||||||
|
{{/* Callouts */}}
|
||||||
|
{{if $.Site.Data.config.enableCallouts}}
|
||||||
|
{{ $content = $content | replaceRE "<blockquote>" "<blockquote class=callout>" }}
|
||||||
|
{{ $blockquoteclasses := findRE `\[!.+\]` $content }}
|
||||||
|
{{ $blockquoteclasses1 := findRE "<blockquote.*?>(.|\n)*?</blockquote>" $content }}
|
||||||
|
{{ $blockquotetags := findRE `blockquote class=callout` $content }}
|
||||||
|
{{ $counter := 0 }}
|
||||||
|
{{ $counter1 := 0 }}
|
||||||
|
{{ $finder := index $blockquoteclasses1 $counter }}
|
||||||
|
{{range $blockquotetags}}
|
||||||
|
{{ $finder = index $blockquoteclasses1 $counter }}
|
||||||
|
{{ if (in $finder "[!") }}
|
||||||
|
{{ $inner := index $blockquoteclasses $counter1 }}
|
||||||
|
{{ if (in $finder "]-") }}
|
||||||
|
{{ $inner = $inner | replaceRE `\[!([a-zA-Z]+)\]` `callout-collapsible callout-collapsed ${1}`}}
|
||||||
|
{{ else if (in $finder "]+") }}
|
||||||
|
{{ $inner = $inner | replaceRE `\[!([a-zA-Z]+)\]` `callout-collapsible ${1}`}}
|
||||||
|
{{ else}}
|
||||||
|
{{ $inner = $inner | replaceRE `\[!([a-zA-Z]+)\]` `${1}` }}
|
||||||
|
{{ end }}
|
||||||
|
{{ $inner = printf "blockquote class=\"%s-callout\"" $inner | lower}}
|
||||||
|
{{ $content = replace $content . $inner 1}}
|
||||||
|
{{ $counter1 = add $counter1 1 }}
|
||||||
|
{{ else }}
|
||||||
|
{{ $inner := print "blockquote" }}
|
||||||
|
{{ $content = replace $content . $inner 1}}
|
||||||
|
{{ end }}
|
||||||
|
{{ $counter = add $counter 1 }}
|
||||||
|
{{end}}
|
||||||
|
{{ $content = $content | replaceRE `\[![a-zA-Z]+\][-\+]?` "" }}
|
||||||
|
{{ $content = $content | replaceRE "blockquote class=callout" "blockquote" }}
|
||||||
|
{{end}}
|
||||||
|
|
||||||
|
{{ $content | safeHTML }}
|
||||||
8
layouts/partials/toc.html
Normal file
8
layouts/partials/toc.html
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
{{ if (and $.Site.Data.config.enableToc (ne .Params.enableToc false) (gt .WordCount 250)) }}
|
||||||
|
<aside class="mainTOC">
|
||||||
|
<details {{ if $.Site.Data.config.openToc }}open {{ end }}>
|
||||||
|
<summary>{{ i18n "toc" }}</summary>
|
||||||
|
{{ .TableOfContents }}
|
||||||
|
</details>
|
||||||
|
</aside>
|
||||||
|
{{end}}
|
||||||
BIN
screenshot.png
Normal file
BIN
screenshot.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.1 MiB |
BIN
static/icon.png
BIN
static/icon.png
Binary file not shown.
|
Before Width: | Height: | Size: 31 KiB After Width: | Height: | Size: 17 KiB |
Reference in New Issue
Block a user