site: add shiki highlighting
This commit is contained in:
committed by
Johannes Kirschbauer
parent
808491c71c
commit
5cac9e7704
12
site/package-lock.json
generated
12
site/package-lock.json
generated
@@ -10,6 +10,7 @@
|
|||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@fontsource-variable/geist": "^5.2.8",
|
"@fontsource-variable/geist": "^5.2.8",
|
||||||
"@shikijs/rehype": "^3.13.0",
|
"@shikijs/rehype": "^3.13.0",
|
||||||
|
"@shikijs/transformers": "^3.13.0",
|
||||||
"@sveltejs/adapter-static": "^3.0.10",
|
"@sveltejs/adapter-static": "^3.0.10",
|
||||||
"@sveltejs/kit": "^2.43.2",
|
"@sveltejs/kit": "^2.43.2",
|
||||||
"@sveltejs/vite-plugin-svelte": "^6.2.0",
|
"@sveltejs/vite-plugin-svelte": "^6.2.0",
|
||||||
@@ -977,6 +978,17 @@
|
|||||||
"@shikijs/types": "3.13.0"
|
"@shikijs/types": "3.13.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/@shikijs/transformers": {
|
||||||
|
"version": "3.13.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/@shikijs/transformers/-/transformers-3.13.0.tgz",
|
||||||
|
"integrity": "sha512-833lcuVzcRiG+fXvgslWsM2f4gHpjEgui1ipIknSizRuTgMkNZupiXE5/TVJ6eSYfhNBFhBZKkReKWO2GgYmqA==",
|
||||||
|
"dev": true,
|
||||||
|
"license": "MIT",
|
||||||
|
"dependencies": {
|
||||||
|
"@shikijs/core": "3.13.0",
|
||||||
|
"@shikijs/types": "3.13.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/@shikijs/types": {
|
"node_modules/@shikijs/types": {
|
||||||
"version": "3.13.0",
|
"version": "3.13.0",
|
||||||
"resolved": "https://registry.npmjs.org/@shikijs/types/-/types-3.13.0.tgz",
|
"resolved": "https://registry.npmjs.org/@shikijs/types/-/types-3.13.0.tgz",
|
||||||
|
|||||||
@@ -16,6 +16,7 @@
|
|||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@fontsource-variable/geist": "^5.2.8",
|
"@fontsource-variable/geist": "^5.2.8",
|
||||||
"@shikijs/rehype": "^3.13.0",
|
"@shikijs/rehype": "^3.13.0",
|
||||||
|
"@shikijs/transformers": "^3.13.0",
|
||||||
"@sveltejs/adapter-static": "^3.0.10",
|
"@sveltejs/adapter-static": "^3.0.10",
|
||||||
"@sveltejs/kit": "^2.43.2",
|
"@sveltejs/kit": "^2.43.2",
|
||||||
"@sveltejs/vite-plugin-svelte": "^6.2.0",
|
"@sveltejs/vite-plugin-svelte": "^6.2.0",
|
||||||
|
|||||||
@@ -10,11 +10,21 @@
|
|||||||
|
|
||||||
<style>
|
<style>
|
||||||
:global {
|
:global {
|
||||||
|
|
||||||
|
.shiki code {
|
||||||
|
display: block;
|
||||||
|
}
|
||||||
|
.shiki .line {
|
||||||
|
width: 100%;
|
||||||
|
display: inline-block;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* line number */
|
||||||
.shiki code {
|
.shiki code {
|
||||||
counter-reset: step;
|
counter-reset: step;
|
||||||
counter-increment: step 0;
|
counter-increment: step 0;
|
||||||
}
|
}
|
||||||
.line::before {
|
.shiki .line::before {
|
||||||
content: counter(step);
|
content: counter(step);
|
||||||
counter-increment: step;
|
counter-increment: step;
|
||||||
width: 1rem;
|
width: 1rem;
|
||||||
@@ -23,5 +33,38 @@
|
|||||||
text-align: right;
|
text-align: right;
|
||||||
color: rgba(115,138,148,.4);
|
color: rgba(115,138,148,.4);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* indent guides */
|
||||||
|
.shiki .indent {
|
||||||
|
display: inline-block;
|
||||||
|
position: relative;
|
||||||
|
left: var(--indent-offset);
|
||||||
|
}
|
||||||
|
|
||||||
|
.shiki .indent:empty {
|
||||||
|
height: 1lh;
|
||||||
|
vertical-align: bottom;
|
||||||
|
}
|
||||||
|
|
||||||
|
.shiki .indent::before {
|
||||||
|
content: '';
|
||||||
|
position: absolute;
|
||||||
|
opacity: 0.15;
|
||||||
|
width: 1px;
|
||||||
|
height: 100%;
|
||||||
|
background-color: currentColor;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* diff */
|
||||||
|
.shiki .line.diff.remove {
|
||||||
|
background-color: #db0a0a41;
|
||||||
|
}
|
||||||
|
.shiki .line.diff.add {
|
||||||
|
background-color: #0adb4954;
|
||||||
|
}
|
||||||
|
.shiki .line.highlighted {
|
||||||
|
background-color: #00000024;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
import { error } from "@sveltejs/kit";
|
import { error } from "@sveltejs/kit";
|
||||||
import type { Component } from "svelte";
|
|
||||||
|
|
||||||
const articles = import.meta.glob<{
|
const articles = import.meta.glob<{
|
||||||
default: string;
|
default: string;
|
||||||
|
|||||||
@@ -16,4 +16,34 @@ const abc = 1 + "2";
|
|||||||
|
|
||||||
## Step Bar
|
## Step Bar
|
||||||
|
|
||||||
|
```nix {1,18-21}
|
||||||
|
inventory.instances = {
|
||||||
|
dyndns = {
|
||||||
|
roles.default.machines."jon" = { }; # [!code --]
|
||||||
|
roles.default.settings = { # [!code ++]
|
||||||
|
period = 15; # minutes
|
||||||
|
settings = {
|
||||||
|
"all-jon-blog" = {
|
||||||
|
provider = "porkbun";
|
||||||
|
domain = "jon.blog";
|
||||||
|
|
||||||
|
# (1) tell the secret-manager which key we are going to store
|
||||||
|
secret_field_name = "secret_api_key";
|
||||||
|
|
||||||
|
# everything below is copied verbatim into config.json
|
||||||
|
extraSettings = {
|
||||||
|
host = "@,home,test"; # (2) comma-separated list of sub-domains [!code highlight]
|
||||||
|
ip_version = "ipv4";
|
||||||
|
ipv6_suffix = "";
|
||||||
|
api_key = "pk1_4bb2b231275a02fdc23b7e6f3552s01S213S"; # (3) public – safe to commit
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
```
|
||||||
|
|
||||||
|
## Step Foo
|
||||||
|
|
||||||
## Step Bar
|
## Step Bar
|
||||||
|
|||||||
@@ -2,4 +2,4 @@
|
|||||||
|
|
||||||
body {
|
body {
|
||||||
font-family: "Geist Variable";
|
font-family: "Geist Variable";
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,6 +11,12 @@ import rehypeSlug from "rehype-slug";
|
|||||||
import rehypeAutolinkHeadings from "rehype-autolink-headings";
|
import rehypeAutolinkHeadings from "rehype-autolink-headings";
|
||||||
import { toc } from "mdast-util-toc";
|
import { toc } from "mdast-util-toc";
|
||||||
import type { Nodes } from "mdast";
|
import type { Nodes } from "mdast";
|
||||||
|
import {
|
||||||
|
transformerNotationDiff,
|
||||||
|
transformerNotationHighlight,
|
||||||
|
transformerRenderIndentGuides,
|
||||||
|
transformerMetaHighlight,
|
||||||
|
} from "@shikijs/transformers";
|
||||||
|
|
||||||
export default defineConfig({
|
export default defineConfig({
|
||||||
plugins: [
|
plugins: [
|
||||||
@@ -31,6 +37,14 @@ export default defineConfig({
|
|||||||
light: "vitesse-light",
|
light: "vitesse-light",
|
||||||
dark: "vitesse-dark",
|
dark: "vitesse-dark",
|
||||||
},
|
},
|
||||||
|
transformers: [
|
||||||
|
transformerNotationDiff({
|
||||||
|
matchAlgorithm: "v3",
|
||||||
|
}),
|
||||||
|
transformerNotationHighlight(),
|
||||||
|
transformerRenderIndentGuides(),
|
||||||
|
transformerMetaHighlight(),
|
||||||
|
],
|
||||||
})
|
})
|
||||||
.use(rehypeStringify)
|
.use(rehypeStringify)
|
||||||
.use(rehypeSlug)
|
.use(rehypeSlug)
|
||||||
|
|||||||
Reference in New Issue
Block a user