Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
44 commits
Select commit Hold shift + click to select a range
5a259fe
Change the file extension of every Asciidoc file in szmgr to preserve…
cafour Jul 20, 2025
14be274
Setup the docs framework
VojtaStruhar Jun 6, 2025
5c20e0a
Transpiled SZMGR content to markdown
VojtaStruhar Jun 6, 2025
cd88b76
Fix tables
VojtaStruhar Jun 6, 2025
8ed7234
Transform callouts to GH flavor
VojtaStruhar Jun 6, 2025
a2b14f5
Fix links to other SZMGR subjects
VojtaStruhar Jun 6, 2025
a217a6a
Regex fix lt symbols
VojtaStruhar Jun 6, 2025
5628771
Use markdown footnotes
VojtaStruhar Jun 6, 2025
21e85ca
Fix tables manually
VojtaStruhar Jun 7, 2025
7d2a14c
Revert "Use markdown footnotes"
VojtaStruhar Jun 7, 2025
8cf0754
Include dashes in bottom footnotes
VojtaStruhar Jun 7, 2025
2109d10
Replace `stem` with math blocks
VojtaStruhar Jun 7, 2025
a51f056
Replace fancy apostrophe with a normal one
VojtaStruhar Jun 7, 2025
ca54af8
Fix strikethroughs
VojtaStruhar Jun 7, 2025
3c60f15
Fix nested callout
VojtaStruhar Jun 7, 2025
050040f
Print pagebreaks, inline width images
VojtaStruhar Jun 7, 2025
11881eb
Add regula falsi figure
VojtaStruhar Jun 9, 2025
f83b233
Add newton approximation method and binary search
VojtaStruhar Jun 9, 2025
ed76c0b
Align newton method equations
VojtaStruhar Jun 9, 2025
fe754db
Align difference equations
VojtaStruhar Jun 9, 2025
8454b32
[Addition] Neuronky
VojtaStruhar Jun 9, 2025
fcaf11d
Adjust binary search description
VojtaStruhar Jun 9, 2025
00743cf
Remove algo string matching
VojtaStruhar Jun 11, 2025
0dd2027
Notes for graphs and graph algorithms
VojtaStruhar Jun 11, 2025
21eb9ac
Fix capitalization in links
VojtaStruhar Jun 11, 2025
ed2b288
Add bspline image
VojtaStruhar Jun 16, 2025
964685d
Fix design 1 blockquotes
VojtaStruhar Jun 16, 2025
cf2b7b1
Typos
VojtaStruhar Jun 19, 2025
b07bf51
Icons + fortunate brain
VojtaStruhar Jun 19, 2025
2c1421e
Fix table
VojtaStruhar Jun 19, 2025
9e89f8b
Switch from markdown-it to remark and reintroduce alerts
cafour Jul 20, 2025
53b85f6
Add back definition lists
cafour Jul 20, 2025
8e61996
Add smartypants
cafour Jul 22, 2025
a8fc8ce
Reconfigure katex
cafour Jul 22, 2025
f91db10
Reimplement heading anchors
cafour Jul 22, 2025
32ee0f2
Add a workaround for Katex exceptions and disable Smartypants
cafour Jul 23, 2025
81a06cb
Work on a new navigation bar
cafour Aug 1, 2025
3be7c36
Reintroduce shiki for code highlighting
cafour Aug 2, 2025
736ac88
Remove toc from config
cafour Aug 2, 2025
2e13d19
Add more plugins
cafour Aug 3, 2025
28ac22d
Use h1 headings instead of the title field
cafour Aug 3, 2025
bcf50ce
Add ellipses to NavItems
cafour Aug 21, 2025
505feb3
Play around with themes and dark modes
cafour Aug 22, 2025
f8a8ca6
Fix Tailwind's dark mode
cafour Aug 22, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 2 additions & 5 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -1,15 +1,12 @@
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"request": "launch",
"name": "Launch Program",
"name": "Debug",
"type": "node",
"cwd": "${workspaceFolder}",
"runtimeExecutable": "C:\\Users\\Adam\\scoop\\shims\\deno.EXE",
"runtimeExecutable": "deno",
"runtimeArgs": [
"task",
"debug"
Expand Down
80 changes: 43 additions & 37 deletions _components/NavLevel.tsx
Original file line number Diff line number Diff line change
@@ -1,48 +1,54 @@
import { Finder } from "../_plugins/finder.ts";

export interface NavItem {
title?: string;
href?: string;
children?: NavItem[];
title?: string;
href?: string;
children?: NavItem[];
}

export default function NavLevel({
items,
depth,
maxDepth,
finder,
items,
depth,
maxDepth,
finder,
}: {
items?: NavItem[];
depth?: number;
maxDepth?: number;
finder: Finder;
items?: NavItem[];
depth?: number;
maxDepth?: number;
finder: Finder;
}) {
if (items === null || items === undefined) {
return <></>;
}
if (items === null || items === undefined) {
return <></>;
}

if (items.length === 0) {
return <ul></ul>;
}
if (items.length === 0) {
return <ul></ul>;
}

depth ??= 0;
if (maxDepth && depth > maxDepth) {
return <></>;
}
return (
<ul class="nav-level">
{items.map((i) => (
<li class="nav-item">
{i.href ? (
<a class="nav-link" href={i.href}>{i.title ?? finder.find(i.href)?.data.title ?? "Missing"}</a>
) : (
<span class="nav-link">{i.title ?? "Missing"}</span>
)}
{i.children && i.children.length > 0 && (
<NavLevel items={i.children} depth={depth! + 1} maxDepth={maxDepth} finder={finder} />
)}
</li>
))}
</ul>
);
depth ??= 0;
if (maxDepth && depth > maxDepth) {
return <></>;
}
return (
<ul class="nav-level w-full">
{items.map((i) => (
<li class="nav-item w-full">
{i.href
? (
<a class="nav-link block text-ellipsis whitespace-nowrap overflow-hidden" href={i.href}>
{i.title ?? finder.find(i.href)?.data.title ?? "Missing"}
</a>
)
: (
<span class="nav-link block text-ellipsis whitespace-nowrap overflow-hidden">
{i.title ?? "Missing"}
</span>
)}
{i.children && i.children.length > 0 && (
<NavLevel items={i.children} depth={depth! + 1} maxDepth={maxDepth} finder={finder} />
)}
</li>
))}
</ul>
);
}
132 changes: 94 additions & 38 deletions _config.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
import lume from "lume/mod.ts";
import markdown from "lume/plugins/markdown.ts";
import remark from "lume/plugins/remark.ts";
import remarkAlert from "./_plugins/remark-alerts.ts";
import { remarkDefinitionList, defListHastHandlers } from "npm:remark-definition-list";
import remarkTextr from "npm:remark-textr";
import remarkTitle from "./_plugins/remark-title.ts";
import rehypeSlug from "npm:rehype-slug";
import rehypeAutolinkHeadings from "npm:rehype-autolink-headings";
import jsx from "lume/plugins/jsx.ts";
import sass from "lume/plugins/sass.ts";
import postcss from "lume/plugins/postcss.ts";
Expand All @@ -8,49 +14,79 @@ import picture from "lume/plugins/picture.ts";
import katex from "./_plugins/katex.ts";
import metas from "lume/plugins/metas.ts";
import resolveUrls from "lume/plugins/resolve_urls.ts";
import codeHighlight from "./_plugins/shiki.ts";
import shiki from "./_plugins/shiki.ts";
import sitemap from "lume/plugins/sitemap.ts";
import inline from "lume/plugins/inline.ts";
import pagefind from "lume/plugins/pagefind.ts";
import { linkInsideHeader } from "lume_markdown_plugins/toc/anchors.ts";
import toc from "lume_markdown_plugins/toc.ts";
import esbuild from "lume/plugins/esbuild.ts";
import typographicBase from "npm:typographic-base";
import tailwindcss from "lume/plugins/tailwindcss.ts";

import { AsciidoctorEngine, asciidocLoader } from "./_plugins/asciidoc.ts";
import { default as markdownItAlerts } from "npm:markdown-it-github-alerts";
import finder from "./_plugins/finder.ts";
import git from "./_plugins/git.ts";

const site = lume({
dest: "public/",
location: new URL("https://fi.cafour.cz"),
});

site.ignore("readme.md", "contributing.md", "public", "deps.ts", "_plugins");
site.use(markdown({
plugins: [[markdownItAlerts, {
titles: {
"tip": "",
"note": "",
"important": "",
"warning": "",
"caution": ""
},
icons: {
"tip": " ",
"note": " ",
"important": " ",
"warning": " ",
"caution": " "
},
classPrefix: "alert"
}]]
}));
site.use(toc({
tabIndex: false,
// anchor: false,
anchor: linkInsideHeader({
placement: "before"
})
site.use(remark({
remarkPlugins: [
[
remarkAlert,
{
classPrefix: "alert",
icons: {
"TIP": "",
"NOTE": "",
"WARNING": ""
},
titles: {
"TIP": "Tip",
"NOTE": "Poznámka",
"WARNING": "Varování",
"IMPORTANT": "Důležitost",
"CAUTION": "Bacha!"
}
}
],
[remarkDefinitionList],
[
remarkTextr,
{
options: {
locale: "cs"
},
plugins: [
typographicBase
]
}
],
[remarkTitle]
],
rehypePlugins: [
[rehypeSlug],
[
rehypeAutolinkHeadings,
{
content: {
type: "text",
value: "#"
},
properties: {
tabIndex: -1,
class: "header-anchor"
}
}
]
],
rehypeOptions: {
handlers: {
...defListHastHandlers
}
}
}));
site.use(jsx());
site.use(esbuild({
Expand All @@ -64,7 +100,16 @@ site.use(esbuild({
globalName: "fi"
}
}));
site.use(sass());
site.use(sass({
options: {
silenceDeprecations: [
"mixed-decls",
"color-functions",
"global-builtin"
]
}
}));
site.use(tailwindcss());
site.use(postcss());
site.use(metas());
site.use(resolveUrls());
Expand Down Expand Up @@ -102,10 +147,21 @@ site.use(katex({
fleqn: true,
throwOnError: false,
output: "html",
strict: false
strict: false,
delimiters: [
{ left: "$", right: "$", display: false },
{ left: "$$", right: "$$", display: true },
{ left: "\\(", right: "\\)", display: false },
{ left: "\\begin{equation}", right: "\\end{equation}", display: true },
{ left: "\\begin{align}", right: "\\end{align}", display: true },
{ left: "\\begin{alignat}", right: "\\end{alignat}", display: true },
{ left: "\\begin{gather}", right: "\\end{gather}", display: true },
{ left: "\\begin{CD}", right: "\\end{CD}", display: true },
{ left: "\\[", right: "\\]", display: true }
]
}
}));
// .use(await codeHighlight())
site.use(shiki())
site.loadPages([".ad"], { loader: asciidocLoader, engine: new AsciidoctorEngine() })
site.copy("fonts");
site.add("icons");
Expand All @@ -115,13 +171,13 @@ site.add("styles");
site.add([".md", ".ad"]);
site.add([".png", ".jpg", ".jpeg", ".gif", ".svg"])
site.use(finder());
site.use(git());
site.use(pagefind({
indexing: {
rootSelector: "main"
},
ui: {
showSubResults: true
}
showSubResults: true,
autofocus: true,
containerId: "search"
},
}));

export default site;
68 changes: 36 additions & 32 deletions _includes/layouts/base.tsx
Original file line number Diff line number Diff line change
@@ -1,41 +1,45 @@
export interface FrontPageData extends Lume.Data {
styles?: string[];
useNewStyle?: boolean;
styles?: string[];
useNewStyle?: boolean;
}

export default function (
{ title, children, styles, useNewStyle }: FrontPageData,
{ title, children, styles, useNewStyle }: FrontPageData,
) {
return (
// dark theme is not ready yet
<html data-theme="light">
<head>
<meta charSet="utf-8" />
<link rel="icon" sizes="16x16" href="/icons/fi_16.ico" />
<meta name="viewport" content="width=device-width,initial-scale=1.0" />
<meta
name="theme-color"
media="(prefers-color-scheme: light)"
content="#faf2eb"
/>
<meta
name="theme-color"
media="(prefers-color-scheme: dark)"
content="#3a322b"
/>
<title>{title ? `${title} | Poznámky z FI` : "Poznámky z FI"}</title>
const timestamp = Math.floor(Date.now() / 1000);
return (
// dark theme is not ready yet
<html data-theme="light">
<head>
<meta charSet="utf-8" />
<link rel="icon" sizes="16x16" href="/icons/fi_16.ico" />
<meta name="viewport" content="width=device-width,initial-scale=1.0" />
<meta
name="theme-color"
media="(prefers-color-scheme: light)"
content="#faf2eb"
/>
<meta
name="theme-color"
media="(prefers-color-scheme: dark)"
content="#3a322b"
/>
<title>{title ? `${title} | Poznámky z FI` : "Poznámky z FI"}</title>

{!useNewStyle &&
(styles ?? []).map((style) => (
<link href={`/styles/${style}.css`} rel="stylesheet" />
))}
{useNewStyle && <link href="/styles/main.css" rel="stylesheet" />}
{!useNewStyle &&
(styles ?? []).map((style) => <link href={`/styles/${style}.css`} rel="stylesheet" />)}
{useNewStyle && (
<>
<link type="text/css" href={`/styles/tailwind.css?ts=${timestamp}`} rel="stylesheet" />
<link type="text/css" href={`/styles/main.css?ts=${timestamp}`} rel="stylesheet" />
</>
)}

<link href="/katex.css" rel="stylesheet" />
<script type="text/javascript" src="/scripts/main.js" />
</head>
<link href="/katex.css" rel="stylesheet" />
<script type="text/javascript" src="/scripts/main.js" />
</head>

<body className={styles?.join(" ")}>{children}</body>
</html>
);
<body className={styles?.join(" ")}>{children}</body>
</html>
);
}
Loading