mirror of
https://github.com/jackyzha0/quartz.git
synced 2026-03-24 15:05:42 -05:00
Merge branch 'holy-grail' of https://github.com/DhammaCharts/quartz into holy-grail
This commit is contained in:
commit
cdcedaa612
4
.github/workflows/deploy.yaml
vendored
4
.github/workflows/deploy.yaml
vendored
@ -7,14 +7,14 @@ on:
|
||||
|
||||
jobs:
|
||||
deploy:
|
||||
runs-on: ubuntu-18.04
|
||||
runs-on: ubuntu-20.04
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
with:
|
||||
fetch-depth: 0 # Fetch all history for .GitInfo and .Lastmod
|
||||
|
||||
- name: Build Link Index
|
||||
uses: jackyzha0/hugo-obsidian@v2.13
|
||||
uses: jackyzha0/hugo-obsidian@v2.18
|
||||
with:
|
||||
index: true
|
||||
input: content
|
||||
|
||||
42
.github/workflows/docker-publish.yaml
vendored
Normal file
42
.github/workflows/docker-publish.yaml
vendored
Normal file
@ -0,0 +1,42 @@
|
||||
name: Create and publish a Docker image
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: ['hugo']
|
||||
|
||||
env:
|
||||
REGISTRY: ghcr.io
|
||||
IMAGE_NAME: ${{ github.repository }}
|
||||
|
||||
jobs:
|
||||
build-and-push-image:
|
||||
if: github.repository == 'jackyzha0/quartz'
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
contents: read
|
||||
packages: write
|
||||
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- name: Log in to the Container registry
|
||||
uses: docker/login-action@f054a8b539a109f9f41c372932f1ae047eff08c9
|
||||
with:
|
||||
registry: ${{ env.REGISTRY }}
|
||||
username: ${{ github.actor }}
|
||||
password: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
- name: Extract metadata (tags, labels) for Docker
|
||||
id: meta
|
||||
uses: docker/metadata-action@98669ae865ea3cffbcbaa878cf57c20bbf1c6c38
|
||||
with:
|
||||
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
|
||||
|
||||
- name: Build and push Docker image
|
||||
uses: docker/build-push-action@ad44023a93711e3deb337508980b4b5e9bcdc5dc
|
||||
with:
|
||||
context: .
|
||||
push: true
|
||||
tags: ${{ steps.meta.outputs.tags }}
|
||||
labels: ${{ steps.meta.outputs.labels }}
|
||||
1
.gitignore
vendored
1
.gitignore
vendored
@ -5,3 +5,4 @@ resources
|
||||
content/.obsidian
|
||||
assets/indices/linkIndex.json
|
||||
assets/indices/contentIndex.json
|
||||
linkmap
|
||||
|
||||
10
Dockerfile
Normal file
10
Dockerfile
Normal file
@ -0,0 +1,10 @@
|
||||
FROM alpine:3.16
|
||||
|
||||
RUN apk add --no-cache go hugo git make perl
|
||||
RUN go install github.com/jackyzha0/hugo-obsidian@latest
|
||||
ENV PATH="/root/go/bin:$PATH"
|
||||
RUN git clone https://github.com/jackyzha0/quartz.git /quartz
|
||||
|
||||
WORKDIR /quartz
|
||||
|
||||
CMD ["make", "serve"]
|
||||
6
Makefile
6
Makefile
@ -17,4 +17,8 @@ update-force: ## Forcefully pull all changes and don't ask to patch
|
||||
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
|
||||
hugo-obsidian -input=content -output=assets/indices -index -root=.
|
||||
hugo server --enableGitInfo --minify --bind=$(or $(HUGO_BIND),0.0.0.0) --baseURL=$(or $(HUGO_BASEURL),http://localhost) --port=$(or $(HUGO_PORT),1313) --appendPort=$(or $(HUGO_APPENDPORT),true) --liveReloadPort=$(or $(HUGO_LIVERELOADPORT),-1)
|
||||
|
||||
docker: ## Serve locally using Docker
|
||||
docker run -it --volume=$(shell pwd):/quartz -p 1313:1313 ghcr.io/jackyzha0/quartz:hugo
|
||||
|
||||
@ -2,10 +2,10 @@
|
||||
|
||||
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`
|
||||
1. Extremely fast natural-language search
|
||||
2. Customizable and hackable design based on Hugo
|
||||
3. Automatically generated backlinks, link previews, and local graph
|
||||
4. Built-in CJK + Latex Support
|
||||
4. Built-in CJK + Latex Support and Admonition-style callouts
|
||||
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!
|
||||
|
||||
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");
|
||||
}));
|
||||
}
|
||||
@ -8,33 +8,38 @@ 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;
|
||||
try {
|
||||
if (els[i].getElementsByClassName("clipboard-button").length) continue;
|
||||
|
||||
// find pre > code inside els[i]
|
||||
let codeBlocks = els[i].getElementsByTagName("code");
|
||||
// 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);
|
||||
// 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;
|
||||
button.ariaLabel = "opy the shown code";
|
||||
// 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);
|
||||
} catch(error) {
|
||||
console.debug(error);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,13 +1,17 @@
|
||||
|
||||
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);
|
||||
const els = document.getElementsByClassName("highlight");
|
||||
for (let i = 0; i < els.length; i++) {
|
||||
try {
|
||||
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);
|
||||
}
|
||||
} catch (error) {
|
||||
console.debug(error);
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
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) => {
|
||||
const 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(term, finalResults, true)
|
||||
})
|
||||
})()
|
||||
@ -1,14 +1,14 @@
|
||||
async function drawGraph(baseUrl, isHome, pathColors, graphConfig, modal = false) {
|
||||
|
||||
let {
|
||||
depth,
|
||||
enableDrag,
|
||||
enableLegend,
|
||||
enableZoom,
|
||||
opacityScale,
|
||||
scale,
|
||||
repelForce,
|
||||
fontSize} = graphConfig;
|
||||
depth,
|
||||
enableDrag,
|
||||
enableLegend,
|
||||
enableZoom,
|
||||
opacityScale,
|
||||
scale,
|
||||
repelForce,
|
||||
fontSize } = graphConfig;
|
||||
|
||||
const elementId = modal ? "graph-container-modal" : "graph-container" ;
|
||||
|
||||
@ -87,7 +87,7 @@ async function drawGraph(baseUrl, isHome, pathColors, graphConfig, modal = false
|
||||
d.fy = null
|
||||
}
|
||||
|
||||
const noop = () => {}
|
||||
const noop = () => { }
|
||||
return d3
|
||||
.drag()
|
||||
.on("start", enableDrag ? dragstarted : noop)
|
||||
@ -115,7 +115,7 @@ async function drawGraph(baseUrl, isHome, pathColors, graphConfig, modal = false
|
||||
.append("svg")
|
||||
.attr("width", width)
|
||||
.attr("height", height)
|
||||
.attr('viewBox', [-width / 2 * 1 / scale, -height / 2 * 1 / scale, width * 1 / scale, height * 1 / scale])
|
||||
.attr('viewBox', [-width / 2 / scale, -height / 2 / scale, width / scale, height / scale])
|
||||
|
||||
if (enableLegend) {
|
||||
const legend = [{ Current: "var(--g-node-active)" }, { Note: "var(--g-node)" }, ...pathColors]
|
||||
@ -157,7 +157,7 @@ async function drawGraph(baseUrl, isHome, pathColors, graphConfig, modal = false
|
||||
const nodeRadius = (d) => {
|
||||
const numOut = index.links[d.id]?.length || 0
|
||||
const numIn = index.backlinks[d.id]?.length || 0
|
||||
return 3 + (numOut + numIn) / 4
|
||||
return 2 + Math.sqrt(numOut + numIn)
|
||||
}
|
||||
|
||||
// draw individual nodes
|
||||
@ -170,9 +170,18 @@ async function drawGraph(baseUrl, isHome, pathColors, graphConfig, modal = false
|
||||
.style("cursor", "pointer")
|
||||
.on("click", (_, d) => {
|
||||
// SPA navigation
|
||||
window.Million.navigate(new URL(`${baseUrl}${decodeURI(d.id).replace(/\s+/g, "-")}/`), ".singlePage")
|
||||
const targ = `${baseUrl}${decodeURI(d.id).replace(/\s+/g, "-")}/`
|
||||
window.Million.navigate(new URL(targ), ".singlePage")
|
||||
plausible("Link Click", {
|
||||
props: {
|
||||
href: targ,
|
||||
broken: false,
|
||||
internal: true,
|
||||
graph: true,
|
||||
}
|
||||
})
|
||||
})
|
||||
.on("mouseover", function (_, d) {
|
||||
.on("mouseover", function(_, d) {
|
||||
d3.selectAll(".node").transition().duration(100).attr("fill", "var(--g-node-inactive)")
|
||||
|
||||
const neighbours = parseIdsFromLinks([
|
||||
@ -192,7 +201,7 @@ async function drawGraph(baseUrl, isHome, pathColors, graphConfig, modal = false
|
||||
// highlight links
|
||||
linkNodes.transition().duration(200).attr("stroke", "var(--g-link-active)")
|
||||
|
||||
const bigFont = fontSize*1.5
|
||||
const bigFont = fontSize * 1.5
|
||||
|
||||
// show text for self
|
||||
d3.select(this.parentNode)
|
||||
@ -202,10 +211,10 @@ async function drawGraph(baseUrl, isHome, pathColors, graphConfig, modal = false
|
||||
.duration(200)
|
||||
.attr('opacityOld', d3.select(this.parentNode).select('text').style("opacity"))
|
||||
.style('opacity', 1)
|
||||
.style('font-size', bigFont+'em')
|
||||
.style('font-size', bigFont + 'em')
|
||||
.attr('dy', d => nodeRadius(d) + 20 + 'px') // radius is in px
|
||||
})
|
||||
.on("mouseleave", function (_, d) {
|
||||
.on("mouseleave", function(_, d) {
|
||||
d3.selectAll(".node").transition().duration(200).attr("fill", color)
|
||||
|
||||
const currentId = d.id
|
||||
@ -216,12 +225,12 @@ async function drawGraph(baseUrl, isHome, pathColors, graphConfig, modal = false
|
||||
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
|
||||
.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))
|
||||
|
||||
@ -231,10 +240,10 @@ async function drawGraph(baseUrl, isHome, pathColors, graphConfig, modal = false
|
||||
.attr("dx", 0)
|
||||
.attr("dy", (d) => nodeRadius(d) + 8 + "px")
|
||||
.attr("text-anchor", "middle")
|
||||
.text((d) => content[d.id]?.title || d.id.replace("-", " "))
|
||||
.text((d) => content[d.id]?.title || (d.id.charAt(1).toUpperCase() + d.id.slice(2)).replace("-", " "))
|
||||
.style('opacity', (opacityScale - 1) / 3.75)
|
||||
.style("pointer-events", "none")
|
||||
.style('font-size', fontSize+'em')
|
||||
.style('font-size', fontSize + 'em')
|
||||
.raise()
|
||||
.call(drag(simulation))
|
||||
|
||||
|
||||
@ -5,14 +5,14 @@ function htmlToElement(html) {
|
||||
return template.content.firstChild
|
||||
}
|
||||
|
||||
function initPopover(baseURL, useContextualBacklinks, renderLatex) {
|
||||
function initPopover(baseURL, useContextualBacklinks) {
|
||||
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
|
||||
let el
|
||||
if (li.dataset.ctx) {
|
||||
const linkDest = content[li.dataset.src]
|
||||
const popoverElement = `<div class="popover">
|
||||
@ -24,9 +24,16 @@ function initPopover(baseURL, useContextualBacklinks, renderLatex) {
|
||||
} 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 = decodeURIComponent(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>${removeMarkdown(linkDest.content).split(" ", 20).join(" ")}...</p>
|
||||
<p>${cleanedContent.split(" ", 20).join(" ")}...</p>
|
||||
<p class="meta">${new Date(linkDest.lastmodified).toLocaleDateString()}</p>
|
||||
</div>`
|
||||
el = htmlToElement(popoverElement)
|
||||
@ -35,13 +42,11 @@ function initPopover(baseURL, useContextualBacklinks, renderLatex) {
|
||||
|
||||
if (el) {
|
||||
li.appendChild(el)
|
||||
if (renderLatex) {
|
||||
if (LATEX_ENABLED) {
|
||||
renderMathInElement(el, {
|
||||
delimiters: [
|
||||
{ left: '$$', right: '$$', display: false },
|
||||
{ left: '$', right: '$', display: false },
|
||||
{ left: '\\(', right: '\\)', display: false },
|
||||
{ left: '\\[', right: '\\]', display: false }
|
||||
],
|
||||
throwOnError: false
|
||||
})
|
||||
@ -59,6 +64,11 @@ function initPopover(baseURL, useContextualBacklinks, renderLatex) {
|
||||
})
|
||||
|
||||
el.classList.add("visible")
|
||||
plausible("Popover Hover", {
|
||||
props: {
|
||||
href: li.dataset.src
|
||||
}
|
||||
})
|
||||
})
|
||||
li.addEventListener("mouseout", () => {
|
||||
el.classList.remove("visible")
|
||||
|
||||
@ -15,7 +15,6 @@ export const attachSPARouting = (init, rerender) => {
|
||||
}
|
||||
|
||||
const render = () => requestAnimationFrame(rerender)
|
||||
|
||||
window.addEventListener("DOMContentLoaded", () => {
|
||||
apply((doc) => init(doc))
|
||||
init()
|
||||
|
||||
54
assets/js/semantic-search.js
Normal file
54
assets/js/semantic-search.js
Normal file
@ -0,0 +1,54 @@
|
||||
// Note: Currently, we use the REST API for Operand because of some unpkg/webpack issues.
|
||||
// In the future, we'd like to use the SDK (https://github.com/operandinc/typescript-sdk).
|
||||
// If someone knows how to do this w/o breaking the Operand typescript-sdk for npm users,
|
||||
// please let Morgan (@morgallant) and/or (@_jzhao) know! <3
|
||||
|
||||
const apiKey = "{{$.Site.Data.config.search.operandApiKey}}"
|
||||
const indexId = "{{$.Site.Data.config.search.operandIndexId}}"
|
||||
|
||||
function parseSearchResults(searchResults) {
|
||||
return searchResults.matches.map((m) => ({
|
||||
content: m.content,
|
||||
title: searchResults.objects[m.objectId].properties.properties._title.text,
|
||||
url: searchResults.objects[m.objectId].properties.properties._url.text,
|
||||
}))
|
||||
}
|
||||
|
||||
async function searchContents(query) {
|
||||
const result = await fetch("https://api.operand.ai/operand.v1.ObjectService/SearchWithin", {
|
||||
method: "POST",
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
Authorization: `${apiKey}`,
|
||||
"Operand-Index-ID": `${indexId}`,
|
||||
},
|
||||
body: JSON.stringify({
|
||||
query: query,
|
||||
limit: 10,
|
||||
}),
|
||||
})
|
||||
if (result.ok) {
|
||||
return parseSearchResults(await result.json())
|
||||
} else {
|
||||
console.error(result)
|
||||
}
|
||||
}
|
||||
|
||||
function debounce(func, timeout = 200) {
|
||||
let timer
|
||||
return (...args) => {
|
||||
clearTimeout(timer)
|
||||
timer = setTimeout(() => {
|
||||
func.apply(this, args)
|
||||
}, timeout)
|
||||
}
|
||||
}
|
||||
|
||||
registerHandlers(
|
||||
debounce((e) => {
|
||||
let term = e.target.value
|
||||
if (term !== "") {
|
||||
searchContents(term).then((results) => displayResults(term, results))
|
||||
}
|
||||
}),
|
||||
)
|
||||
@ -40,33 +40,32 @@ const removeMarkdown = (
|
||||
.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(/([\*_]{1,3})(\S.*?\S?)\1/g, "$2")
|
||||
.replace(/([\*_]{1,3})(\S.*?\S?)\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 / 2
|
||||
const h = highlightWindow
|
||||
const before = content.substring(0, directMatchIdx).split(" ").slice(-h)
|
||||
const after = content
|
||||
.substring(directMatchIdx + term.length, content.length - 1)
|
||||
.substring(directMatchIdx + term.length, content.length - 2)
|
||||
.split(" ")
|
||||
.slice(0, h)
|
||||
return (
|
||||
(before.length == h ? `...${before.join(" ")}` : before.join(" ")) +
|
||||
(before.length === h ? `...${before.join(" ")}` : before.join(" ")) +
|
||||
`<span class="search-highlight">${term}</span>` +
|
||||
after.join(" ")
|
||||
)
|
||||
@ -103,68 +102,56 @@ const highlight = (content, term) => {
|
||||
})
|
||||
.join(" ")
|
||||
.replaceAll('</span> <span class="search-highlight">', " ")
|
||||
return `${startIndex === 0 ? "" : "..."}${mappedText}${
|
||||
endIndex === splitText.length ? "" : "..."
|
||||
}`
|
||||
return `${startIndex === 0 ? "" : "..."}${mappedText}${endIndex === splitText.length ? "" : "..."
|
||||
}`
|
||||
}
|
||||
|
||||
;(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 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) => {
|
||||
// SPA navigation
|
||||
window.Million.navigate(
|
||||
new URL(`${BASE_URL.replace(/\/$/g, "")}${id}#:~:text=${encodeURIComponent(term)}/`),
|
||||
".singlePage",
|
||||
)
|
||||
closeSearch()
|
||||
}
|
||||
|
||||
const formatForDisplay = (id) => ({
|
||||
id,
|
||||
url: id,
|
||||
title: content[id].title,
|
||||
content: content[id].content,
|
||||
// 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) => {
|
||||
const shouldTrim = PRODUCTION && SEARCH_ENABLED
|
||||
const baseURLPrefix = shouldTrim ? "" : BASE_URL.replace(/\/$/g, "")
|
||||
const urlString = `${baseURLPrefix}${id}#:~:text=${encodeURIComponent(term)}/`
|
||||
window.Million.navigate(
|
||||
new URL(urlString),
|
||||
".singlePage",
|
||||
)
|
||||
closeSearch()
|
||||
plausible("Search", {
|
||||
props: {
|
||||
term
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
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") {
|
||||
@ -172,68 +159,7 @@ const highlight = (content, term) => {
|
||||
redir(anchor.id, term)
|
||||
}
|
||||
})
|
||||
source.addEventListener("input", (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)
|
||||
|
||||
// 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"
|
||||
}
|
||||
|
||||
source.addEventListener("input", onInputFn)
|
||||
document.addEventListener("keydown", (event) => {
|
||||
if (event.key === "k" && (event.ctrlKey || event.metaKey)) {
|
||||
event.preventDefault()
|
||||
@ -246,16 +172,55 @@ const highlight = (content, term) => {
|
||||
})
|
||||
|
||||
const searchButton = document.getElementById("search-icon")
|
||||
searchButton.addEventListener("click", (evt) => {
|
||||
searchButton.addEventListener("click", (_) => {
|
||||
openSearch()
|
||||
})
|
||||
searchButton.addEventListener("keydown", (evt) => {
|
||||
searchButton.addEventListener("keydown", (_) => {
|
||||
openSearch()
|
||||
})
|
||||
searchContainer.addEventListener("click", (evt) => {
|
||||
searchContainer.addEventListener("click", (_) => {
|
||||
closeSearch()
|
||||
})
|
||||
document.getElementById("search-space").addEventListener("click", (evt) => {
|
||||
evt.stopPropagation()
|
||||
})
|
||||
})()
|
||||
}
|
||||
|
||||
const displayResults = (term, 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")
|
||||
if (LATEX_ENABLED) {
|
||||
renderMathInElement(results, {
|
||||
delimiters: [
|
||||
{ left: '$$', right: '$$', display: false },
|
||||
{ left: '$', right: '$', display: false },
|
||||
],
|
||||
throwOnError: false
|
||||
})
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -11,6 +11,7 @@
|
||||
--lightgray: #f0f0f0;
|
||||
--outlinegray: #dadada;
|
||||
--million-progress-bar-color: var(--secondary);
|
||||
--highlighted: #f5dfaf88;
|
||||
}
|
||||
|
||||
[saved-theme="dark"] {
|
||||
@ -23,4 +24,5 @@
|
||||
--gray: #d4d4d4 !important;
|
||||
--lightgray: #292633 !important;
|
||||
--outlinegray: #343434 !important;
|
||||
--highlighted: #574010;
|
||||
}
|
||||
|
||||
@ -60,3 +60,7 @@
|
||||
pre.chroma {
|
||||
-moz-tab-size:4;-o-tab-size:4;tab-size:4;
|
||||
}
|
||||
|
||||
.katex {
|
||||
font-size: 1.1em !important;
|
||||
}
|
||||
|
||||
@ -1,6 +1,5 @@
|
||||
baseURL = "https://www.dhammacharts.org/quartz/"
|
||||
languageCode = "en-us"
|
||||
googleAnalytics = "G-XYFD95KB4J"
|
||||
relativeURLs = false
|
||||
disablePathToLower = true
|
||||
ignoreFiles = [
|
||||
|
||||
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
|
||||
57
content/notes/docker.md
Normal file
57
content/notes/docker.md
Normal file
@ -0,0 +1,57 @@
|
||||
---
|
||||
title: "Hosting with Docker"
|
||||
tags:
|
||||
- setup
|
||||
---
|
||||
|
||||
If you want to host Quartz on a machine without using a webpage hosting service, it may be easier to [install Docker Compose](https://docs.docker.com/compose/install/) and follow the instructions below than to [install Quartz's dependencies manually](notes/preview%20changes.md).
|
||||
## Hosting Quartz Locally
|
||||
You can serve Quartz locally at `http://localhost:1313` with the following script, replacing `/path/to/quartz` with the
|
||||
actual path to your Quartz folder.
|
||||
|
||||
docker-compose.yml
|
||||
```
|
||||
services:
|
||||
quartz-hugo:
|
||||
image: ghcr.io/jackyzha0/quartz:hugo
|
||||
container_name: quartz-hugo
|
||||
volumes:
|
||||
- /path/to/quartz:/quartz
|
||||
ports:
|
||||
- 1313:1313
|
||||
|
||||
# optional
|
||||
environment:
|
||||
- HUGO_BIND=0.0.0.0
|
||||
- HUGO_BASEURL=http://localhost
|
||||
- HUGO_PORT=1313
|
||||
- HUGO_APPENDPORT=true
|
||||
- HUGO_LIVERELOADPORT=-1
|
||||
```
|
||||
|
||||
Then run with: `docker-compose up -d` in the same directory as your `docker-compose.yml` file.
|
||||
|
||||
While the container is running, you can update the `quartz` fork with: `docker exec -it quartz-hugo make update`.
|
||||
|
||||
## Exposing Your Container to the Internet
|
||||
|
||||
### To Your Public IP Address with Port Forwarding (insecure)
|
||||
|
||||
Assuming you are already familiar with [port forwarding](https://en.wikipedia.org/wiki/Port_forwarding) and [setting it up with your router model](https://portforward.com):
|
||||
|
||||
1. You should set the environment variable `HUGO_BASEURL=http://your-public-ip` and then start your container.
|
||||
2. Set up port forwarding on your router from port `p` to `your-local-ip:1313`.
|
||||
3. You should now be able to access Quartz from outside your local network at `http://your-public-ip:p`.
|
||||
|
||||
However, your HTTP connection will be unencrypted and **this method is not secure**.
|
||||
|
||||
### To a Domain using Cloudflare Proxy
|
||||
|
||||
1. Port forward 443 (HTTPS) from your machine.
|
||||
2. Buy a custom domain (say, `your-domain.com`) from [Cloudflare](https://www.cloudflare.com/products/registrar/). Point a DNS A record from `your-domain.com` to your public IP address and enable the proxy.
|
||||
3. Set the environment variables `HUGO_BASEURL=https://your-domain.com`, `HUGO_PORT=443`, and `HUGO_APPENDPORT=false`. Change `1313:1313` to `443:443` for the `ports` in `docker-compose.yml`.
|
||||
4. Spin up your Quartz container and enjoy it at `https://your-domain.com`!
|
||||
|
||||
### To a Domain using a Reverse Proxy
|
||||
|
||||
If you want to serve more than just Quartz to the internet on this machine (or don't want to use the Cloudflare registrar and proxy), you should follow the steps in the section above (as appropriate) and also set up a reverse proxy, like [Traefik](https://doc.traefik.io/traefik). Be sure to configure your TLS certificates too!
|
||||
37
content/notes/search.md
Normal file
37
content/notes/search.md
Normal file
@ -0,0 +1,37 @@
|
||||
---
|
||||
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://beta.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. Login or Register for a new Operand account. Click the verification link sent to your email, and you'll be redirected to the dashboard. (Note) You do not need to enter a credit card to create an account, or get started with the Operand API. The first $10 of usage each month is free. To learn more, see pricing. If you go over your free quota, we'll (politely) reach out and ask you to configure billing.
|
||||
2. Create your first index. On the dashboard, under "Indexes", enter the name and description of your index, and click "Create Index". Note down the ID of the index (obtained by clicking on the index name in the list of indexes), as you'll need it in the next step. IDs are unique to each index, and look something like `uqv1duxxbdxu`.
|
||||
3. Click into the index you've created. Under "Index Something", select "SITEMAP" from the dropdown and click "Add Source".
|
||||
4. For the "Sitemap.xml URL", put your deployed site's base URL followed by `sitemap.xml`. For example, for `quartz.jzhao.xyz`, put `https://quartz.jzhao.xyz/sitemap.xml`. Leave the URL Regex empty.
|
||||
5. Get your API key. On the dashboard, under "API Keys", you can manage your API keys. If you don't already have an API key, click "Create API Key". You'll need this for the next step.
|
||||
6. Open `data/config.yaml`. Set `enableSemanticSearch` to `true`, `operandApiKey` to your copied key, and `operandIndexId` to the ID of the index we created from earlier..
|
||||
|
||||
```yaml {title="data/config.yaml"}
|
||||
# the default option
|
||||
search:
|
||||
enableSemanticSearch: true
|
||||
operandApiKey: "jp9k5hudse2a828z98kxd6z3payi8u90rnjf"
|
||||
operandIndexId: "s0kf3bd6tldw"
|
||||
```
|
||||
7. Push your changes to the site and wait for it to deploy.
|
||||
8. Check the Operand dashboard and wait for your site to index. Enjoy natural language search powered by Operand!
|
||||
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/bn.toml
Normal file
65
i18n/bn.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 = "প্রথম ১০ টি ফলাফল"
|
||||
|
||||
[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 = "প্রথম ৩ {{ .notes }}"
|
||||
|
||||
[search_for_something]
|
||||
other = "খুঁজুন..."
|
||||
|
||||
[toc]
|
||||
other = "সূচিপত্র"
|
||||
|
||||
[copyright]
|
||||
other = "{{ .name }} কর্তৃক <a href=\"https://github.com/jackyzha0/quartz\">Quartz</a> ব্যবহার করে তৈরিকৃত © {{ .year }}"
|
||||
65
i18n/de.toml
Normal file
65
i18n/de.toml
Normal file
@ -0,0 +1,65 @@
|
||||
[404_message]
|
||||
other = "Hey! Hast du dich verirrt? Diese Seite existiert leider nicht (oder ist privat)."
|
||||
|
||||
[404_back]
|
||||
other = "↳ Zurück zur Startseite."
|
||||
|
||||
[all_posts]
|
||||
other = "Alle {{.Title}}"
|
||||
|
||||
[last_updated]
|
||||
other = "Zuletzt aktualisiert"
|
||||
|
||||
[notes_count]
|
||||
other = "Beiträge mit diesem Tag"
|
||||
|
||||
[first_10]
|
||||
other = "Zeige die ersten 10 Ergebnisse"
|
||||
|
||||
[tag]
|
||||
other = "Tag"
|
||||
|
||||
[backlinks]
|
||||
other = "Backlinks"
|
||||
|
||||
[no_backlinks]
|
||||
other = "Keine Backlinks gefunden"
|
||||
|
||||
[home]
|
||||
other = "Home"
|
||||
|
||||
[light_mode]
|
||||
other = "Light Mode"
|
||||
|
||||
[dark_mode]
|
||||
other = "Dark Mode"
|
||||
|
||||
[edit_source]
|
||||
other = "Quelldatei bearbeiten"
|
||||
|
||||
[interactive_graph]
|
||||
other = "Interaktiver Graph"
|
||||
|
||||
[search]
|
||||
other = "Suche"
|
||||
|
||||
[search_icon]
|
||||
other = "Suchsymbol"
|
||||
|
||||
[icon_search]
|
||||
other = "Symbol, um die Suche zu öffnen"
|
||||
|
||||
[recent_notes]
|
||||
other = "Neuste Beiträge"
|
||||
|
||||
[first_3_notes]
|
||||
other = "Die ersten 3 {{ .notes }}"
|
||||
|
||||
[search_for_something]
|
||||
other = "Suche nach etwas ..."
|
||||
|
||||
[toc]
|
||||
other = "Inhaltsverzeichnis"
|
||||
|
||||
[copyright]
|
||||
other = "Made by {{ .name }} using <a href=\"https://github.com/jackyzha0/quartz\">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 }}"
|
||||
65
i18n/es.toml
Normal file
65
i18n/es.toml
Normal file
@ -0,0 +1,65 @@
|
||||
[404_message]
|
||||
other = "Hey! Te ves un poco perdido. Esta página no existe (o puede que sea privada)."
|
||||
|
||||
[404_back]
|
||||
other = "↳ Vamos a llevarte de regreso a casa."
|
||||
|
||||
[all_posts]
|
||||
other = "Todos {{.Title}}"
|
||||
|
||||
[last_updated]
|
||||
other = "Actualizado por última vez"
|
||||
|
||||
[notes_count]
|
||||
other = "notas con esta etiqueta"
|
||||
|
||||
[first_10]
|
||||
other = "mostrando los primeros 10 resultados"
|
||||
|
||||
[tag]
|
||||
other = "Etiqueta"
|
||||
|
||||
[backlinks]
|
||||
other = "Backlinks"
|
||||
|
||||
[no_backlinks]
|
||||
other = "No se encontraron backlinks"
|
||||
|
||||
[home]
|
||||
other = "Casa"
|
||||
|
||||
[light_mode]
|
||||
other = "Modo Claro"
|
||||
|
||||
[dark_mode]
|
||||
other = "Modo Oscuro"
|
||||
|
||||
[edit_source]
|
||||
other = "Editar Fuente"
|
||||
|
||||
[interactive_graph]
|
||||
other = "Gráfico Interactivo"
|
||||
|
||||
[search]
|
||||
other = "Búsqueda"
|
||||
|
||||
[search_icon]
|
||||
other = "Ícono de Búsqueda"
|
||||
|
||||
[icon_search]
|
||||
other = "Ícono para abrir la búsqueda"
|
||||
|
||||
[recent_notes]
|
||||
other = "Notas Recientes"
|
||||
|
||||
[first_3_notes]
|
||||
other = "primeras 3 {{ .notes }}"
|
||||
|
||||
[search_for_something]
|
||||
other = "Buscar algo..."
|
||||
|
||||
[toc]
|
||||
other = "Tabla de Contenido"
|
||||
|
||||
[copyright]
|
||||
other = "Hecho por {{ .name }} usando <a href=\"https://github.com/jackyzha0/quartz\">Quartz</a>, © {{ .year }}"
|
||||
65
i18n/fr.toml
Normal file
65
i18n/fr.toml
Normal file
@ -0,0 +1,65 @@
|
||||
[404_message]
|
||||
other = "Hey ! Vous semblez perdu‧e. Cette page n'existe pas (ou est privée)."
|
||||
|
||||
[404_back]
|
||||
other = "↳ On va te faire retourner à l'accueil"
|
||||
|
||||
[all_posts]
|
||||
other = "Tout {{.Title}}"
|
||||
|
||||
[last_updated]
|
||||
other = "Dernière modification"
|
||||
|
||||
[notes_count]
|
||||
other = "notes avec ce tag"
|
||||
|
||||
[first_10]
|
||||
other = "affichant les 10 premiers résultats"
|
||||
|
||||
[tag]
|
||||
other = "Tag"
|
||||
|
||||
[backlinks]
|
||||
other = "Backlinks"
|
||||
|
||||
[no_backlinks]
|
||||
other = "Pas de backlinks trouvés"
|
||||
|
||||
[home]
|
||||
other = "Accueil"
|
||||
|
||||
[light_mode]
|
||||
other = "Mode Clair"
|
||||
|
||||
[dark_mode]
|
||||
other = "Mode Sombre"
|
||||
|
||||
[edit_source]
|
||||
other = "Editer la source"
|
||||
|
||||
[interactive_graph]
|
||||
other = "Graphique interactif"
|
||||
|
||||
[search]
|
||||
other = "Rechercher"
|
||||
|
||||
[search_icon]
|
||||
other = "Icône de recherche"
|
||||
|
||||
[icon_search]
|
||||
other = "Icon pour ouvrir la recherche"
|
||||
|
||||
[recent_notes]
|
||||
other = "Notes récentes"
|
||||
|
||||
[first_3_notes]
|
||||
other = "3 premières {{ .notes }}"
|
||||
|
||||
[search_for_something]
|
||||
other = "Rechercher quelque-chose..."
|
||||
|
||||
[toc]
|
||||
other = "Table des matières"
|
||||
|
||||
[copyright]
|
||||
other = "Fait par {{ .name }} en utilisant <a href=\"https://github.com/jackyzha0/quartz\">Quartz</a>, © {{ .year }}"
|
||||
65
i18n/it.toml
Normal file
65
i18n/it.toml
Normal file
@ -0,0 +1,65 @@
|
||||
[404_message]
|
||||
other = "Hey, ti sei perso? Questa pagina non esiste (o è privata)"
|
||||
|
||||
[404_back]
|
||||
other = "↳ Torna alla home."
|
||||
|
||||
[all_posts]
|
||||
other = "Tutti {{.Title}}"
|
||||
|
||||
[last_updated]
|
||||
other = "Ultima modifica"
|
||||
|
||||
[notes_count]
|
||||
other = "note con questo tag"
|
||||
|
||||
[first_10]
|
||||
other = "mostrando i primi 10 risultati"
|
||||
|
||||
[tag]
|
||||
other = "Tag"
|
||||
|
||||
[backlinks]
|
||||
other = "Backlinks"
|
||||
|
||||
[no_backlinks]
|
||||
other = "Nessun Backlink trovato"
|
||||
|
||||
[home]
|
||||
other = "Home"
|
||||
|
||||
[light_mode]
|
||||
other = "Modalità Chiara"
|
||||
|
||||
[dark_mode]
|
||||
other = "Modalità Scura"
|
||||
|
||||
[edit_source]
|
||||
other = "Modifica Sorgente"
|
||||
|
||||
[interactive_graph]
|
||||
other = "Grafico Interattivo"
|
||||
|
||||
[search]
|
||||
other = "Cerca"
|
||||
|
||||
[search_icon]
|
||||
other = "Icona di ricerca"
|
||||
|
||||
[icon_search]
|
||||
other = "Icona per aprire la ricerca"
|
||||
|
||||
[recent_notes]
|
||||
other = "Note Recenti"
|
||||
|
||||
[first_3_notes]
|
||||
other = "prime 3 {{ .notes }}"
|
||||
|
||||
[search_for_something]
|
||||
other = "Cerca qualcosa..."
|
||||
|
||||
[toc]
|
||||
other = "Indice"
|
||||
|
||||
[copyright]
|
||||
other = "Realizzato da {{ .name }} con <a href=\"https://github.com/jackyzha0/quartz\">Quartz</a>, © {{ .year }}"
|
||||
65
i18n/no.toml
Normal file
65
i18n/no.toml
Normal file
@ -0,0 +1,65 @@
|
||||
[404_message]
|
||||
other = "Hei! Ser ut til at du har gått deg vill. Denne siden finnes ikke (eller den kan være privat)."
|
||||
|
||||
[404_back]
|
||||
other = "↳ La oss få deg hjem."
|
||||
|
||||
[all_posts]
|
||||
other = "Alle {{.Title}}"
|
||||
|
||||
[last_updated]
|
||||
other = "Sist oppdatert"
|
||||
|
||||
[notes_count]
|
||||
other = "notater med denne taggen"
|
||||
|
||||
[first_10]
|
||||
other = "viser første 10 resultatene"
|
||||
|
||||
[tag]
|
||||
other = "Tag"
|
||||
|
||||
[backlinks]
|
||||
other = "Tilbakekoblinger"
|
||||
|
||||
[no_backlinks]
|
||||
other = "Ingen tilbakekoblinger funnet"
|
||||
|
||||
[home]
|
||||
other = "Hjem"
|
||||
|
||||
[light_mode]
|
||||
other = "Lys Modus"
|
||||
|
||||
[dark_mode]
|
||||
other = "Mørk Modus"
|
||||
|
||||
[edit_source]
|
||||
other = "Rediger Kilde"
|
||||
|
||||
[interactive_graph]
|
||||
other = "Interaktiv Graf"
|
||||
|
||||
[search]
|
||||
other = "Søk"
|
||||
|
||||
[search_icon]
|
||||
other = "Søkeikon"
|
||||
|
||||
[icon_search]
|
||||
other = "Ikon for å åpne søk"
|
||||
|
||||
[recent_notes]
|
||||
other = "Nylige notater"
|
||||
|
||||
[first_3_notes]
|
||||
other = "første 3 {{ .notes }}"
|
||||
|
||||
[search_for_something]
|
||||
other = "Søk etter noe..."
|
||||
|
||||
[toc]
|
||||
other = "Innholdsfortegnelse"
|
||||
|
||||
[copyright]
|
||||
other = "Opprettet av {{ .name }} ved hjelp av <a href=\"https://github.com/jackyzha0/quartz\">Quartz</a>, © {{ .year }}"
|
||||
65
i18n/tr.toml
Normal file
65
i18n/tr.toml
Normal file
@ -0,0 +1,65 @@
|
||||
[404_message]
|
||||
other = "Hey! Biraz kaybolmuş görünüyorsun. Bu sayfa mevcut değil (veya özel olabilir)."
|
||||
|
||||
[404_back]
|
||||
other = "↳ Seni eve götürelim."
|
||||
|
||||
[all_posts]
|
||||
other = "Hepsi {{.Title}}"
|
||||
|
||||
[last_updated]
|
||||
other = "Son güncelleme"
|
||||
|
||||
[notes_count]
|
||||
other = "Bu etikete sahip notlar"
|
||||
|
||||
[first_10]
|
||||
other = "İlk 10 sonuç gösteriliyor"
|
||||
|
||||
[tag]
|
||||
other = "Etiket"
|
||||
|
||||
[backlinks]
|
||||
other = "Geri bağlantılar"
|
||||
|
||||
[no_backlinks]
|
||||
other = "Geri bağlantı bulunamadı"
|
||||
|
||||
[home]
|
||||
other = "Ev"
|
||||
|
||||
[light_mode]
|
||||
other = "Aydınlık Modu"
|
||||
|
||||
[dark_mode]
|
||||
other = "Karanlık Modu"
|
||||
|
||||
[edit_source]
|
||||
other = "Kaynağı Düzenle"
|
||||
|
||||
[interactive_graph]
|
||||
other = "Etkileşimli Grafik"
|
||||
|
||||
[search]
|
||||
other = "Ara"
|
||||
|
||||
[search_icon]
|
||||
other = "Arama Simgesi"
|
||||
|
||||
[icon_search]
|
||||
other = "Aramayı açmak için simge tıklayın"
|
||||
|
||||
[recent_notes]
|
||||
other = "Son Notlar"
|
||||
|
||||
[first_3_notes]
|
||||
other = "İlk Üç {{ .notes }}"
|
||||
|
||||
[search_for_something]
|
||||
other = "Bir şey ara..."
|
||||
|
||||
[toc]
|
||||
other = "İçindekiler"
|
||||
|
||||
[copyright]
|
||||
other = "{{ .name }} tarafından <a href=\"https://github.com/jackyzha0/quartz\">Quartz</a> kullanılarak yapılmıştır, © {{ .year }}"
|
||||
65
i18n/uk.toml
Normal file
65
i18n/uk.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\">Quartz</a>, © {{ .year }}"
|
||||
65
i18n/zh-cn.toml
Normal file
65
i18n/zh-cn.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\">Quartz</a> 创造, © {{ .year }}"
|
||||
@ -1,5 +1,5 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<html lang="{{ .Lang }}">
|
||||
{{ partial "head.html" . }}
|
||||
|
||||
<body>
|
||||
@ -7,10 +7,9 @@
|
||||
{{partial "darkmode.html" .}}
|
||||
<div class="centered">
|
||||
<h1>404.</h1>
|
||||
<h3>Hey! You look a little lost. This page doesn't exist (or may be private).</h3>
|
||||
<a href="{{ .Site.BaseURL }}">↳ Let's get you home.</a>
|
||||
<h3>{{ i18n "404_message" }}</h3>
|
||||
<a href="{{ .Site.BaseURL }}">{{ i18n "404_back" }}</a>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
|
||||
4
layouts/_default/_markup/render-codeblock-mermaid.html
Normal file
4
layouts/_default/_markup/render-codeblock-mermaid.html
Normal file
@ -0,0 +1,4 @@
|
||||
<div class="mermaid">
|
||||
{{- .Inner | safeHTML }}
|
||||
</div>
|
||||
{{ .Page.Store.Set "hasMermaid" true }}
|
||||
@ -1,9 +1,9 @@
|
||||
{{$trimmed := strings.TrimSuffix ".md" (.Destination | safeURL)}}
|
||||
{{$dashedurl := replace $trimmed "%20" "-" }}
|
||||
{{$dashedurl := replace .Destination "%20" "-" }}
|
||||
{{$external := strings.HasPrefix $dashedurl "http" }}
|
||||
{{- if $external -}}
|
||||
<a href="{{ $dashedurl }}" rel="noopener">{{ .Text | safeHTML }}</a>
|
||||
{{- else -}}
|
||||
{{$trimmed := strings.TrimSuffix ".md" (.Destination | safeURL)}}
|
||||
{{$spacedurl := replace $trimmed "%20" " " }}
|
||||
{{$fixedUrl := (cond (hasPrefix $spacedurl "/") $spacedurl (print "/" $spacedurl)) | urlize}}
|
||||
{{$nonexistent := eq (.Page.GetPage $spacedurl).RelPermalink ""}}
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<html lang="{{ .Lang }}">
|
||||
{{ block "head" . }}
|
||||
{{ end }}
|
||||
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<html lang="{{ .Lang }}">
|
||||
{{ partial "head.html" . }}
|
||||
|
||||
<body>
|
||||
@ -8,7 +8,7 @@
|
||||
<!-- Begin actual content -->
|
||||
{{partial "header.html" .}}
|
||||
<article>
|
||||
<h1>All {{.Title}}</h1>
|
||||
<h1>{{ i18n "all_posts" . }}</h1>
|
||||
{{with .Params.description}}
|
||||
<p>{{.}}</p>
|
||||
{{end}}
|
||||
@ -18,5 +18,4 @@
|
||||
{{partial "contact.html" .}}
|
||||
</div>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<html lang="{{ .Lang }}">
|
||||
{{ partial "head.html" . }}
|
||||
|
||||
<body>
|
||||
@ -8,7 +8,7 @@
|
||||
<!-- Begin actual content -->
|
||||
{{partial "header.html" .}}
|
||||
<article>
|
||||
<h1>All {{.Title}}</h1>
|
||||
<h1>{{ i18n "all_posts" . }}</h1>
|
||||
{{with .Params.description}}
|
||||
<p>{{.}}</p>
|
||||
{{end}}
|
||||
@ -16,7 +16,7 @@
|
||||
{{ range .Site.Taxonomies.tags.ByCount }}
|
||||
<div class="meta">
|
||||
<h1><a href="{{ .Page.Permalink }}">{{ .Page.Title | humanize }}</a></h1>
|
||||
<p><b>{{ .Count }}</b> notes with this tag {{if gt .Count 10}}(showing first 10 results){{end}}</p>
|
||||
<p><b>{{ .Count }}</b> {{ i18n "notes_count" }} {{if gt .Count 10}}({{ i18n "first_10"}}){{end}}</p>
|
||||
</div>
|
||||
{{ with ($.Site.GetPage (printf "/tags/%s" .Page.Title)) }}
|
||||
{{partial "page-list.html" (first 10 .Pages.ByLastmod.Reverse)}}
|
||||
@ -27,5 +27,4 @@
|
||||
{{partial "contact.html" .}}
|
||||
</div>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<html lang="{{ .Lang }}">
|
||||
{{ partial "head.html" . }}
|
||||
|
||||
<body>
|
||||
@ -8,7 +8,7 @@
|
||||
<!-- Begin actual content -->
|
||||
{{partial "header.html" .}}
|
||||
<article>
|
||||
<h1>Tag: {{ .Title }}</h1>
|
||||
<h1>{{ i18n "tag" }}: {{ .Title }}</h1>
|
||||
{{with .Params.description}}
|
||||
<p>{{.}}</p>
|
||||
{{end}}
|
||||
@ -18,5 +18,4 @@
|
||||
{{partial "contact.html" .}}
|
||||
</div>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
<h3>Backlinks</h3>
|
||||
<h3>{{ i18n "backlinks" }}</h3>
|
||||
<ul class="backlinks">
|
||||
{{$url := urls.Parse .Site.BaseURL }}
|
||||
{{$host := strings.TrimRight "/" $url.Path }}
|
||||
@ -24,7 +24,7 @@
|
||||
{{- end -}}
|
||||
{{else}}
|
||||
<li>
|
||||
No backlinks found
|
||||
{{ i18n "no_backlinks" }}
|
||||
</li>
|
||||
{{end}}
|
||||
</ul>
|
||||
|
||||
@ -1,12 +1,17 @@
|
||||
<!-- 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 -->
|
||||
<div id="contact_buttons">
|
||||
<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 }}
|
||||
{{ $year := dateFormat "2006" now }}
|
||||
<p>{{ i18n "copyright" (dict "name" $name "year" $year) | safeHTML}}</p>
|
||||
<ul>
|
||||
{{ if not .IsHome }}
|
||||
<li><a href="{{ $.Site.BaseURL}}">Home</a></li>
|
||||
<li><a href="{{ $.Site.BaseURL}}">{{ i18n "home" }}</a></li>
|
||||
{{end}}
|
||||
{{- range $.Site.Data.config.links -}}
|
||||
{{- range $data.links | default $.Site.Data.config.links -}}
|
||||
<li><a href="{{.link}}">{{.link_name}}</a></li>
|
||||
{{- end -}}
|
||||
</ul>
|
||||
|
||||
@ -2,13 +2,13 @@
|
||||
<input class='toggle' id='darkmode-toggle' type='checkbox' 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">
|
||||
<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" />
|
||||
</svg>
|
||||
</label>
|
||||
<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">
|
||||
<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" />
|
||||
</svg>
|
||||
</label>
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
{{if $.Site.Data.config.enableFooter}}
|
||||
{{if $.Site.Data.graphConfig.enableGlobalGraph}}
|
||||
<div class="page-end">
|
||||
<div class="page-end" id="footer">
|
||||
|
||||
<div>
|
||||
{{partial "graph.html" .}}
|
||||
@ -9,7 +9,7 @@
|
||||
</div>
|
||||
{{else}}
|
||||
<hr/>
|
||||
<div class="page-end">
|
||||
<div class="page-end" id="footer">
|
||||
<div class="backlinks-container">
|
||||
{{partial "backlinks.html" .}}
|
||||
</div>
|
||||
|
||||
@ -1,3 +1,3 @@
|
||||
{{if $.Site.Data.config.enableGitHubEdit}}
|
||||
<a href="{{$.Site.Data.config.GitHubLink}}/{{.Path}}" rel="noopener">Edit Source</a>
|
||||
<a href="{{$.Site.Data.config.GitHubLink}}/{{.File.Path}}" rel="noopener">{{ i18n "edit_source" }}</a>
|
||||
{{end}}
|
||||
|
||||
@ -1,9 +1,10 @@
|
||||
<header>
|
||||
<h1 id="page-title"><a href="{{ .Site.BaseURL }}">{{ .Site.Data.config.page_title }}</a></h1>
|
||||
{{ $config := cond (eq $.Site.Language.Lang "en") "config" (printf "config.%s" $.Site.Language.Lang) }}
|
||||
<h1 id="page-title"><a class="root-title" 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>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">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>
|
||||
<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>
|
||||
|
||||
@ -1,5 +1,14 @@
|
||||
{{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}}
|
||||
<link rel="preload" href="https://cdn.jsdelivr.net/npm/katex@0.15.1/dist/katex.min.css" as="style"
|
||||
onload="this.onload=null;this.rel='stylesheet'"
|
||||
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>
|
||||
<script defer src="https://cdn.jsdelivr.net/npm/katex@0.16.2/dist/contrib/copy-tex.min.js"
|
||||
integrity="sha384-ww/583aHhxWkz5DEVn6OKtNiIaLi2iBRNZXfJRiY1Ai7tnJ9UXpEsyvOITVpTl4A"
|
||||
crossorigin="anonymous"></script>
|
||||
{{end}}
|
||||
8
layouts/partials/mermaid.html
Normal file
8
layouts/partials/mermaid.html
Normal file
@ -0,0 +1,8 @@
|
||||
{{if $.Site.Data.config.enableMermaid}}
|
||||
{{ if .Page.Store.Get "hasMermaid" }}
|
||||
<script type="module">
|
||||
import mermaid from 'https://unpkg.com/mermaid@9/dist/mermaid.esm.min.mjs';
|
||||
mermaid.initialize({ startOnLoad: true });
|
||||
</script>
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
@ -6,7 +6,7 @@
|
||||
{{partial "date-fmt.html" .}}
|
||||
</p>
|
||||
<div class="desc">
|
||||
<h3><a href="{{ .Permalink }}">{{- .Title -}}</a></h3>
|
||||
<h3><a href="{{ .Permalink }}" class="internal-link" data-src="{{ .RelPermalink }}">{{- .Title -}}</a></h3>
|
||||
</div>
|
||||
<div class="spacer"></div>
|
||||
<ul class="tags">
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
<div class="content-list">
|
||||
<h2>Recent Notes</h2>
|
||||
<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
|
||||
|
||||
@ -1,10 +1,18 @@
|
||||
<div id="search-container">
|
||||
<div id="search-space">
|
||||
<input autocomplete="off" id="search-bar" name="search" type="text" aria-label="Search" placeholder="Search for something...">
|
||||
<div id="results-container">
|
||||
</div>
|
||||
<div id="search-space">
|
||||
<input autocomplete="off" id="search-bar" name="search" type="text" aria-label="{{ i18n "search" }}"
|
||||
placeholder="{{ i18n "search_for_something" }}" dir="{{ $.Site.Language.LanguageDirection }}">
|
||||
<div id="results-container">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<script src="https://cdn.jsdelivr.net/npm/flexsearch@0.7.21/dist/flexsearch.bundle.js" integrity="sha256-i3A0NZGkhsKjVMzFxv3ksk0DZh3aXqu0l49Bbh0MdjE=" crossorigin="anonymous" defer></script>
|
||||
{{ $js := resources.Get "js/search.js" | resources.Fingerprint "md5" | resources.Minify }}
|
||||
{{if $.Site.Data.config.search.enableSemanticSearch}}
|
||||
{{ $js := resources.Get "js/semantic-search.js" | resources.ExecuteAsTemplate "js/semantic-search.js" . | resources.Fingerprint "md5" | resources.Minify }}
|
||||
<script defer type="module" src="{{ $js.Permalink }}"></script>
|
||||
{{else}}
|
||||
<script src="https://cdn.jsdelivr.net/npm/flexsearch@0.7.21/dist/flexsearch.bundle.js"
|
||||
integrity="sha256-i3A0NZGkhsKjVMzFxv3ksk0DZh3aXqu0l49Bbh0MdjE=" crossorigin="anonymous" defer></script>
|
||||
{{ $js := resources.Get "js/full-text-search.js" | resources.Fingerprint "md5" | resources.Minify }}
|
||||
<script defer src="{{ $js.Permalink }}"></script>
|
||||
{{end}}
|
||||
|
||||
|
||||
@ -3,9 +3,9 @@
|
||||
{{ $page := .Page }}
|
||||
|
||||
{{/* Escape slashes for Latex to fix line breaks */}}
|
||||
{{$latex := findRE "\\$\\$([^\\$]+)\\$\\$" $content}}
|
||||
{{$latex := findRE "(?:\\${2}([^\\$]+)\\${2})|(?:\\$([^\\$]*)\\$)" $content}}
|
||||
{{range $latex}}
|
||||
{{$fixed := replaceRE "\\\\(?: +|\\n)" "\\\\" .}}
|
||||
{{$fixed := replaceRE "\\\\(?: +|\\n)" "\\\\ " .}}
|
||||
{{$content = replace $content . $fixed}}
|
||||
{{end}}
|
||||
|
||||
@ -14,6 +14,7 @@
|
||||
{{$codefences := $raw | findRE "\\x60[^\\x60\\n]+\\x60"}}
|
||||
{{$codeblocks := $raw | findRE "\\x60{3}[^\\x60]+\\x60{3}"}}
|
||||
{{$code := union $codefences $codeblocks}}
|
||||
|
||||
{{range $wikilinks}}
|
||||
{{$cur := .}}
|
||||
{{$incode := false}}
|
||||
@ -22,37 +23,140 @@
|
||||
{{$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}}
|
||||
|
||||
<!-- remove link delimiters -->
|
||||
{{$inner := . | strings.TrimPrefix "!" | strings.TrimPrefix "[[" | strings.TrimSuffix "]]" }}
|
||||
<!-- split from alias -->
|
||||
{{$split := split $inner "|"}}
|
||||
<!-- separate link path -->
|
||||
{{$path := index $split 0}}
|
||||
|
||||
{{$reference := split $path "#"}}
|
||||
<!-- path with heading link removed -->
|
||||
{{$title := index $reference 0}}
|
||||
<!-- $display is hyperlink display text -->
|
||||
<!-- use alias, else title -->
|
||||
{{$display := default $title (index $split 1)}}
|
||||
<!-- remove subfolder from title -->
|
||||
{{$display := index (last 1 (split $display "/")) 0}}
|
||||
|
||||
<!-- attempt to get title -->
|
||||
{{$searchtitle := $title }}
|
||||
{{$curpage := $page.GetPage $searchtitle }}
|
||||
<!-- attempt to search md file instead -->
|
||||
{{ if (eq $curpage.String "nopPage") }}
|
||||
{{$searchtitle = (add $title ".md") }}
|
||||
{{$curpage = $page.GetPage $searchtitle }}
|
||||
{{ end }}
|
||||
<!-- attempt to reverse typographer behaviour -->
|
||||
{{ if (eq $curpage.String "nopPage") }}
|
||||
{{$searchtitle = (replace $searchtitle "&" "&") }}
|
||||
{{$searchtitle = (replace $searchtitle """ "\"") }}
|
||||
{{$searchtitle = (replace $searchtitle "”" "\"") }}
|
||||
{{$searchtitle = (replace $searchtitle "“" "\"") }}
|
||||
{{$searchtitle = (replace $searchtitle "’" "'") }}
|
||||
{{$searchtitle = (replace $searchtitle "‘" "'") }}
|
||||
{{$curpage = $page.GetPage $searchtitle }}
|
||||
{{ end }}
|
||||
{{$relpath := relURL $path}}
|
||||
|
||||
<!-- If path to Hugo page -->
|
||||
{{if not (eq $curpage.String "nopPage") }}
|
||||
{{$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}}
|
||||
{{$href := strings.TrimRight "/" $curpage.RelPermalink}}
|
||||
{{$link := printf "<a href=\"%s%s\" rel=\"noopener\" class=\"internal-link\" data-src=\"%s\">%s</a>" $href $block $href $display}}
|
||||
{{$content = replace $content . $link}}
|
||||
<!-- If path to existing file -->
|
||||
{{else if fileExists $relpath}}
|
||||
{{$splitpath := split $relpath "/"}}
|
||||
{{$dirname := first (sub (len $splitpath) 1) $splitpath | path.Join | urlize}}
|
||||
{{$basename := index (last 1 $splitpath) 0}}
|
||||
{{$href := printf "/%s/%s" $dirname $basename}}
|
||||
<!-- Embedded? -->
|
||||
{{if (hasPrefix . "!")}}
|
||||
{{ $embed_ext := lower (path.Ext $href) }}
|
||||
<!-- Image -->
|
||||
{{if in ".png .jpg .jpeg .gif .bmp .svg" $embed_ext }}
|
||||
{{$width := default "auto" (index $split 1) }}
|
||||
{{$link := printf "<img src=\"%s\" width=\"%s\" />" $href $width}}
|
||||
{{$content = replace $content . $link}}
|
||||
<!-- Video -->
|
||||
{{else if in ".mp4 .webm .ogv .mov .mkv" $embed_ext}}
|
||||
{{$link := printf "<video src=\"%s\" style=\"width: -webkit-fill-available;\" controls></video>" $href}}
|
||||
{{$content = replace $content . $link}}
|
||||
<!-- Audio -->
|
||||
{{else if in ".mp3 .webm .wav .m4a .ogg .3gp .flac" $embed_ext}}
|
||||
{{$link := printf "<audio src=\"%s\" controls></audio>" $href}}
|
||||
{{$content = replace $content . $link}}
|
||||
<!-- PDF -->
|
||||
{{else if in ".pdf" $embed_ext }}
|
||||
{{$src_link := printf "<a href=\"%s\" rel=\"noopener\" class=\"internal-link\">[source]</a>" $href}}
|
||||
{{$iframe_link := printf "<iframe src=\"%s\" style=\"height: -webkit-fill-available; width: -webkit-fill-available;\"></iframe>" $href}}
|
||||
{{$link := printf "%s<br>%s" $src_link $iframe_link}}
|
||||
{{$content = replace $content . $link}}
|
||||
<!-- other -->
|
||||
{{else}}
|
||||
{{$link := printf "<a href=\"%s\" rel=\"noopener\" class=\"internal-link\">%s</a>" $href $href}}
|
||||
{{$content = replace $content . $link}}
|
||||
{{end}}
|
||||
{{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}}
|
||||
{{$link := printf "<a href=\"%s\" rel=\"noopener\" class=\"internal-link\">%s</a>" $href $display}}
|
||||
{{$content = replace $content . $link}}
|
||||
{{end}}
|
||||
<!-- Broken path -->
|
||||
{{else}}
|
||||
{{$link := printf "<a class=\"internal-link broken\">%s</a>" $display}}
|
||||
{{$content = replace $content . $link}}
|
||||
{{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" }}
|
||||
{{ $content = $content | replaceRE `(?s)(<blockquote class="\S+-callout">.*?)<br>(.*?<\/blockquote)` `${1}</p><p>${2}` }}
|
||||
{{end}}
|
||||
|
||||
{{/* Make ==text== into <mark>text</mark> */}}
|
||||
{{$mark := findRE "==([^=\n]+)==" $content}}
|
||||
{{range $mark}}
|
||||
{{$fixed := printf "<mark>%s</mark>" (replace . "==" "")}}
|
||||
{{$content = replace $content . $fixed}}
|
||||
{{end}}
|
||||
|
||||
{{ $content | safeHTML }}
|
||||
|
||||
@ -1,7 +1,8 @@
|
||||
{{ if (and $.Site.Data.config.enableToc (ne .Params.enableToc false) (gt .WordCount 250)) }}
|
||||
{{ $hasHeaders := gt (len (findRE "<h\\d.*?>(.|\n)*?</h\\d>" .Content)) 0 }}
|
||||
{{ if (or (and (not $.Site.Data.config.enableToc) .Params.enableToc) (and $.Site.Data.config.enableToc (ne .Params.enableToc false) $hasHeaders)) }}
|
||||
<aside class="mainTOC">
|
||||
<details {{ if $.Site.Data.config.openToc }}open {{ end }}>
|
||||
<summary>Table of Contents</summary>
|
||||
<summary>{{ i18n "toc" }}</summary>
|
||||
{{ .TableOfContents }}
|
||||
</details>
|
||||
</aside>
|
||||
|
||||
BIN
screenshot.png
BIN
screenshot.png
Binary file not shown.
|
Before Width: | Height: | Size: 1.1 MiB After Width: | Height: | Size: 1012 KiB |
Loading…
Reference in New Issue
Block a user