diff --git a/.github/workflows/deploy.yaml b/.github/workflows/deploy.yaml
index 7e9d0070f..e34078398 100644
--- a/.github/workflows/deploy.yaml
+++ b/.github/workflows/deploy.yaml
@@ -10,9 +10,11 @@ jobs:
runs-on: ubuntu-18.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.12
+ uses: jackyzha0/hugo-obsidian@v2.18
with:
index: true
input: content
diff --git a/.gitignore b/.gitignore
index a7ccdb590..182026f9c 100644
--- a/.gitignore
+++ b/.gitignore
@@ -5,3 +5,4 @@ resources
content/.obsidian
assets/indices/linkIndex.json
assets/indices/contentIndex.json
+linkmap
diff --git a/.prettierrc b/.prettierrc
new file mode 100644
index 000000000..5788b66f1
--- /dev/null
+++ b/.prettierrc
@@ -0,0 +1,7 @@
+{
+ "printWidth": 100,
+ "quoteProps": "as-needed",
+ "trailingComma": "all",
+ "tabWidth": 2,
+ "semi": false
+}
diff --git a/Makefile b/Makefile
index 5b2906021..563632a0b 100644
--- a/Makefile
+++ b/Makefile
@@ -4,18 +4,20 @@ help: ## Show all Makefile targets
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'
update: ## Update Quartz to the latest version on Github
+ go install github.com/jackyzha0/hugo-obsidian@latest
@git remote show upstream || (echo "remote 'upstream' not present, setting 'upstream'" && git remote add upstream https://github.com/jackyzha0/quartz.git)
git fetch upstream
git log --oneline --decorate --graph ..upstream/hugo
git checkout -p upstream/hugo -- layouts .github Makefile assets/js assets/styles/base.scss assets/styles/darkmode.scss config.toml data
-update-force: ## Forcefully pull all changes and don't ask to patch
+update-force: ## Forcefully pull all changes and don't ask to patch
+ go install github.com/jackyzha0/hugo-obsidian@latest
@git remote show upstream || (echo "remote 'upstream' not present, setting 'upstream'" && git remote add upstream https://github.com/jackyzha0/quartz.git)
git fetch upstream
git checkout upstream/hugo -- layouts .github Makefile assets/js assets/styles/base.scss assets/styles/darkmode.scss config.toml data
serve: ## Serve Quartz locally
- $(GOPATH)/bin/hugo-obsidian -input=content -output=assets/indices -index -root=. && hugo server --enableGitInfo
+ $(GOPATH)/bin/hugo-obsidian -input=content -output=assets/indices -index -root=. && hugo server --enableGitInfo --minify
install: ## use v2.12 commit in hugo-obsidian repo
go install github.com/jackyzha0/hugo-obsidian@3ce308411ee36c94b33e082f984e1741c6354584
diff --git a/README.md b/README.md
index ea57a2d82..0f048c279 100644
--- a/README.md
+++ b/README.md
@@ -1,6 +1,6 @@
# Quartz
-Host your second brain and [digital garden](https://jzhao.xyz/posts/digital-gardening) for free. Quartz features
+Host your second brain and [digital garden](https://jzhao.xyz/posts/networked-thought) for free. Quartz features
1. Extremely fast full-text search by pressing `Ctrl` + `k`
2. Customizable and hackable design based on Hugo
@@ -8,6 +8,8 @@ Host your second brain and [digital garden](https://jzhao.xyz/posts/digital-gard
4. Built-in CJK + Latex Support
5. Support for both Markdown Links and Wikilinks
+Check out some of the [amazing gardens that community members](https://quartz.jzhao.xyz/notes/showcase/) have published with Quartz!
+
> “[One] who works with the door open gets all kinds of interruptions, but [they] also occasionally gets clues as to what the world is and what might be important.” — Richard Hamming
🔗 Get Started: https://quartz.jzhao.xyz/
diff --git a/assets/js/callouts.js b/assets/js/callouts.js
new file mode 100644
index 000000000..080bbb489
--- /dev/null
+++ b/assets/js/callouts.js
@@ -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");
+ }));
+}
diff --git a/assets/js/clipboard.js b/assets/js/clipboard.js
new file mode 100644
index 000000000..cd928c1a4
--- /dev/null
+++ b/assets/js/clipboard.js
@@ -0,0 +1,40 @@
+const svgCopy =
+ '';
+const svgCheck =
+ '';
+
+
+const addCopyButtons = () => {
+ let els = document.getElementsByClassName("highlight");
+ // for each highlight
+ for (let i = 0; i < els.length; i++) {
+ if (els[i].getElementsByClassName("clipboard-button").length) continue;
+
+ // find pre > code inside els[i]
+ let codeBlocks = els[i].getElementsByTagName("code");
+
+ // line numbers are inside first code block
+ let lastCodeBlock = codeBlocks[codeBlocks.length - 1];
+ const button = document.createElement("button");
+ button.className = "clipboard-button";
+ button.type = "button";
+ button.innerHTML = svgCopy;
+ // remove every second newline from lastCodeBlock.innerText
+ button.addEventListener("click", () => {
+ navigator.clipboard.writeText(lastCodeBlock.innerText.replace(/\n\n/g, "\n")).then(
+ () => {
+ button.blur();
+ button.innerHTML = svgCheck;
+ setTimeout(() => {
+ button.innerHTML = svgCopy
+ button.style.borderColor = ""
+ }, 2000);
+ },
+ (error) => (button.innerHTML = "Error")
+ );
+ });
+ // find chroma inside els[i]
+ let chroma = els[i].getElementsByClassName("chroma")[0];
+ els[i].insertBefore(button, chroma);
+ }
+}
diff --git a/assets/js/code-title.js b/assets/js/code-title.js
new file mode 100644
index 000000000..698edc9b6
--- /dev/null
+++ b/assets/js/code-title.js
@@ -0,0 +1,13 @@
+
+function addTitleToCodeBlocks() {
+ var els = document.getElementsByClassName("highlight");
+ for (var i = 0; i < els.length; i++) {
+ if (els[i].title.length) {
+ let div = document.createElement("div");
+ if (els[i].getElementsByClassName("code-title").length) continue;
+ div.textContent=els[i].title;
+ div.classList.add("code-title")
+ els[i].insertBefore(div, els[i].firstChild);
+ }
+ }
+};
diff --git a/assets/js/darkmode.js b/assets/js/darkmode.js
index f69a3a738..0b4bd5f4f 100644
--- a/assets/js/darkmode.js
+++ b/assets/js/darkmode.js
@@ -1,21 +1,26 @@
const userPref = window.matchMedia('(prefers-color-scheme: light)').matches ? 'light' : 'dark'
-// const currentTheme = localStorage.getItem('theme') ?? userPref
-const currentTheme = userPref;
+const currentTheme = localStorage.getItem('theme') ?? userPref
+const syntaxTheme = document.querySelector("#theme-link");
+
+
+{{ $darkSyntax := resources.Get "styles/_dark_syntax.scss" | resources.ToCSS (dict "outputStyle" "compressed") | resources.Fingerprint "md5" | resources.Minify }}
+{{ $lightSyntax := resources.Get "styles/_light_syntax.scss" | resources.ToCSS (dict "outputStyle" "compressed") | resources.Fingerprint "md5" | resources.Minify }}
if (currentTheme) {
document.documentElement.setAttribute('saved-theme', currentTheme);
+ syntaxTheme.href = currentTheme === 'dark' ? '{{ $darkSyntax.Permalink }}' : '{{ $lightSyntax.Permalink }}';
}
const switchTheme = (e) => {
- if (e.checked) {
- document.documentElement.setAttribute('saved-theme', 'dark')
- localStorage.setItem('theme', 'dark')
- document.querySelector('#darkmode-icon').setAttribute('class', 'fa fa-moon-o')
+ if (e.target.checked) {
+ document.documentElement.setAttribute('saved-theme', 'dark');
+ localStorage.setItem('theme', 'dark');
+ syntaxTheme.href = '{{ $darkSyntax.Permalink }}';
}
else {
document.documentElement.setAttribute('saved-theme', 'light')
localStorage.setItem('theme', 'light')
- document.querySelector('#darkmode-icon').setAttribute('class', 'fa fa-sun-o')
+ syntaxTheme.href = '{{ $lightSyntax.Permalink }}';
}
}
diff --git a/assets/js/full-text-search.js b/assets/js/full-text-search.js
new file mode 100644
index 000000000..a8f7f23c6
--- /dev/null
+++ b/assets/js/full-text-search.js
@@ -0,0 +1,61 @@
+; (async function() {
+ const encoder = (str) => str.toLowerCase().split(/([^a-z]|[^\x00-\x7F])/)
+ const contentIndex = new FlexSearch.Document({
+ cache: true,
+ charset: "latin:extra",
+ optimize: true,
+ index: [
+ {
+ field: "content",
+ tokenize: "reverse",
+ encode: encoder,
+ },
+ {
+ field: "title",
+ tokenize: "forward",
+ encode: encoder,
+ },
+ ],
+ })
+
+ const { content } = await fetchData
+ for (const [key, value] of Object.entries(content)) {
+ contentIndex.add({
+ id: key,
+ title: value.title,
+ content: removeMarkdown(value.content),
+ })
+ }
+
+ const formatForDisplay = (id) => ({
+ id,
+ url: id,
+ title: content[id].title,
+ content: content[id].content,
+ })
+
+ registerHandlers((e) => {
+ term = e.target.value
+ const searchResults = contentIndex.search(term, [
+ {
+ field: "content",
+ limit: 10,
+ },
+ {
+ field: "title",
+ limit: 5,
+ },
+ ])
+ const getByField = (field) => {
+ const results = searchResults.filter((x) => x.field === field)
+ if (results.length === 0) {
+ return []
+ } else {
+ return [...results[0].result]
+ }
+ }
+ const allIds = new Set([...getByField("title"), ...getByField("content")])
+ const finalResults = [...allIds].map(formatForDisplay)
+ displayResults(finalResults, true)
+ })
+})()
diff --git a/assets/js/graph.js b/assets/js/graph.js
index f0b1f7f6f..c89877b9a 100644
--- a/assets/js/graph.js
+++ b/assets/js/graph.js
@@ -1,8 +1,30 @@
-async function drawGraph(url, baseUrl, pathColors, depth, enableDrag, enableLegend, enableZoom) {
- const { index, links, content } = await fetchData
- const curPage = url.replace(baseUrl, "")
+async function drawGraph(baseUrl, isHome, pathColors, graphConfig) {
- const parseIdsFromLinks = (links) => [...(new Set(links.flatMap(link => ([link.source, link.target]))))]
+ let {
+ depth,
+ enableDrag,
+ enableLegend,
+ enableZoom,
+ opacityScale,
+ scale,
+ repelForce,
+ fontSize} = graphConfig;
+
+ const container = document.getElementById("graph-container")
+ const { index, links, content } = await fetchData
+
+ // Use .pathname to remove hashes / searchParams / text fragments
+ const cleanUrl = window.location.origin + window.location.pathname
+
+ const curPage = cleanUrl.replace(/\/$/g, "").replace(baseUrl, "")
+
+ const parseIdsFromLinks = (links) => [
+ ...new Set(links.flatMap((link) => [link.source, link.target])),
+ ]
+
+ // Links is mutated by d3. We want to use links later on, so we make a copy and pass that one to d3
+ // Note: shallow cloning does not work because it copies over references from the original array
+ const copyLinks = JSON.parse(JSON.stringify(links))
const neighbours = new Set()
const wl = [curPage || "/", "__SENTINEL"]
@@ -17,16 +39,16 @@ async function drawGraph(url, baseUrl, pathColors, depth, enableDrag, enableLege
neighbours.add(cur)
const outgoing = index.links[cur] || []
const incoming = index.backlinks[cur] || []
- wl.push(...outgoing.map(l => l.target), ...incoming.map(l => l.source))
+ wl.push(...outgoing.map((l) => l.target), ...incoming.map((l) => l.source))
}
}
} else {
- parseIdsFromLinks(links).forEach(id => neighbours.add(id))
+ parseIdsFromLinks(copyLinks).forEach((id) => neighbours.add(id))
}
const data = {
- nodes: [...neighbours].map(id => ({ id })),
- links: links.filter(l => neighbours.has(l.source) && neighbours.has(l.target)),
+ nodes: [...neighbours].map((id) => ({ id })),
+ links: copyLinks.filter((l) => neighbours.has(l.source) && neighbours.has(l.target)),
}
const color = (d) => {
@@ -45,176 +67,204 @@ async function drawGraph(url, baseUrl, pathColors, depth, enableDrag, enableLege
return "var(--g-node)"
}
- const drag = simulation => {
+ const drag = (simulation) => {
function dragstarted(event, d) {
- if (!event.active) simulation.alphaTarget(1).restart();
- d.fx = d.x;
- d.fy = d.y;
+ if (!event.active) simulation.alphaTarget(1).restart()
+ d.fx = d.x
+ d.fy = d.y
}
function dragged(event, d) {
- d.fx = event.x;
- d.fy = event.y;
+ d.fx = event.x
+ d.fy = event.y
}
function dragended(event, d) {
- if (!event.active) simulation.alphaTarget(0);
- d.fx = null;
- d.fy = null;
+ if (!event.active) simulation.alphaTarget(0)
+ d.fx = null
+ d.fy = null
}
- const noop = () => { }
- return d3.drag()
+ const noop = () => {}
+ return d3
+ .drag()
.on("start", enableDrag ? dragstarted : noop)
.on("drag", enableDrag ? dragged : noop)
- .on("end", enableDrag ? dragended : noop);
+ .on("end", enableDrag ? dragended : noop)
}
- const height = 250
- const width = document.getElementById("graph-container").offsetWidth
+ const height = Math.max(container.offsetHeight, isHome ? 500 : 250)
+ const width = container.offsetWidth
- const simulation = d3.forceSimulation(data.nodes)
- .force("charge", d3.forceManyBody().strength(-30))
- .force("link", d3.forceLink(data.links).id(d => d.id))
- .force("center", d3.forceCenter());
+ const simulation = d3
+ .forceSimulation(data.nodes)
+ .force("charge", d3.forceManyBody().strength(-100 * repelForce))
+ .force(
+ "link",
+ d3
+ .forceLink(data.links)
+ .id((d) => d.id)
+ .distance(40),
+ )
+ .force("center", d3.forceCenter())
- const svg = d3.select('#graph-container')
- .append('svg')
- .attr('width', width)
- .attr('height', height)
- .attr("viewBox", [-width / 2, -height / 2, width, height]);
+ const svg = d3
+ .select("#graph-container")
+ .append("svg")
+ .attr("width", width)
+ .attr("height", height)
+ .attr('viewBox', [-width / 2 * 1 / scale, -height / 2 * 1 / scale, width * 1 / scale, height * 1 / scale])
if (enableLegend) {
- const legend = [
- { "Current": "var(--g-node-active)" },
- { "Note": "var(--g-node)" },
- ...pathColors
- ]
+ const legend = [{ Current: "var(--g-node-active)" }, { Note: "var(--g-node)" }, ...pathColors]
legend.forEach((legendEntry, i) => {
const key = Object.keys(legendEntry)[0]
const colour = legendEntry[key]
- svg.append("circle").attr("cx", -width / 2 + 20).attr("cy", height / 2 - 30 * (i + 1)).attr("r", 6).style("fill", colour)
- svg.append("text").attr("x", -width / 2 + 40).attr("y", height / 2 - 30 * (i + 1)).text(key).style("font-size", "15px").attr("alignment-baseline", "middle")
+ svg
+ .append("circle")
+ .attr("cx", -width / 2 + 20)
+ .attr("cy", height / 2 - 30 * (i + 1))
+ .attr("r", 6)
+ .style("fill", colour)
+ svg
+ .append("text")
+ .attr("x", -width / 2 + 40)
+ .attr("y", height / 2 - 30 * (i + 1))
+ .text(key)
+ .style("font-size", "15px")
+ .attr("alignment-baseline", "middle")
})
}
// draw links between nodes
- const link = svg.append("g")
+ const link = svg
+ .append("g")
.selectAll("line")
.data(data.links)
.join("line")
.attr("class", "link")
.attr("stroke", "var(--g-link)")
.attr("stroke-width", 2)
- .attr("data-source", d => d.source.id)
- .attr("data-target", d => d.target.id)
+ .attr("data-source", (d) => d.source.id)
+ .attr("data-target", (d) => d.target.id)
// svg groups
- const graphNode = svg.append("g")
- .selectAll("g")
- .data(data.nodes)
- .enter().append("g")
+ const graphNode = svg.append("g").selectAll("g").data(data.nodes).enter().append("g")
+
+ // calculate radius
+ const nodeRadius = (d) => {
+ const numOut = index.links[d.id]?.length || 0
+ const numIn = index.backlinks[d.id]?.length || 0
+ return 2 + Math.sqrt(numOut + numIn)
+ }
// draw individual nodes
- const node = graphNode.append("circle")
+ const node = graphNode
+ .append("circle")
.attr("class", "node")
.attr("id", (d) => d.id)
- .attr("r", (d) => {
- const numOut = index.links[d.id]?.length || 0
- const numIn = index.backlinks[d.id]?.length || 0
- return 3 + (numOut + numIn) / 4
- })
+ .attr("r", nodeRadius)
.attr("fill", color)
.style("cursor", "pointer")
.on("click", (_, d) => {
- window.location.href = baseUrl + '/' + decodeURI(d.id).replace(/\s+/g, '-')
+ // SPA navigation
+ window.Million.navigate(new URL(`${baseUrl}${decodeURI(d.id).replace(/\s+/g, "-")}/`), ".singlePage")
})
- .on("mouseover", function(_, d) {
- d3.selectAll(".node")
- .transition()
- .duration(100)
- .attr("fill", "var(--g-node-inactive)")
+ .on("mouseover", function (_, d) {
+ d3.selectAll(".node").transition().duration(100).attr("fill", "var(--g-node-inactive)")
- const neighbours = parseIdsFromLinks([...(index.links[d.id] || []), ...(index.backlinks[d.id] || [])])
- const neighbourNodes = d3.selectAll(".node").filter(d => neighbours.includes(d.id))
+ const neighbours = parseIdsFromLinks([
+ ...(index.links[d.id] || []),
+ ...(index.backlinks[d.id] || []),
+ ])
+ const neighbourNodes = d3.selectAll(".node").filter((d) => neighbours.includes(d.id))
const currentId = d.id
- const linkNodes = d3.selectAll(".link").filter(d => d.source.id === currentId || d.target.id === currentId)
+ window.Million.prefetch(new URL(`${baseUrl}${decodeURI(d.id).replace(/\s+/g, "-")}/`))
+ const linkNodes = d3
+ .selectAll(".link")
+ .filter((d) => d.source.id === currentId || d.target.id === currentId)
// highlight neighbour nodes
- neighbourNodes
- .transition()
- .duration(200)
- .attr("fill", color)
+ neighbourNodes.transition().duration(200).attr("fill", color)
// highlight links
- linkNodes
- .transition()
- .duration(200)
- .attr("stroke", "var(--g-link-active)")
+ linkNodes.transition().duration(200).attr("stroke", "var(--g-link-active)")
+
+ const bigFont = fontSize*1.5
// show text for self
d3.select(this.parentNode)
- .select("text")
.raise()
+ .select("text")
.transition()
.duration(200)
- .style("opacity", 1)
- }).on("mouseleave", function(_, d) {
- d3.selectAll(".node")
- .transition()
- .duration(200)
- .attr("fill", color)
+ .attr('opacityOld', d3.select(this.parentNode).select('text').style("opacity"))
+ .style('opacity', 1)
+ .style('font-size', bigFont+'em')
+ .attr('dy', d => nodeRadius(d) + 20 + 'px') // radius is in px
+ })
+ .on("mouseleave", function (_, d) {
+ d3.selectAll(".node").transition().duration(200).attr("fill", color)
const currentId = d.id
- const linkNodes = d3.selectAll(".link").filter(d => d.source.id === currentId || d.target.id === currentId)
+ const linkNodes = d3
+ .selectAll(".link")
+ .filter((d) => d.source.id === currentId || d.target.id === currentId)
- linkNodes
- .transition()
- .duration(200)
- .attr("stroke", "var(--g-link)")
+ linkNodes.transition().duration(200).attr("stroke", "var(--g-link)")
d3.select(this.parentNode)
- .select("text")
- .transition()
- .duration(200)
- .style("opacity", 0)
+ .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));
+ .call(drag(simulation))
// draw labels
- const labels = graphNode.append("text")
- .attr("dx", 12)
- .attr("dy", ".35em")
+ const labels = graphNode
+ .append("text")
+ .attr("dx", 0)
+ .attr("dy", (d) => nodeRadius(d) + 8 + "px")
+ .attr("text-anchor", "middle")
.text((d) => content[d.id]?.title || d.id.replace("-", " "))
- .style("opacity", 0)
+ .style('opacity', (opacityScale - 1) / 3.75)
.style("pointer-events", "none")
- .call(drag(simulation));
+ .style('font-size', fontSize+'em')
+ .raise()
+ .call(drag(simulation))
// set panning
if (enableZoom) {
- svg.call(d3.zoom()
- .extent([[0, 0], [width, height]])
- .scaleExtent([0.25, 4])
- .on("zoom", ({ transform }) => {
- link.attr("transform", transform);
- node.attr("transform", transform);
- labels.attr("transform", transform);
- }));
+ svg.call(
+ d3
+ .zoom()
+ .extent([
+ [0, 0],
+ [width, height],
+ ])
+ .scaleExtent([0.25, 4])
+ .on("zoom", ({ transform }) => {
+ link.attr("transform", transform)
+ node.attr("transform", transform)
+ const scale = transform.k * opacityScale;
+ const scaledOpacity = Math.max((scale - 1) / 3.75, 0)
+ labels.attr("transform", transform).style("opacity", scaledOpacity)
+ }),
+ )
}
// progress the simulation
simulation.on("tick", () => {
link
- .attr("x1", d => d.source.x)
- .attr("y1", d => d.source.y)
- .attr("x2", d => d.target.x)
- .attr("y2", d => d.target.y)
- node
- .attr("cx", d => d.x)
- .attr("cy", d => d.y)
- labels
- .attr("x", d => d.x)
- .attr("y", d => d.y)
- });
+ .attr("x1", (d) => d.source.x)
+ .attr("y1", (d) => d.source.y)
+ .attr("x2", (d) => d.target.x)
+ .attr("y2", (d) => d.target.y)
+ node.attr("cx", (d) => d.x).attr("cy", (d) => d.y)
+ labels.attr("x", (d) => d.x).attr("y", (d) => d.y)
+ })
}
diff --git a/assets/js/popover.js b/assets/js/popover.js
index 4fd546b16..c7b116500 100644
--- a/assets/js/popover.js
+++ b/assets/js/popover.js
@@ -1,35 +1,76 @@
function htmlToElement(html) {
- const template = document.createElement('template')
+ const template = document.createElement("template")
html = html.trim()
template.innerHTML = html
return template.content.firstChild
}
-function initPopover(baseURL) {
+function initPopover(baseURL, useContextualBacklinks, renderLatex) {
const basePath = baseURL.replace(window.location.origin, "")
- document.addEventListener("DOMContentLoaded", () => {
- fetchData.then(({ content }) => {
- const links = [...document.getElementsByClassName("internal-link")]
- links
- .filter(li => li.dataset.src)
- .forEach(li => {
- const linkDest = content[li.dataset.src.replace(basePath, "")]
- if (linkDest) {
- const popoverElement = `
+ fetchData.then(({ content }) => {
+ const links = [...document.getElementsByClassName("internal-link")]
+ links
+ .filter(li => li.dataset.src || (li.dataset.idx && useContextualBacklinks))
+ .forEach(li => {
+ var el
+ if (li.dataset.ctx) {
+ const linkDest = content[li.dataset.src]
+ const popoverElement = `
${linkDest.title}
-
${removeMarkdown(linkDest.content).split(" ", 20).join(" ")}...
+
${highlight(removeMarkdown(linkDest.content), li.dataset.ctx)}...
${new Date(linkDest.lastmodified).toLocaleDateString()}
`
- const el = htmlToElement(popoverElement)
- li.appendChild(el)
- li.addEventListener("mouseover", () => {
- el.classList.add("visible")
- })
- li.addEventListener("mouseout", () => {
- el.classList.remove("visible")
+ el = htmlToElement(popoverElement)
+ } else {
+ const linkDest = content[li.dataset.src.replace(/\/$/g, "").replace(basePath, "")]
+ if (linkDest) {
+ let splitLink = li.href.split("#")
+ let cleanedContent = removeMarkdown(linkDest.content)
+ if (splitLink.length > 1) {
+ let headingName = splitLink[1].replace(/\-/g, " ")
+ let headingIndex = cleanedContent.toLowerCase().indexOf("
" + headingName + "")
+ cleanedContent = cleanedContent.substring(headingIndex, cleanedContent.length)
+ }
+ const popoverElement = `
+
${linkDest.title}
+
${cleanedContent.split(" ", 20).join(" ")}...
+
${new Date(linkDest.lastmodified).toLocaleDateString()}
+
`
+ el = htmlToElement(popoverElement)
+ }
+ }
+
+ if (el) {
+ li.appendChild(el)
+ if (renderLatex) {
+ renderMathInElement(el, {
+ delimiters: [
+ { left: '$$', right: '$$', display: false },
+ { left: '$', right: '$', display: false },
+ { left: '\\(', right: '\\)', display: false },
+ { left: '\\[', right: '\\]', display: false }
+ ],
+ throwOnError: false
})
}
- })
- })
+
+ li.addEventListener("mouseover", () => {
+ // fix tooltip positioning
+ window.FloatingUIDOM.computePosition(li, el, {
+ middleware: [window.FloatingUIDOM.offset(10), window.FloatingUIDOM.inline(), window.FloatingUIDOM.shift()],
+ }).then(({ x, y }) => {
+ Object.assign(el.style, {
+ left: `${x}px`,
+ top: `${y}px`,
+ })
+ })
+
+ el.classList.add("visible")
+ })
+ li.addEventListener("mouseout", () => {
+ el.classList.remove("visible")
+ })
+ }
+ })
})
}
diff --git a/assets/js/router.js b/assets/js/router.js
new file mode 100644
index 000000000..efaa10e8a
--- /dev/null
+++ b/assets/js/router.js
@@ -0,0 +1,26 @@
+import {
+ apply,
+ navigate,
+ prefetch,
+ router,
+} from "https://unpkg.com/million@1.11.5/dist/router.mjs"
+
+export const attachSPARouting = (init, rerender) => {
+ // Attach SPA functions to the global Million namespace
+ window.Million = {
+ apply,
+ navigate,
+ prefetch,
+ router,
+ }
+
+ const render = () => requestAnimationFrame(rerender)
+
+ window.addEventListener("DOMContentLoaded", () => {
+ apply((doc) => init(doc))
+ init()
+ router(".singlePage")
+ render()
+ })
+ window.addEventListener("million:navigate", render)
+}
diff --git a/assets/js/search.js b/assets/js/search.js
deleted file mode 100644
index b6e0d1769..000000000
--- a/assets/js/search.js
+++ /dev/null
@@ -1,242 +0,0 @@
-// code from https://github.com/danestves/markdown-to-text
-const removeMarkdown = (
- markdown,
- options = {
- listUnicodeChar: false,
- stripListLeaders: true,
- gfm: true,
- useImgAltText: false,
- preserveLinks: false,
- }
-) => {
- let output = markdown || "";
- output = output.replace(/^(-\s*?|\*\s*?|_\s*?){3,}\s*$/gm, "");
-
- try {
- if (options.stripListLeaders) {
- if (options.listUnicodeChar)
- output = output.replace(
- /^([\s\t]*)([\*\-\+]|\d+\.)\s+/gm,
- options.listUnicodeChar + " $1"
- );
- else output = output.replace(/^([\s\t]*)([\*\-\+]|\d+\.)\s+/gm, "$1");
- }
- if (options.gfm) {
- output = output
- .replace(/\n={2,}/g, "\n")
- .replace(/~{3}.*\n/g, "")
- .replace(/~~/g, "")
- .replace(/`{3}.*\n/g, "");
- }
- if (options.preserveLinks) {
- output = output.replace(/\[(.*?)\][\[\(](.*?)[\]\)]/g, "$1 ($2)")
- }
- output = output
- .replace(/<[^>]*>/g, "")
- .replace(/^[=\-]{2,}\s*$/g, "")
- .replace(/\[\^.+?\](\: .*?$)?/g, "")
- .replace(/\s{0,2}\[.*?\]: .*?$/g, "")
- .replace(/\!\[(.*?)\][\[\(].*?[\]\)]/g, options.useImgAltText ? "$1" : "")
- .replace(/\[(.*?)\][\[\(].*?[\]\)]/g, "$1")
- .replace(/^\s{0,3}>\s?/g, "")
- .replace(/(^|\n)\s{0,3}>\s?/g, "\n\n")
- .replace(/^\s{1,2}\[(.*?)\]: (\S+)( ".*?")?\s*$/g, "")
- .replace(
- /^(\n)?\s{0,}#{1,6}\s+| {0,}(\n)?\s{0,}#{0,} {0,}(\n)?\s{0,}$/gm,
- "$1$2$3"
- )
- .replace(/([\*_]{1,3})(\S.*?\S{0,1})\1/g, "$2")
- .replace(/([\*_]{1,3})(\S.*?\S{0,1})\1/g, "$2")
- .replace(/(`{3,})(.*?)\1/gm, "$2")
- .replace(/`(.+?)`/g, "$1")
- .replace(/\n{2,}/g, "\n\n")
- // replace alias in links
- .replace(/\[\[[^\[\]\#\*]+\|([^\[\]]+)\]\]/g, '$1')
- .replace(/\[([^\[\]]+)\]\([^\(\)]+\)/g, '$1');
- } catch (e) {
- console.error(e);
- return markdown;
- }
- return output;
-};
-// -----
-
-(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 highlight = (content, term) => {
- const highlightWindow = 20
- const tokenizedTerm = term.split(/\s+/).filter(t => t !== "")
- const splitText = content.split(/\s+/).filter(t => t !== "")
- const includesCheck = (token) => tokenizedTerm.some(term => token.toLowerCase().startsWith(term.toLowerCase()))
-
- const occurrencesIndices = splitText
- .map(includesCheck)
-
- // calculate best index
- let bestSum = 0
- let bestIndex = 0
- for (let i = 0; i < Math.max(occurrencesIndices.length - highlightWindow, 0); i++) {
- const window = occurrencesIndices.slice(i, i + highlightWindow)
- const windowSum = window.reduce((total, cur) => total + cur, 0)
- if (windowSum >= bestSum) {
- bestSum = windowSum
- bestIndex = i
- }
- }
-
- const startIndex = Math.max(bestIndex - highlightWindow, 0)
- const endIndex = Math.min(startIndex + 2 * highlightWindow, splitText.length)
- const mappedText = splitText
- .slice(startIndex, endIndex)
- .map(token => {
- if (includesCheck(token)) {
- return `
${token}`
- }
- return token
- })
- .join(" ")
- .replaceAll('
', " ")
- return `${startIndex === 0 ? "" : "..."}${mappedText}${endIndex === splitText.length ? "" : "..."}`
- }
-
- const resultToHTML = ({ url, title, content, term }) => {
- const text = removeMarkdown(content)
- const resultTitle = highlight(title, term)
- const resultText = highlight(text, term)
- return ``
- }
-
- const redir = (id, term) => {
- window.location.href = BASE_URL + `${id}#:~:text=${encodeURIComponent(term)}`
- }
-
- const formatForDisplay = id => ({
- id,
- url: id,
- title: content[id].title,
- content: content[id].content
- })
-
- const source = document.getElementById('search-bar')
- const results = document.getElementById("results-container")
- let term
- source.addEventListener("keyup", (e) => {
- if (e.key === "Enter") {
- const anchor = document.getElementsByClassName("result-card")[0]
- redir(anchor.id, term)
- }
- })
- source.addEventListener('input', (e) => {
- term = e.target.value
- 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 = ``
- } else {
- results.innerHTML = finalResults
- .map(result => resultToHTML({
- ...result,
- term,
- }))
- .join("\n")
- const anchors = document.getElementsByClassName("result-card");
- [...anchors].forEach(anchor => {
- anchor.onclick = () => redir(anchor.id, term)
- })
- }
- })
-
-
- const searchContainer = document.getElementById("search-container")
-
- function openSearch() {
- if (searchContainer.style.display === "none" || searchContainer.style.display === "") {
- source.value = ""
- results.innerHTML = ""
- searchContainer.style.display = "block"
- source.focus()
- } else {
- searchContainer.style.display = "none"
- }
- }
-
- function closeSearch() {
- searchContainer.style.display = "none"
- }
-
- document.addEventListener('keydown', (event) => {
- if (event.key === "k" && (event.ctrlKey || event.metaKey)) {
- event.preventDefault()
- openSearch()
- }
- if (event.key === "Escape") {
- event.preventDefault()
- closeSearch()
- }
- })
-
- const searchButton = document.getElementById("search-icon")
- searchButton.addEventListener('click', (evt) => {
- openSearch()
- })
- searchButton.addEventListener('keydown', (evt) => {
- openSearch()
- })
- searchContainer.addEventListener('click', (evt) => {
- closeSearch()
- })
- document.getElementById("search-space").addEventListener('click', (evt) => {
- evt.stopPropagation()
- })
-})()
-
diff --git a/assets/js/semantic-search.js b/assets/js/semantic-search.js
new file mode 100644
index 000000000..4382817ce
--- /dev/null
+++ b/assets/js/semantic-search.js
@@ -0,0 +1,38 @@
+const apiKey = "{{$.Site.Data.config.operandApiKey}}"
+
+async function searchContents(query) {
+ const response = await fetch('https://prod.operand.ai/v3/search/objects', {
+ method: 'POST',
+ headers: {
+ 'Content-Type': 'application/json',
+ Authorization: apiKey,
+ },
+ body: JSON.stringify({
+ query,
+ max: 10
+ }),
+ });
+ return (await response.json());
+}
+
+function debounce(func, timeout = 200) {
+ let timer;
+ return (...args) => {
+ clearTimeout(timer)
+ timer = setTimeout(() => { func.apply(this, args); }, timeout)
+ };
+}
+
+registerHandlers(debounce((e) => {
+ term = e.target.value
+ if (term !== "") {
+ searchContents(term)
+ .then((res) => res.results.map(entry => ({
+ url: entry.object.properties.url,
+ content: entry.snippet,
+ title: entry.object.metadata.title
+ })
+ ))
+ .then(results => displayResults(results))
+ }
+}))
diff --git a/assets/js/util.js b/assets/js/util.js
new file mode 100644
index 000000000..06db3c1b7
--- /dev/null
+++ b/assets/js/util.js
@@ -0,0 +1,209 @@
+// code from https://github.com/danestves/markdown-to-text
+const removeMarkdown = (
+ markdown,
+ options = {
+ listUnicodeChar: false,
+ stripListLeaders: true,
+ gfm: true,
+ useImgAltText: false,
+ preserveLinks: false,
+ },
+) => {
+ let output = markdown || ""
+ output = output.replace(/^(-\s*?|\*\s*?|_\s*?){3,}\s*$/gm, "")
+
+ try {
+ if (options.stripListLeaders) {
+ if (options.listUnicodeChar)
+ output = output.replace(/^([\s\t]*)([\*\-\+]|\d+\.)\s+/gm, options.listUnicodeChar + " $1")
+ else output = output.replace(/^([\s\t]*)([\*\-\+]|\d+\.)\s+/gm, "$1")
+ }
+ if (options.gfm) {
+ output = output
+ .replace(/\n={2,}/g, "\n")
+ .replace(/~{3}.*\n/g, "")
+ .replace(/~~/g, "")
+ .replace(/`{3}.*\n/g, "")
+ }
+ if (options.preserveLinks) {
+ output = output.replace(/\[(.*?)\][\[\(](.*?)[\]\)]/g, "$1 ($2)")
+ }
+ output = output
+ .replace(/<[^>]*>/g, "")
+ .replace(/^[=\-]{2,}\s*$/g, "")
+ .replace(/\[\^.+?\](\: .*?$)?/g, "")
+ .replace(/(#{1,6})\s+(.+)\1?/g, "$2")
+ .replace(/\s{0,2}\[.*?\]: .*?$/g, "")
+ .replace(/\!\[(.*?)\][\[\(].*?[\]\)]/g, options.useImgAltText ? "$1" : "")
+ .replace(/\[(.*?)\][\[\(].*?[\]\)]/g, "$1")
+ .replace(/!?\[\[\S[^\[\]\|]*(?:\|([^\[\]]*))?\S\]\]/g, "$1")
+ .replace(/^\s{0,3}>\s?/g, "")
+ .replace(/(^|\n)\s{0,3}>\s?/g, "\n\n")
+ .replace(/^\s{1,2}\[(.*?)\]: (\S+)( ".*?")?\s*$/g, "")
+ .replace(/([\*_]{1,3})(\S.*?\S{0,1})\1/g, "$2")
+ .replace(/([\*_]{1,3})(\S.*?\S{0,1})\1/g, "$2")
+ .replace(/(`{3,})(.*?)\1/gm, "$2")
+ .replace(/`(.+?)`/g, "$1")
+ .replace(/\n{2,}/g, "\n\n")
+ .replace(/\[![a-zA-Z]+\][-\+]? /g, "")
+ } catch (e) {
+ console.error(e)
+ return markdown
+ }
+ return output
+}
+
+const highlight = (content, term) => {
+ const highlightWindow = 20
+ // try to find direct match first
+ const directMatchIdx = content.indexOf(term)
+ if (directMatchIdx !== -1) {
+ const h = highlightWindow
+ const before = content.substring(0, directMatchIdx).split(" ").slice(-h)
+ const after = content
+ .substring(directMatchIdx + term.length, content.length - 2)
+ .split(" ")
+ .slice(0, h)
+ return (
+ (before.length == h ? `...${before.join(" ")}` : before.join(" ")) +
+ `${term}` +
+ after.join(" ")
+ )
+ }
+
+ const tokenizedTerm = term.split(/\s+/).filter((t) => t !== "")
+ const splitText = content.split(/\s+/).filter((t) => t !== "")
+ const includesCheck = (token) =>
+ tokenizedTerm.some((term) => token.toLowerCase().startsWith(term.toLowerCase()))
+
+ const occurrencesIndices = splitText.map(includesCheck)
+
+ // calculate best index
+ let bestSum = 0
+ let bestIndex = 0
+ for (let i = 0; i < Math.max(occurrencesIndices.length - highlightWindow, 0); i++) {
+ const window = occurrencesIndices.slice(i, i + highlightWindow)
+ const windowSum = window.reduce((total, cur) => total + cur, 0)
+ if (windowSum >= bestSum) {
+ bestSum = windowSum
+ bestIndex = i
+ }
+ }
+
+ const startIndex = Math.max(bestIndex - highlightWindow, 0)
+ const endIndex = Math.min(startIndex + 2 * highlightWindow, splitText.length)
+ const mappedText = splitText
+ .slice(startIndex, endIndex)
+ .map((token) => {
+ if (includesCheck(token)) {
+ return `${token}`
+ }
+ return token
+ })
+ .join(" ")
+ .replaceAll(' ', " ")
+ return `${startIndex === 0 ? "" : "..."}${mappedText}${endIndex === splitText.length ? "" : "..."
+ }`
+}
+
+// Common utilities for search
+const resultToHTML = ({ url, title, content }) => {
+ return ``
+}
+
+const redir = (id, term) => {
+ // SPA navigation
+ window.Million.navigate(
+ new URL(`${BASE_URL.replace(/\/$/g, "")}${id}#:~:text=${encodeURIComponent(term)}/`),
+ ".singlePage",
+ )
+ closeSearch()
+}
+
+function openSearch() {
+ const source = document.getElementById("search-bar")
+ const results = document.getElementById("results-container")
+ const searchContainer = document.getElementById("search-container")
+ if (searchContainer.style.display === "none" || searchContainer.style.display === "") {
+ source.value = ""
+ results.innerHTML = ""
+ searchContainer.style.display = "block"
+ source.focus()
+ } else {
+ searchContainer.style.display = "none"
+ }
+}
+
+function closeSearch() {
+ const searchContainer = document.getElementById("search-container")
+ searchContainer.style.display = "none"
+}
+
+const registerHandlers = (onInputFn) => {
+ const source = document.getElementById("search-bar")
+ const searchContainer = document.getElementById("search-container")
+ let term
+ source.addEventListener("keyup", (e) => {
+ if (e.key === "Enter") {
+ const anchor = document.getElementsByClassName("result-card")[0]
+ redir(anchor.id, term)
+ }
+ })
+ source.addEventListener("input", onInputFn)
+ document.addEventListener("keydown", (event) => {
+ if (event.key === "k" && (event.ctrlKey || event.metaKey)) {
+ event.preventDefault()
+ openSearch()
+ }
+ if (event.key === "Escape") {
+ event.preventDefault()
+ closeSearch()
+ }
+ })
+
+ const searchButton = document.getElementById("search-icon")
+ searchButton.addEventListener("click", (_) => {
+ openSearch()
+ })
+ searchButton.addEventListener("keydown", (_) => {
+ openSearch()
+ })
+ searchContainer.addEventListener("click", (_) => {
+ closeSearch()
+ })
+ document.getElementById("search-space").addEventListener("click", (evt) => {
+ evt.stopPropagation()
+ })
+}
+
+const displayResults = (finalResults, extractHighlight = false) => {
+ const results = document.getElementById("results-container")
+ if (finalResults.length === 0) {
+ results.innerHTML = ``
+ } else {
+ results.innerHTML = finalResults
+ .map((result) => {
+ if (extractHighlight) {
+ return resultToHTML({
+ url: result.url,
+ title: highlight(result.title, term),
+ content: highlight(removeMarkdown(result.content), term)
+ })
+ } else {
+ return resultToHTML(result)
+ }
+ }
+ )
+ .join("\n")
+ const anchors = [...document.getElementsByClassName("result-card")]
+ anchors.forEach((anchor) => {
+ anchor.onclick = () => redir(anchor.id, term)
+ })
+ }
+}
diff --git a/assets/styles/_callouts.scss b/assets/styles/_callouts.scss
new file mode 100644
index 000000000..04fd2f662
--- /dev/null
+++ b/assets/styles/_callouts.scss
@@ -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;
+ }
+ }
+ }
+ }
+}
diff --git a/assets/styles/_dark_syntax.scss b/assets/styles/_dark_syntax.scss
new file mode 100644
index 000000000..9d2019a8a
--- /dev/null
+++ b/assets/styles/_dark_syntax.scss
@@ -0,0 +1,85 @@
+/* Background */ .bg { color: #f8f8f2; background-color: #282a36; }
+/* PreWrapper */ .chroma { color: #f8f8f2; background-color: #282a36; }
+/* Other */ .chroma .x { }
+/* Error */ .chroma .err { }
+/* CodeLine */ .chroma .cl { }
+/* LineTableTD */ .chroma .lntd { vertical-align: top; padding: 0; margin: 0; border: 0; }
+/* LineTable */ .chroma .lntable { border-spacing: 0; padding: 0; margin: 0; border: 0; }
+/* LineHighlight */ .chroma .hl { background-color: #ffffcc }
+/* LineNumbersTable */ .chroma .lnt { white-space: pre; user-select: none; margin-right: 0.4em; padding: 0 0.4em 0 0.4em;color: #7f7f7f }
+/* LineNumbers */ .chroma .ln { white-space: pre; user-select: none; margin-right: 0.4em; padding: 0 0.4em 0 0.4em;color: #7f7f7f }
+/* Line */ .chroma .line { display: flex; }
+/* Keyword */ .chroma .k { color: #ff79c6 }
+/* KeywordConstant */ .chroma .kc { color: #ff79c6 }
+/* KeywordDeclaration */ .chroma .kd { color: #8be9fd; font-style: italic }
+/* KeywordNamespace */ .chroma .kn { color: #ff79c6 }
+/* KeywordPseudo */ .chroma .kp { color: #ff79c6 }
+/* KeywordReserved */ .chroma .kr { color: #ff79c6 }
+/* KeywordType */ .chroma .kt { color: #8be9fd }
+/* Name */ .chroma .n { }
+/* NameAttribute */ .chroma .na { color: #50fa7b }
+/* NameBuiltin */ .chroma .nb { color: #8be9fd; font-style: italic }
+/* NameBuiltinPseudo */ .chroma .bp { }
+/* NameClass */ .chroma .nc { color: #50fa7b }
+/* NameConstant */ .chroma .no { }
+/* NameDecorator */ .chroma .nd { }
+/* NameEntity */ .chroma .ni { }
+/* NameException */ .chroma .ne { }
+/* NameFunction */ .chroma .nf { color: #50fa7b }
+/* NameFunctionMagic */ .chroma .fm { }
+/* NameLabel */ .chroma .nl { color: #8be9fd; font-style: italic }
+/* NameNamespace */ .chroma .nn { }
+/* NameOther */ .chroma .nx { }
+/* NameProperty */ .chroma .py { }
+/* NameTag */ .chroma .nt { color: #ff79c6 }
+/* NameVariable */ .chroma .nv { color: #8be9fd; font-style: italic }
+/* NameVariableClass */ .chroma .vc { color: #8be9fd; font-style: italic }
+/* NameVariableGlobal */ .chroma .vg { color: #8be9fd; font-style: italic }
+/* NameVariableInstance */ .chroma .vi { color: #8be9fd; font-style: italic }
+/* NameVariableMagic */ .chroma .vm { }
+/* Literal */ .chroma .l { }
+/* LiteralDate */ .chroma .ld { }
+/* LiteralString */ .chroma .s { color: #f1fa8c }
+/* LiteralStringAffix */ .chroma .sa { color: #f1fa8c }
+/* LiteralStringBacktick */ .chroma .sb { color: #f1fa8c }
+/* LiteralStringChar */ .chroma .sc { color: #f1fa8c }
+/* LiteralStringDelimiter */ .chroma .dl { color: #f1fa8c }
+/* LiteralStringDoc */ .chroma .sd { color: #f1fa8c }
+/* LiteralStringDouble */ .chroma .s2 { color: #f1fa8c }
+/* LiteralStringEscape */ .chroma .se { color: #f1fa8c }
+/* LiteralStringHeredoc */ .chroma .sh { color: #f1fa8c }
+/* LiteralStringInterpol */ .chroma .si { color: #f1fa8c }
+/* LiteralStringOther */ .chroma .sx { color: #f1fa8c }
+/* LiteralStringRegex */ .chroma .sr { color: #f1fa8c }
+/* LiteralStringSingle */ .chroma .s1 { color: #f1fa8c }
+/* LiteralStringSymbol */ .chroma .ss { color: #f1fa8c }
+/* LiteralNumber */ .chroma .m { color: #bd93f9 }
+/* LiteralNumberBin */ .chroma .mb { color: #bd93f9 }
+/* LiteralNumberFloat */ .chroma .mf { color: #bd93f9 }
+/* LiteralNumberHex */ .chroma .mh { color: #bd93f9 }
+/* LiteralNumberInteger */ .chroma .mi { color: #bd93f9 }
+/* LiteralNumberIntegerLong */ .chroma .il { color: #bd93f9 }
+/* LiteralNumberOct */ .chroma .mo { color: #bd93f9 }
+/* Operator */ .chroma .o { color: #ff79c6 }
+/* OperatorWord */ .chroma .ow { color: #ff79c6 }
+/* Punctuation */ .chroma .p { }
+/* Comment */ .chroma .c { color: #6272a4 }
+/* CommentHashbang */ .chroma .ch { color: #6272a4 }
+/* CommentMultiline */ .chroma .cm { color: #6272a4 }
+/* CommentSingle */ .chroma .c1 { color: #6272a4 }
+/* CommentSpecial */ .chroma .cs { color: #6272a4 }
+/* CommentPreproc */ .chroma .cp { color: #ff79c6 }
+/* CommentPreprocFile */ .chroma .cpf { color: #ff79c6 }
+/* Generic */ .chroma .g { }
+/* GenericDeleted */ .chroma .gd { color: #ff5555 }
+/* GenericEmph */ .chroma .ge { text-decoration: underline }
+/* GenericError */ .chroma .gr { }
+/* GenericHeading */ .chroma .gh { font-weight: bold }
+/* GenericInserted */ .chroma .gi { color: #50fa7b; font-weight: bold }
+/* GenericOutput */ .chroma .go { color: #44475a }
+/* GenericPrompt */ .chroma .gp { }
+/* GenericStrong */ .chroma .gs { }
+/* GenericSubheading */ .chroma .gu { font-weight: bold }
+/* GenericTraceback */ .chroma .gt { }
+/* GenericUnderline */ .chroma .gl { text-decoration: underline }
+/* TextWhitespace */ .chroma .w { }
diff --git a/assets/styles/_light_syntax.scss b/assets/styles/_light_syntax.scss
new file mode 100644
index 000000000..d0f452e03
--- /dev/null
+++ b/assets/styles/_light_syntax.scss
@@ -0,0 +1,85 @@
+/* Background */ .bg { color: #272822; background-color: #fafafa; }
+/* PreWrapper */ .chroma { color: #272822; background-color: #fafafa; }
+/* Other */ .chroma .x { }
+/* Error */ .chroma .err { }
+/* CodeLine */ .chroma .cl { }
+/* LineTableTD */ .chroma .lntd { vertical-align: top; padding: 0; margin: 0; border: 0; }
+/* LineTable */ .chroma .lntable { border-spacing: 0; padding: 0; margin: 0; border: 0; }
+/* LineHighlight */ .chroma .hl { background-color: #ffffcc }
+/* LineNumbersTable */ .chroma .lnt { white-space: pre; user-select: none; margin-right: 0.4em; padding: 0 0.4em 0 0.4em;color: #7f7f7f }
+/* LineNumbers */ .chroma .ln { white-space: pre; user-select: none; margin-right: 0.4em; padding: 0 0.4em 0 0.4em;color: #7f7f7f }
+/* Line */ .chroma .line { display: flex; }
+/* Keyword */ .chroma .k { color: #00a8c8 }
+/* KeywordConstant */ .chroma .kc { color: #00a8c8 }
+/* KeywordDeclaration */ .chroma .kd { color: #00a8c8 }
+/* KeywordNamespace */ .chroma .kn { color: #f92672 }
+/* KeywordPseudo */ .chroma .kp { color: #00a8c8 }
+/* KeywordReserved */ .chroma .kr { color: #00a8c8 }
+/* KeywordType */ .chroma .kt { color: #00a8c8 }
+/* Name */ .chroma .n { color: #111111 }
+/* NameAttribute */ .chroma .na { color: #75af00 }
+/* NameBuiltin */ .chroma .nb { color: #111111 }
+/* NameBuiltinPseudo */ .chroma .bp { color: #111111 }
+/* NameClass */ .chroma .nc { color: #75af00 }
+/* NameConstant */ .chroma .no { color: #00a8c8 }
+/* NameDecorator */ .chroma .nd { color: #75af00 }
+/* NameEntity */ .chroma .ni { color: #111111 }
+/* NameException */ .chroma .ne { color: #75af00 }
+/* NameFunction */ .chroma .nf { color: #75af00 }
+/* NameFunctionMagic */ .chroma .fm { color: #111111 }
+/* NameLabel */ .chroma .nl { color: #111111 }
+/* NameNamespace */ .chroma .nn { color: #111111 }
+/* NameOther */ .chroma .nx { color: #75af00 }
+/* NameProperty */ .chroma .py { color: #111111 }
+/* NameTag */ .chroma .nt { color: #f92672 }
+/* NameVariable */ .chroma .nv { color: #111111 }
+/* NameVariableClass */ .chroma .vc { color: #111111 }
+/* NameVariableGlobal */ .chroma .vg { color: #111111 }
+/* NameVariableInstance */ .chroma .vi { color: #111111 }
+/* NameVariableMagic */ .chroma .vm { color: #111111 }
+/* Literal */ .chroma .l { color: #ae81ff }
+/* LiteralDate */ .chroma .ld { color: #d88200 }
+/* LiteralString */ .chroma .s { color: #d88200 }
+/* LiteralStringAffix */ .chroma .sa { color: #d88200 }
+/* LiteralStringBacktick */ .chroma .sb { color: #d88200 }
+/* LiteralStringChar */ .chroma .sc { color: #d88200 }
+/* LiteralStringDelimiter */ .chroma .dl { color: #d88200 }
+/* LiteralStringDoc */ .chroma .sd { color: #d88200 }
+/* LiteralStringDouble */ .chroma .s2 { color: #d88200 }
+/* LiteralStringEscape */ .chroma .se { color: #8045ff }
+/* LiteralStringHeredoc */ .chroma .sh { color: #d88200 }
+/* LiteralStringInterpol */ .chroma .si { color: #d88200 }
+/* LiteralStringOther */ .chroma .sx { color: #d88200 }
+/* LiteralStringRegex */ .chroma .sr { color: #d88200 }
+/* LiteralStringSingle */ .chroma .s1 { color: #d88200 }
+/* LiteralStringSymbol */ .chroma .ss { color: #d88200 }
+/* LiteralNumber */ .chroma .m { color: #ae81ff }
+/* LiteralNumberBin */ .chroma .mb { color: #ae81ff }
+/* LiteralNumberFloat */ .chroma .mf { color: #ae81ff }
+/* LiteralNumberHex */ .chroma .mh { color: #ae81ff }
+/* LiteralNumberInteger */ .chroma .mi { color: #ae81ff }
+/* LiteralNumberIntegerLong */ .chroma .il { color: #ae81ff }
+/* LiteralNumberOct */ .chroma .mo { color: #ae81ff }
+/* Operator */ .chroma .o { color: #f92672 }
+/* OperatorWord */ .chroma .ow { color: #f92672 }
+/* Punctuation */ .chroma .p { color: #111111 }
+/* Comment */ .chroma .c { color: #75715e }
+/* CommentHashbang */ .chroma .ch { color: #75715e }
+/* CommentMultiline */ .chroma .cm { color: #75715e }
+/* CommentSingle */ .chroma .c1 { color: #75715e }
+/* CommentSpecial */ .chroma .cs { color: #75715e }
+/* CommentPreproc */ .chroma .cp { color: #75715e }
+/* CommentPreprocFile */ .chroma .cpf { color: #75715e }
+/* Generic */ .chroma .g { }
+/* GenericDeleted */ .chroma .gd { }
+/* GenericEmph */ .chroma .ge { font-style: italic }
+/* GenericError */ .chroma .gr { }
+/* GenericHeading */ .chroma .gh { }
+/* GenericInserted */ .chroma .gi { }
+/* GenericOutput */ .chroma .go { }
+/* GenericPrompt */ .chroma .gp { }
+/* GenericStrong */ .chroma .gs { font-weight: bold }
+/* GenericSubheading */ .chroma .gu { }
+/* GenericTraceback */ .chroma .gt { }
+/* GenericUnderline */ .chroma .gl { }
+/* TextWhitespace */ .chroma .w { }
diff --git a/assets/styles/base.scss b/assets/styles/base.scss
index 7c356e9b6..57e90b75f 100644
--- a/assets/styles/base.scss
+++ b/assets/styles/base.scss
@@ -1,21 +1,55 @@
+// Replace this with your own font imports!
+@import url('https://fonts.googleapis.com/css2?family=Fira+Code:wght@400;700&family=Inter:wght@400;600;700&family=Source+Sans+Pro:wght@400;600&display=swap');
:root {
- --lt-colours-light: var(--light) !important;
- --lt-colours-lightgray: var(--lightgray) !important;
- --lt-colours-dark: var(--secondary) !important;
- --lt-colours-secondary: var(--tertiary) !important;
- --lt-colours-gray: var(--outlinegray) !important;
+ --font-body: "Source Sans Pro";
+ --font-header: "Inter";
+ --font-mono: "Fira Code"
+}
+
+// typography
+html {
+ scroll-behavior: smooth;
+ &:lang(ar) {
+ & p, & h1, & h2, & h3, article, header {
+ direction: rtl;
+ text-align: right;
+ }
+ }
+ & footer > p {
+ text-align: center !important;
+ }
+}
+
+body {
+ margin: 0;
+ height: 100vh;
+ width: 100vw;
+ max-width: 100%;
+ box-sizing: border-box;
+ background-color: var(--light);
}
h1, h2, h3, h4, h5, h6, ol, ul, thead {
font-family: Poppins;
color: var(--dark);
font-weight: revert;
- margin: revert;
- padding: revert;
+ margin: 2rem 0 0;
+ padding: 2rem auto 1rem;
+
+ &:hover > .hanchor {
+ color: var(--secondary);
+ }
}
-p, ul, text {
- font-family: 'Source Sans Pro', sans-serif;
+.hanchor {
+ font-family: var(--font-header);
+ opacity: 0.8;
+ transition: color 0.3s ease;
+ color: var(--dark);
+}
+
+p, ul, text, a, tr, td, li, ol, ul {
+ font-family: var(--font-body);
color: var(--gray);
fill: var(--gray);
font-weight: revert;
@@ -23,21 +57,26 @@ p, ul, text {
padding: revert;
}
+tbody, li, p {
+ line-height: 1.5em;
+}
+
.mainTOC {
- background: var(--lightgray);
border-radius: 5px;
- padding: 0.75em 1em;
-}
+ padding: 0.75em 0;
-.mainTOC details summary {
- cursor: zoom-in;
- font-family: Inter;
- color: var(--dark);
- font-weight: 700;
-}
+ & details {
+ & summary {
+ cursor: zoom-in;
+ font-family: var(--font-header);
+ color: var(--dark);
+ font-weight: 700;
+ }
-.mainTOC details[open] summary {
- cursor: zoom-out;
+ &[open] summary {
+ cursor: zoom-out;
+ }
+ }
}
#TableOfContents > ol {
@@ -62,22 +101,30 @@ p, ul, text {
}
& > li::marker, & > li > ol > li::marker {
- font-family: Source Sans Pro;
+ font-family: var(--font-body);
font-weight: 700;
}
}
table {
+ border: 1px solid var(--outlinegray);
width: 100%;
+ padding: 1.5em;
+ border-collapse: collapse;
+}
+
+td, th {
+ padding: 0.2em 1em;
+ border: 1px solid var(--outlinegray);
}
img {
- width: 100%;
+ max-width: 100%;
border-radius: 3px;
margin: 1em 0;
}
-p>img+em {
+p > img + em {
display: block;
transform: translateY(-1em);
}
@@ -86,29 +133,11 @@ sup {
line-height: 0
}
-p, tbody, li {
- font-family: Source Sans Pro;
- color: var(--gray);
- line-height: 1.5em;
-}
-
blockquote {
margin-left: 0em;
border-left: 3px solid var(--secondary);
padding-left: 1em;
transition: border-color 0.2s ease;
-
- &:hover {
- border-color: var(--tertiary);
- }
-}
-
-table {
- padding: 1.5em;
-}
-
-td, th {
- padding: 0.1em 0.5em;
}
.footnotes p {
@@ -135,59 +164,24 @@ td, th {
background-color: transparent !important;
}
- & a[href$="#"] {
+ & a[href$="#"], &.active a {
opacity: 0.2;
}
}
}
-.section {
- & h3 > a {
- font-weight: 700;
- font-family: Inter;
- margin: 0;
- }
- & p {
- margin-top: 0;
- }
-}
-
article {
+ & > h1 {
+ margin-top: 2em;
+ font-size: 2em;
+ }
+
& > .meta {
- margin: -1.5em 0 1em 0;
+ margin: 0 0 1em 0;
opacity: 0.7;
}
- & > .tags {
- list-style: none;
- padding-left: 0;
-
- & .meta {
- & > h1 {
- margin: 0;
- }
- & > p {
- margin: 0;
- }
- }
-
- & > li {
- display: inline-block;
- }
- & > li > a {
- border-radius: 8px;
- border: var(--outlinegray) 1px solid;
- padding: 0.2em 0.5em;
- &::before {
- content: "#";
- margin-right: 0.3em;
- color: var(--outlinegray);
- }
- }
- }
-
& a {
- font-family: Source Sans Pro;
font-weight: 600;
&.internal-link {
@@ -209,6 +203,37 @@ article {
}
}
+.tags {
+ list-style: none;
+ padding-left: 0;
+
+ & .meta {
+ margin: 1.5em 0;
+ & > h1 {
+ margin: 0;
+ }
+ & > p {
+ margin: 0;
+ }
+ }
+
+ & > li {
+ display: inline-block;
+ margin: 0.4em 0.2em;
+ }
+
+ & > li > a {
+ border-radius: 8px;
+ border: var(--outlinegray) 1px solid;
+ padding: 0.2em 0.5em;
+ &::before {
+ content: "#";
+ margin-right: 0.3em;
+ color: var(--outlinegray);
+ }
+ }
+}
+
.backlinks a {
font-weight: 600;
font-size: 0.9rem;
@@ -219,55 +244,39 @@ sup > a {
padding: 0 0.1em 0 0.2em;
}
+#page-title {
+ margin: 0;
+ & > a {
+ font-family: var(--font-header);
+ }
+}
+
a {
- font-family: Inter, sans-serif;
font-size: 1em;
font-weight: 700;
text-decoration: none;
transition: all 0.2s ease;
color: var(--secondary);
-
&:hover {
color: var(--secondary-active) !important;
}
}
pre {
- font-family: 'Fira Code';
+ font-family: var(--font-mono);
padding: 0.75em;
border-radius: 3px;
overflow-x: scroll;
}
code {
- font-family: 'Fira Code';
+ font-family: var(--font-mono);
font-size: 0.85em;
padding: 0.15em 0.3em;
border-radius: 5px;
background: var(--lightgray);
}
-html {
- scroll-behavior: smooth;
-
- &:lang(ar) {
- & p, & h1, & h2, & h3, article {
- direction: rtl;
- text-align: right;
- }
- }
-}
-
-body {
- margin: 0;
- height: 100vh;
- width: 100vw;
- //overflow-x: hidden;
- max-width: 100%;
- box-sizing: border-box;
- background-color: var(--light);
-}
-
@keyframes fadeIn {
0% {opacity:0;}
100% {opacity:1;}
@@ -325,7 +334,8 @@ hr {
& > .backlinks-container {
& > ul {
list-style: none;
- padding-left: 0;
+ padding: 0;
+ margin: 0;
& > li {
margin: 0.5em 0;
@@ -339,6 +349,14 @@ hr {
& #graph-container {
border: var(--outlinegray) 1px solid;
border-radius: 5px;
+ box-sizing: border-box;
+ min-height: 250px;
+ margin: 0.5em 0;
+
+ & > svg {
+ margin-bottom: -5px;
+
+ }
}
}
@@ -346,14 +364,15 @@ hr {
margin-top: 30vh;
}
-article > h1 {
- font-size: 2em;
+.spacer {
+ flex: 1 1 auto;
}
header {
display: flex;
flex-direction: row;
align-items: center;
+ margin: 1em 0 2em;
& > h1 {
font-size: 2em;
@@ -365,15 +384,24 @@ header {
}
}
- & > .spacer {
- flex: 1 1 auto;
+ #search-icon {
+ background-color: var(--lightgray);
+ border-radius: 4px;
+ height: 2em;
+ display: flex;
+ align-items: center;
+ cursor: pointer;
+ & > p {
+ display: inline;
+ padding: 0 1.5em 0 2em;
+ }
}
- & > svg {
+ & svg {
cursor: pointer;
width: 18px;
min-width: 18px;
- margin: 0 1em;
+ margin: 0 0.5em;
&:hover .search-path {
stroke: var(--tertiary);
@@ -420,7 +448,7 @@ header {
& > input {
box-sizing: border-box;
padding: 0.5em 1em;
- font-family: Inter, sans-serif;
+ font-family: var(--font-body);
color: var(--dark);
font-size: 1.1em;
border: 1px solid var(--outlinegray);
@@ -431,7 +459,7 @@ header {
}
& > #results-container {
- & > .result-card {
+ & .result-card {
padding: 1em;
cursor: pointer;
transition: background 0.2s ease;
@@ -468,36 +496,57 @@ header {
& > h3, & > p {
margin: 0;
}
-
- & .search-highlight {
- background-color: #afbfc966;
- padding: 0.05em 0.2em;
- border-radius: 3px;
- }
}
}
}
}
+.search-highlight {
+ background-color: #afbfc966;
+ padding: 0.05em 0.2em;
+ border-radius: 3px;
+}
+
.section-ul {
list-style: none;
+ margin-top: 2em;
padding-left: 0;
- & > li {
- border: 1px solid var(--outlinegray);
- border-radius: 5px;
- padding: 0 1em;
- margin-bottom: 1em;
+}
- & h3 {
- opacity: 1;
+.section-li {
+ margin-bottom: 1em;
+
+ & > .section {
+ display: flex;
+ align-items: center;
+
+ @media all and (max-width: 600px) {
+ & .tags {
+ display: none;
+ }
+ }
+
+ & h3 > a {
font-weight: 700;
- margin-bottom: 0em;
+ margin: 0;
}
+
+ & p {
+ margin: 0;
+ padding-right: 1em;
+ flex-basis: 6em;
+ }
+ }
- & .meta {
- opacity: 0.6;
- }
+ & h3 {
+ opacity: 1;
+ font-weight: 700;
+ margin: 0em;
+ }
+
+ & .meta {
+ opacity: 0.6;
}
}
@@ -510,25 +559,23 @@ header {
1% {
display: inline-block;
opacity: 0;
- transform: translate(-50%, 40%);
}
100% {
opacity: 1;
visibility: visible;
- transform: translate(-50%, 20%);
}
}
.popover {
z-index: 999;
position: absolute;
- width: 20em;
+ width: 20rem;
display: none;
background-color: var(--light);
- padding: 1em;
+ padding: 1rem;
+ margin: 1rem;
border: 1px solid var(--outlinegray);
border-radius: 5px;
- transform: translate(-50%, 40%);
pointer-events: none;
transition: opacity 0.2s ease, transform 0.2s ease;
user-select: none;
@@ -536,38 +583,40 @@ header {
box-shadow: 6px 6px 36px 0px rgba(0,0,0,0.25);
@media all and (max-width: 600px) {
- display: none;
+ display: none !important;
}
&.visible {
opacity: 1;
visibility: visible;
- transform: translate(-50%, 20%);
display: inline-block;
animation: dropin 0.2s ease;
}
& > h3 {
font-size: 1rem;
- margin: 0.25em 0;
+ margin: 0.25rem 0;
}
& > .meta {
- margin-top: 0.25em;
+ margin-top: 0.25rem;
opacity: 0.5;
- font-family: "JetBrains Mono", monospace;
+ font-family: var(--font-mono);
font-size: 0.8rem;
}
& > p {
margin: 0;
+ padding: 0.5rem 0;
+ }
+
+ & > p, & > a {
+ font-size: 1rem;
font-weight: 400;
user-select: none;
}
}
-
-
#contact_buttons ul {
list-style-type: none;
@@ -579,3 +628,4 @@ header {
padding: 0 1em;
}
}
+
diff --git a/assets/styles/clipboard.scss b/assets/styles/clipboard.scss
new file mode 100644
index 000000000..7989e248c
--- /dev/null
+++ b/assets/styles/clipboard.scss
@@ -0,0 +1,47 @@
+.clipboard-button {
+ position: absolute;
+ display: flex;
+ float: right;
+ right: 0;
+ padding: 0.69em;
+ margin: 0.5em;
+ color: var(--outlinegray);
+ border-color: var(--dark);
+ background-color: var(--lightgray);
+ filter: contrast(1.1);
+ border: 2px solid;
+ border-radius: 6px;
+ font-size: 0.8em;
+ z-index: 1;
+ opacity: 0;
+ transition: 0.12s;
+
+ & > svg {
+ fill: var(--light);
+ filter: contrast(0.3);
+ }
+
+ &:hover {
+ cursor: pointer;
+ border-color: var(--primary);
+
+ & > svg {
+ fill: var(--primary);
+ }
+ }
+
+ &:focus {
+ outline: 0;
+ }
+}
+
+.highlight {
+ position: relative;
+
+ &:hover > .clipboard-button {
+ opacity: 1;
+ transition: 0.2s;
+ }
+}
+
+
diff --git a/assets/styles/code-title.scss b/assets/styles/code-title.scss
new file mode 100644
index 000000000..b384743b8
--- /dev/null
+++ b/assets/styles/code-title.scss
@@ -0,0 +1,20 @@
+.code-title {
+ color: var(--primary) ;
+ font-family: var(--font-mono);
+ width: max-content;
+ overflow-x: auto;
+ display: inline-block;
+ vertical-align: middle;
+ font-weight: normal;
+ line-height: 1em;
+ position: relative;
+ padding: 0.5em 0.6em 0.6em; // + 1.2 em
+ max-width: calc(100% - 1.2em); // (-1.2 em) fits article width exactly
+ margin-bottom: -0.2em;
+ z-index: -1;
+ border-top-left-radius: 0.3em;
+ border-top-right-radius: 0.3em;
+ font-size: 0.9em;
+ background-color: var(--lightgray);
+ filter: hue-rotate(-30deg) contrast(1.0) opacity(0.8);
+}
\ No newline at end of file
diff --git a/assets/styles/custom.scss b/assets/styles/custom.scss
index 84a6a118d..1cbd805e4 100644
--- a/assets/styles/custom.scss
+++ b/assets/styles/custom.scss
@@ -1,4 +1,5 @@
// Add your own CSS here!
+
:root {
--light: #faf8f8;
--dark: #141021;
@@ -9,6 +10,7 @@
--gray: #4e4e4e;
--lightgray: #f0f0f0;
--outlinegray: #dadada;
+ --million-progress-bar-color: var(--secondary);
}
[saved-theme="dark"] {
diff --git a/assets/styles/syntax.scss b/assets/styles/syntax.scss
index bada47ab5..62a9fe932 100644
--- a/assets/styles/syntax.scss
+++ b/assets/styles/syntax.scss
@@ -1,99 +1,62 @@
-/* Background */ .chroma { color: #f8f8f2; background-color: #282a36; overflow: hidden }
-/* Other */ .chroma .x { }
-/* Error */ .chroma .err { }
-/* LineTableTD */ .chroma .lntd { vertical-align: top; padding: 0; margin: 0; border: 0; }
-/* LineTable */ .chroma .lntable { border-spacing: 0; padding: 0; margin: 0; border: 0; width: auto; overflow: auto; display: block; }
-/* LineHighlight */ .chroma .hl { display: block; width: 100%;background-color: #ffffcc }
-/* LineNumbersTable */ .chroma .lnt { margin-right: 0.4em; padding: 0 0.4em 0 0.4em;color: #7f7f7f }
-/* LineNumbers */ .chroma .ln { margin-right: 0.4em; padding: 0 0.4em 0 0.4em;color: #7f7f7f }
-/* Keyword */ .chroma .k { color: #ff79c6 }
-/* KeywordConstant */ .chroma .kc { color: #ff79c6 }
-/* KeywordDeclaration */ .chroma .kd { color: #8be9fd; font-style: italic }
-/* KeywordNamespace */ .chroma .kn { color: #ff79c6 }
-/* KeywordPseudo */ .chroma .kp { color: #ff79c6 }
-/* KeywordReserved */ .chroma .kr { color: #ff79c6 }
-/* KeywordType */ .chroma .kt { color: #8be9fd }
-/* Name */ .chroma .n { }
-/* NameAttribute */ .chroma .na { color: #50fa7b }
-/* NameBuiltin */ .chroma .nb { color: #8be9fd; font-style: italic }
-/* NameBuiltinPseudo */ .chroma .bp { }
-/* NameClass */ .chroma .nc { color: #50fa7b }
-/* NameConstant */ .chroma .no { }
-/* NameDecorator */ .chroma .nd { }
-/* NameEntity */ .chroma .ni { }
-/* NameException */ .chroma .ne { }
-/* NameFunction */ .chroma .nf { color: #50fa7b }
-/* NameFunctionMagic */ .chroma .fm { }
-/* NameLabel */ .chroma .nl { color: #8be9fd; font-style: italic }
-/* NameNamespace */ .chroma .nn { }
-/* NameOther */ .chroma .nx { }
-/* NameProperty */ .chroma .py { }
-/* NameTag */ .chroma .nt { color: #ff79c6 }
-/* NameVariable */ .chroma .nv { color: #8be9fd; font-style: italic }
-/* NameVariableClass */ .chroma .vc { color: #8be9fd; font-style: italic }
-/* NameVariableGlobal */ .chroma .vg { color: #8be9fd; font-style: italic }
-/* NameVariableInstance */ .chroma .vi { color: #8be9fd; font-style: italic }
-/* NameVariableMagic */ .chroma .vm { }
-/* Literal */ .chroma .l { }
-/* LiteralDate */ .chroma .ld { }
-/* LiteralString */ .chroma .s { color: #f1fa8c }
-/* LiteralStringAffix */ .chroma .sa { color: #f1fa8c }
-/* LiteralStringBacktick */ .chroma .sb { color: #f1fa8c }
-/* LiteralStringChar */ .chroma .sc { color: #f1fa8c }
-/* LiteralStringDelimiter */ .chroma .dl { color: #f1fa8c }
-/* LiteralStringDoc */ .chroma .sd { color: #f1fa8c }
-/* LiteralStringDouble */ .chroma .s2 { color: #f1fa8c }
-/* LiteralStringEscape */ .chroma .se { color: #f1fa8c }
-/* LiteralStringHeredoc */ .chroma .sh { color: #f1fa8c }
-/* LiteralStringInterpol */ .chroma .si { color: #f1fa8c }
-/* LiteralStringOther */ .chroma .sx { color: #f1fa8c }
-/* LiteralStringRegex */ .chroma .sr { color: #f1fa8c }
-/* LiteralStringSingle */ .chroma .s1 { color: #f1fa8c }
-/* LiteralStringSymbol */ .chroma .ss { color: #f1fa8c }
-/* LiteralNumber */ .chroma .m { color: #bd93f9 }
-/* LiteralNumberBin */ .chroma .mb { color: #bd93f9 }
-/* LiteralNumberFloat */ .chroma .mf { color: #bd93f9 }
-/* LiteralNumberHex */ .chroma .mh { color: #bd93f9 }
-/* LiteralNumberInteger */ .chroma .mi { color: #bd93f9 }
-/* LiteralNumberIntegerLong */ .chroma .il { color: #bd93f9 }
-/* LiteralNumberOct */ .chroma .mo { color: #bd93f9 }
-/* Operator */ .chroma .o { color: #ff79c6 }
-/* OperatorWord */ .chroma .ow { color: #ff79c6 }
-/* Punctuation */ .chroma .p { }
-/* Comment */ .chroma .c { color: #6272a4 }
-/* CommentHashbang */ .chroma .ch { color: #6272a4 }
-/* CommentMultiline */ .chroma .cm { color: #6272a4 }
-/* CommentSingle */ .chroma .c1 { color: #6272a4 }
-/* CommentSpecial */ .chroma .cs { color: #6272a4 }
-/* CommentPreproc */ .chroma .cp { color: #ff79c6 }
-/* CommentPreprocFile */ .chroma .cpf { color: #ff79c6 }
-/* Generic */ .chroma .g { }
-/* GenericDeleted */ .chroma .gd { color: #8b080b }
-/* GenericEmph */ .chroma .ge { text-decoration: underline }
-/* GenericError */ .chroma .gr { }
-/* GenericHeading */ .chroma .gh { font-weight: bold }
-/* GenericInserted */ .chroma .gi { font-weight: bold }
-/* GenericOutput */ .chroma .go { color: #44475a }
-/* GenericPrompt */ .chroma .gp { }
-/* GenericStrong */ .chroma .gs { }
-/* GenericSubheading */ .chroma .gu { font-weight: bold }
-/* GenericTraceback */ .chroma .gt { }
-/* GenericUnderline */ .chroma .gl { text-decoration: underline }
-/* TextWhitespace */ .chroma .w { }
+// Overrides
+/* Background */
+.chroma {
+ overflow: hidden !important;
+ background-color: var(--lightgray) !important;
+}
+
+/* LineTable */
+.chroma .lntable {
+ width: auto !important;
+ overflow: auto !important;
+ display: block !important;
+}
+
+/* LineHighlight */
+.chroma .hl {
+ display: block !important;
+ width: 100% !important;
+}
+
+/* LineNumbersTable */
+.chroma .lnt {
+ margin-right: 0.0em !important;
+ padding: 0 0.0em 0 0.0em !important;
+}
+
+/* LineNumbers */
+.chroma .ln {
+ margin-right: 0.0em !important;
+ padding: 0 0.0em 0 0.0em !important;
+}
+
+/* GenericDeleted */
+.chroma .gd {
+ color: #8b080b !important;
+}
+
+/* GenericInserted */
+.chroma .gi {
+ font-weight: bold !important;
+}
.lntd:first-of-type > .chroma {
- padding-right: 0;
+ padding-right: 0 !important;
}
.chroma code {
- font-family: 'Fira Code' !important;
- font-size: 0.85em;
- line-height: 1em;
- background: none;
- padding: 0;
+ font-family: var(--font-mono) !important;
+ font-size: 0.85em !important;
+ line-height: 2em !important;
+ background: none !important;
+ padding: 0 !important;
}
.chroma {
- border-radius: 3px;
- margin: 0;
-}
\ No newline at end of file
+ border-radius: 3px !important;
+ margin: 0 !important;
+}
+
+pre.chroma {
+ -moz-tab-size:4;-o-tab-size:4;tab-size:4;
+}
diff --git a/config.toml b/config.toml
index 65939ddac..6c8eace8d 100644
--- a/config.toml
+++ b/config.toml
@@ -18,6 +18,7 @@ enableGitInfo = true
ordered = true
startLevel = 2
[markup.highlight]
+ noClasses = false
anchorLineNos = false
codeFences = true
guessSyntax = true
@@ -27,9 +28,11 @@ enableGitInfo = true
lineNos = true
lineNumbersInTable = true
style = "dracula"
- tabWidth = 4
+ [frontmatter]
+ lastmod = ["lastmod", ":git", "date", "publishDate"]
+ publishDate = ["publishDate", "date"]
[markup.goldmark.renderer]
- unsafe= true
+ unsafe = true
[security]
[security.funcs]
getenv = ['^HUGO_', '^BRANCH']
diff --git a/content/notes/callouts.md b/content/notes/callouts.md
new file mode 100644
index 000000000..74b837d61
--- /dev/null
+++ b/content/notes/callouts.md
@@ -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
diff --git a/content/notes/search.md b/content/notes/search.md
new file mode 100644
index 000000000..ed170f64d
--- /dev/null
+++ b/content/notes/search.md
@@ -0,0 +1,50 @@
+---
+title: "Search"
+---
+
+Quartz supports two modes of searching through content.
+
+## Full-text
+Full-text search is the default in Quartz. It produces results that *exactly* match the search query. This is easier to setup but usually produces lower quality matches.
+
+```yaml {title="data/config.yaml"}
+# the default option
+enableSemanticSearch: false
+```
+
+## Natural Language
+Natural language search is powered by [Operand](https://operand.ai/). It understands language like a person does and finds results that best match user intent. In this sense, it is closer to how Google Search works.
+
+Natural language search tends to produce higher quality results than full-text search.
+
+Here's how to set it up.
+
+1. Create an Operand Account on [their website](https://operand.ai/).
+2. Go to Dashboard > Settings > Integrations.
+3. Follow the steps to setup the GitHub integration. Operand needs access to GitHub in order to index your digital garden properly!
+4. Head over to Dashboard > Objects and press `(Cmd + K)` to open the omnibar and select 'Create Collection'.
+ 1. Set the 'Collection Label' to something that will help you remember it.
+ 2. You can leave the 'Parent Collection' field empty.
+5. Click into your newly made Collection.
+ 1. Press the 'share' button that looks like three dots connected by lines.
+ 2. Set the 'Interface Type' to `object-search` and click 'Create'.
+ 3. This will bring you to a new page with a search bar. Ignore this for now.
+6. Go back to Dashboard > Settings > API Keys and find your Quartz-specific Operand API key under 'Other keys'.
+ 1. Copy the key (which looks something like `0e733a7f-9b9c-48c6-9691-b54fa1c8b910`).
+ 2. Open `data/config.yaml`. Set `enableSemanticSearch` to `true` and `operandApiKey` to your copied key.
+
+```yaml {title="data/config.yaml"}
+# the default option
+enableSemanticSearch: true
+operandApiKey: "0e733a7f-9b9c-48c6-9691-b54fa1c8b910"
+```
+7. Make a commit and push your changes to GitHub. See the [[notes/hosting|hosting]] page if you haven't done this already.
+ 1. This step is *required* for Operand to be able to properly index your content.
+ 2. Head over to Dashboard > Objects and select the collection that you made earlier
+8. Press `(Cmd + K)` to open the omnibar again and select 'Create GitHub Repo'
+ 1. Set the 'Repository Label' to `Quartz`
+ 2. Set the 'Repository Owner' to your GitHub username
+ 3. Set the 'Repository Ref' to `master`
+ 4. Set the 'Repository Name' to the name of your repository (usually just `quartz` if you forked the repository without changing the name)
+ 5. Leave 'Root Path' and 'Root URL' empty
+9. Wait for your repository to index and enjoy natural language search in Quartz! Operand refreshes the index every 2h so all you need to do is just push to GitHub to update the contents in the search.
\ No newline at end of file
diff --git a/content/notes/updating.md b/content/notes/updating.md
new file mode 100644
index 000000000..ef4688e99
--- /dev/null
+++ b/content/notes/updating.md
@@ -0,0 +1,34 @@
+---
+title: "Updating"
+aliases:
+- update
+---
+
+Haven't updated Quartz in a while and want all the cool new optimizations? On Unix/Mac systems you can run the following command for a one-line update! This command will show you a log summary of all commits since you last updated, press `q` to acknowledge this. Then, it will show you each change in turn and press `y` to accept the patch or `n` to reject it. Usually you should press `y` for most of these unless it conflicts with existing changes you've made!
+
+```shell
+make update
+```
+
+Or, if you don't want the interactive parts and just want to force update your local garden (this assumed that you are okay with some of your personalizations been overriden!)
+
+```shell
+make update-force
+```
+
+Or, manually checkout the changes yourself.
+
+> [!warning] Warning!
+>
+> If you customized the files in `data/`, or anything inside `layouts/`, your customization may be overwritten!
+> Make sure you have a copy of these changes if you don't want to lose them.
+
+
+```shell
+# add Quartz as a remote host
+git remote add upstream git@github.com:jackyzha0/quartz.git
+
+# index and fetch changes
+git fetch upstream
+git checkout -p upstream/hugo -- layouts .github Makefile assets/js assets/styles/base.scss assets/styles/darkmode.scss config.toml data
+```
diff --git a/data/config.yaml b/data/config.yaml
index ad40a77c2..8f53735ac 100644
--- a/data/config.yaml
+++ b/data/config.yaml
@@ -3,6 +3,17 @@ enableToc: false
openToc: false
enableLinkPreview: true
enableLatex: true
+enableCodeBlockTitle: true
+enableCodeBlockCopy: true
+enableCallouts: true
+enableSPA: true
+enableFooter: true
+enableContextualBacklinks: true
+enableRecentNotes: false
+enableGitHubEdit: true
+GitHubLink: https://github.com/jackyzha0/quartz/tree/hugo/content
+enableSemanticSearch: false
+operandApiKey: "REPLACE-WITH-YOUR-OPERAND-API-KEY"
tagline: "Quick Short-form Notes for Obsidian"
description: "Take short-form notes at breakneck speeds and sync them with Obsidian. Then, build your network of ideas across all platforms."
page_title:
diff --git a/data/graphConfig.yaml b/data/graphConfig.yaml
index 3f8d3fb6b..a6f916acb 100644
--- a/data/graphConfig.yaml
+++ b/data/graphConfig.yaml
@@ -1,6 +1,37 @@
-enableLegend: false
-enableDrag: true
-enableZoom: true
-depth: -1 # set to -1 to show full graph
+# if true, a Global Graph will be shown on home page with full width, no backlink.
+# A different set of Local Graphs will be shown on sub pages.
+# if false, Local Graph will be default on every page as usual
+enableGlobalGraph: false
+
+### Local Graph ###
+
+localGraph:
+ enableLegend: false
+ enableDrag: true
+ enableZoom: true
+ depth: 1 # set to -1 to show full graph
+ scale: 1.2
+ repelForce: 2
+ centerForce: 1
+ linkDistance: 1
+ fontSize: 0.6
+ opacityScale: 3
+
+### Global Graph ###
+
+globalGraph:
+ enableLegend: false
+ enableDrag: true
+ enableZoom: true
+ depth: -1 # set to -1 to show full graph
+ scale: 1.4
+ repelForce: 1
+ centerForce: 1
+ linkDistance: 1
+ fontSize: 0.5
+ opacityScale: 3
+
+### For all graphs ###
+
paths:
- - /moc: "#4388cc"
\ No newline at end of file
+ - /moc: "#4388cc"
diff --git a/i18n/ar.toml b/i18n/ar.toml
new file mode 100644
index 000000000..631c07155
--- /dev/null
+++ b/i18n/ar.toml
@@ -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 }} باستخدام كوارتز، {{ .year }} ©"
diff --git a/i18n/en.toml b/i18n/en.toml
new file mode 100644
index 000000000..b9ce33e6c
--- /dev/null
+++ b/i18n/en.toml
@@ -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 Quartz, © {{ .year }}"
diff --git a/layouts/404.html b/layouts/404.html
index 424839502..5607e6345 100644
--- a/layouts/404.html
+++ b/layouts/404.html
@@ -1,5 +1,5 @@
-
+
{{ partial "head.html" . }}
@@ -7,10 +7,9 @@
{{partial "darkmode.html" .}}
-
diff --git a/layouts/_default/_markup/render-image.html b/layouts/_default/_markup/render-image.html
index ff4e8b39c..dbcf732fd 100644
--- a/layouts/_default/_markup/render-image.html
+++ b/layouts/_default/_markup/render-image.html
@@ -1,8 +1,9 @@
{{$src := .Destination | safeURL }}
+{{$width := index (split .Text "|") 1 | default "auto" }}
{{$external := strings.HasPrefix $src "http" }}
{{- if $external -}}
-
+
{{- else -}}
{{$fixedUrl := (cond (hasPrefix $src "/") $src (print "/" $src)) | urlize}}
-
+
{{- end -}}
diff --git a/layouts/_default/_markup/render-link.html b/layouts/_default/_markup/render-link.html
index cdacfc134..4757b7284 100644
--- a/layouts/_default/_markup/render-link.html
+++ b/layouts/_default/_markup/render-link.html
@@ -7,7 +7,7 @@
{{$spacedurl := replace $trimmed "%20" " " }}
{{$fixedUrl := (cond (hasPrefix $spacedurl "/") $spacedurl (print "/" $spacedurl)) | urlize}}
{{$nonexistent := eq (.Page.GetPage $spacedurl).RelPermalink ""}}
-{{$rooted := default $spacedurl (strings.TrimRight "/" (.Page.GetPage $spacedurl).RelPermalink) }}
+{{$rooted := default $spacedurl ((.Page.GetPage $spacedurl).RelPermalink) }}
-
+
{{ block "head" . }}
{{ end }}
diff --git a/layouts/_default/section.html b/layouts/_default/section.html
index 5a522c59d..f88b85fce 100644
--- a/layouts/_default/section.html
+++ b/layouts/_default/section.html
@@ -1,5 +1,5 @@
-
+
{{ partial "head.html" . }}
@@ -8,13 +8,14 @@
{{partial "header.html" .}}
- All {{.Title}}
+ {{ i18n "all_posts" . }}
+ {{with .Params.description}}
+ {{.}}
+ {{end}}
{{partial "page-list.html" .Paginator.Pages.ByLastmod.Reverse }}
{{ template "_internal/pagination.html" .}}
{{partial "contact.html" .}}
-{{partial "popover.html" .}}
-
diff --git a/layouts/_default/single.html b/layouts/_default/single.html
index 85923d165..f47464f40 100644
--- a/layouts/_default/single.html
+++ b/layouts/_default/single.html
@@ -10,22 +10,21 @@
{{if .Title}}{{ .Title }}
{{end}}
- {{partial "toc.html" .}}
+ {{partial "toc.html" .}}
{{partial "textprocessing.html" . }}
{{ if in .Page.RelPermalink "/posts/" }}
{{partial "comments.html" .}}
{{ end }}
{{partial "footer.html" .}}
- {{partial "popover.html" .}}
-
diff --git a/layouts/_default/taxonomy.html b/layouts/_default/taxonomy.html
index a7ad44126..01ec325ac 100644
--- a/layouts/_default/taxonomy.html
+++ b/layouts/_default/taxonomy.html
@@ -1,5 +1,5 @@
-
+
{{ partial "head.html" . }}
@@ -8,22 +8,23 @@
{{partial "header.html" .}}
- All {{.Title}}
+ {{ i18n "all_posts" . }}
+ {{with .Params.description}}
+ {{.}}
+ {{end}}
{{partial "contact.html" .}}
-{{partial "popover.html" .}}
-
diff --git a/layouts/_default/term.html b/layouts/_default/term.html
index bfe93decb..6bda201bc 100644
--- a/layouts/_default/term.html
+++ b/layouts/_default/term.html
@@ -1,5 +1,5 @@
-
+
{{ partial "head.html" . }}
@@ -8,13 +8,14 @@
{{partial "header.html" .}}
- Tag: {{.Title | humanize}}
+ {{ i18n "tag" }}: {{ .Title }}
+ {{with .Params.description}}
+ {{.}}
+ {{end}}
{{partial "page-list.html" .Paginator.Pages}}
{{ template "_internal/pagination.html" . }}
{{partial "contact.html" .}}
-{{partial "popover.html" .}}
-
diff --git a/layouts/index.html b/layouts/index.html
index 591fa5d99..42813ae66 100644
--- a/layouts/index.html
+++ b/layouts/index.html
@@ -9,12 +9,13 @@
{{partial "header.html" .}}
- {{partial "toc.html" .}}
+ {{partial "toc.html" .}}
{{partial "textprocessing.html" . }}
+ {{if $.Site.Data.config.enableRecentNotes}}
+ {{partial "recent.html" . }}
+ {{end}}
- {{partial "footer.html" .}}
- {{partial "popover.html" .}}
+ {{partial "footerIndex.html" .}}
-
diff --git a/layouts/partials/backlinks.html b/layouts/partials/backlinks.html
index 425ec67cf..ae6ea1a8e 100644
--- a/layouts/partials/backlinks.html
+++ b/layouts/partials/backlinks.html
@@ -1,4 +1,4 @@
-Backlinks
+{{ i18n "backlinks" }}
{{$url := urls.Parse .Site.BaseURL }}
{{$host := strings.TrimRight "/" $url.Path }}
@@ -7,18 +7,24 @@
{{$inbound := index $linkIndex.index.backlinks $curPage}}
{{$contentTable := getJSON "/assets/indices/contentIndex.json"}}
{{if $inbound}}
- {{$cleanedInbound := apply (apply $inbound "index" "." "source") "replace" "." " " "-"}}
- {{- range $cleanedInbound | uniq -}}
- {{$l := printf "%s%s" $host .}}
- {{with (index $contentTable .)}}
+ {{$backlinks := dict "SENTINEL" "SENTINEL"}}
+ {{range $k, $v := $inbound}}
+ {{$cleanedInbound := replace $v.source " " "-"}}
+ {{$ctx := $v.text}}
+ {{$backlinks = merge $backlinks (dict $cleanedInbound $ctx)}}
+ {{end}}
+ {{- range $lnk, $ctx := $backlinks -}}
+ {{$l := printf "%s%s/" $host $lnk}}
+ {{$l = cond (eq $l "//") "/" $l}}
+ {{with (index $contentTable $lnk)}}
-
- {{index (index . "title")}}
+ {{index (index . "title")}}
{{end}}
{{- end -}}
{{else}}
-
- No backlinks found
+ {{ i18n "no_backlinks" }}
{{end}}
diff --git a/layouts/partials/contact.html b/layouts/partials/contact.html
index 11a77f892..3de7d2c68 100644
--- a/layouts/partials/contact.html
+++ b/layouts/partials/contact.html
@@ -1,8 +1,17 @@
+
+{{ $config := cond (eq $.Site.Language.Lang "en") "config" (printf "config.%s" $.Site.Language.Lang) }}
+{{ $data := index $.Site.Data $config }}