Compare commits

..

No commits in common. "private/skyler/treefmt" and "main" have entirely different histories.

11 changed files with 1541 additions and 1654 deletions

View file

@ -1,16 +1,16 @@
import { defineConfig } from "astro/config";
import { defineConfig } from 'astro/config';
import rehypeSanitize from "rehype-sanitize";
import rehypeStringify from "rehype-stringify";
import rehypeRaw from "rehype-raw";
import remarkParse from "remark-parse";
import remarkRehype from "remark-rehype";
import rehypeSanitize from 'rehype-sanitize';
import rehypeStringify from 'rehype-stringify';
import rehypeRaw from 'rehype-raw';
import remarkParse from 'remark-parse';
import remarkRehype from 'remark-rehype';
// https://astro.build/config
export default defineConfig({
markdown: {
remarkRehype: {
allowDangerousHtml: true,
allowDangerousHtml: true
// This is fine because we are using rehypeSanitize to sanitize XSS.
// See https://github.com/remarkjs/remark-rehype?tab=readme-ov-file#example-supporting-html-in-markdown-properly
},
@ -20,6 +20,6 @@ export default defineConfig({
rehypeRaw,
rehypeSanitize,
rehypeStringify,
],
},
]
}
});

View file

@ -86,28 +86,11 @@
"type": "github"
}
},
"nixpkgs_2": {
"locked": {
"lastModified": 1708475490,
"narHash": "sha256-g1v0TsWBQPX97ziznfJdWhgMyMGtoBFs102xSYO4syU=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "0e74ca98a74bc7270d28838369593635a5db3260",
"type": "github"
},
"original": {
"owner": "nixos",
"ref": "nixos-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"root": {
"inputs": {
"flake-utils": "flake-utils",
"nixpkgs": "nixpkgs",
"snowfall-lib": "snowfall-lib",
"treefmt-nix": "treefmt-nix",
"wiki": "wiki"
}
},
@ -163,24 +146,6 @@
"type": "github"
}
},
"treefmt-nix": {
"inputs": {
"nixpkgs": "nixpkgs_2"
},
"locked": {
"lastModified": 1715940852,
"narHash": "sha256-wJqHMg/K6X3JGAE9YLM0LsuKrKb4XiBeVaoeMNlReZg=",
"owner": "numtide",
"repo": "treefmt-nix",
"rev": "2fba33a182602b9d49f0b2440513e5ee091d838b",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "treefmt-nix",
"type": "github"
}
},
"wiki": {
"flake": false,
"locked": {

View file

@ -12,8 +12,6 @@
flake = false;
};
inputs.treefmt-nix.url = "github:numtide/treefmt-nix";
outputs =
inputs:
inputs.snowfall-lib.mkFlake {
@ -28,14 +26,6 @@
namespace = "auxolotl--docs-site";
};
outputs-builder =
channels:
let
treefmt = inputs.treefmt-nix.lib.evalModule channels.nixpkgs ./treefmt.nix;
in
{
formatter = treefmt.config.build.wrapper;
checks.formatting = treefmt.config.build.check inputs.self;
};
outputs-builder = channels: { formatter = channels.nixpkgs.nixfmt-rfc-style; };
};
}

View file

@ -13,4 +13,4 @@ const { Content } = await post.render();
<div class="contents">
<Content />
</div>s
</div>

File diff suppressed because it is too large Load diff

View file

@ -3,7 +3,7 @@ import { parse, join, sep } from "node:path";
export interface PageLinkData {
id: string;
data: { title: string };
data: { title: string; };
}
type AllPathInformation = Map<string, CollectionEntry<"wiki"> | null>;
@ -16,22 +16,16 @@ export interface Paths {
parentDirectory: PageLinkData | null;
currentPage: PageLinkData;
}
};
export function relativePagePaths(
wikiEntries: PageLinkData[],
currentPath: string,
): Paths {
export function relativePagePaths(wikiEntries: PageLinkData[], currentPath: string): Paths {
let currentPage: PageLinkData | undefined;
let parentDirectory: PageLinkData | undefined | null;
const siblingPages: Map<string, PageLinkData> = new Map();
const childPages: Map<string, PageLinkData> = new Map();
const currentPathParsed = parse(currentPath);
const currentPathExtensionless = join(
currentPathParsed.dir,
currentPathParsed.name,
);
const currentPathExtensionless = join(currentPathParsed.dir, currentPathParsed.name);
const childDirectoryPaths: Set<string> = new Set();
const siblingDirectoryPaths: Set<string> = new Set();
@ -41,7 +35,7 @@ export function relativePagePaths(
const pagePathExtensionless = join(pagePathParsed.dir, pagePathParsed.name);
if (pagePathExtensionless === currentPathExtensionless) {
currentPage = entry;
currentPage = entry
continue;
}
@ -57,14 +51,9 @@ export function relativePagePaths(
continue;
}
const isIndirectChild = pagePathParsed.dir.startsWith(
currentPathExtensionless + sep,
);
const isIndirectChild = pagePathParsed.dir.startsWith(currentPathExtensionless + sep);
if (isIndirectChild) {
const nextPathSeparator = pagePathParsed.dir.indexOf(
sep,
currentPathExtensionless.length + 1,
);
const nextPathSeparator = pagePathParsed.dir.indexOf(sep, currentPathExtensionless.length + 1);
if (nextPathSeparator === -1) {
childDirectoryPaths.add(pagePathParsed.dir);
@ -75,14 +64,9 @@ export function relativePagePaths(
continue;
}
const isIndirectInCurrentDirectory =
currentPathParsed.dir === "" ||
pagePathParsed.dir.startsWith(currentPathParsed.dir + sep);
const isIndirectInCurrentDirectory = currentPathParsed.dir === "" || pagePathParsed.dir.startsWith(currentPathParsed.dir + sep);
if (isIndirectInCurrentDirectory) {
const nextPathSeparator = pagePathParsed.dir.indexOf(
sep,
currentPathParsed.dir.length + 1,
);
const nextPathSeparator = pagePathParsed.dir.indexOf(sep, currentPathParsed.dir.length + 1);
if (nextPathSeparator === -1) {
siblingDirectoryPaths.add(pagePathParsed.dir);
@ -111,7 +95,7 @@ export function relativePagePaths(
const childDirectoryPathParsed = parse(childDirectoryPath);
childDirectories.push({
id: childDirectoryPath,
data: { title: childDirectoryPathParsed.name },
data: { title: childDirectoryPathParsed.name }
});
}
@ -127,14 +111,14 @@ export function relativePagePaths(
const siblingDirectoryPathParsed = parse(siblingDirectoryPath);
siblingDirectories.push({
id: siblingDirectoryPath,
data: { title: siblingDirectoryPathParsed.name },
data: { title: siblingDirectoryPathParsed.name }
});
}
if (currentPage === undefined) {
currentPage = {
id: currentPath,
data: { title: currentPathParsed.name },
data: { title: currentPathParsed.name }
};
}
@ -143,7 +127,7 @@ export function relativePagePaths(
const parentDirectoryPathParsed = parse(currentPathParsed.dir);
parentDirectory = {
id: currentPathParsed.dir,
data: { title: parentDirectoryPathParsed.name },
data: { title: parentDirectoryPathParsed.name }
};
} else {
parentDirectory = null;
@ -159,14 +143,11 @@ export function relativePagePaths(
currentPage,
parentDirectory,
};
}
}
export function allPageAndDirectoryPaths(
wikiEntries: CollectionEntry<"wiki">[],
): AllPathInformation {
const pathInformation: Map<string, CollectionEntry<"wiki"> | null> =
new Map();
export function allPageAndDirectoryPaths(wikiEntries: CollectionEntry<"wiki">[]): AllPathInformation {
const pathInformation: Map<string, CollectionEntry<"wiki"> | null> = new Map();
for (const entry of wikiEntries) {
pathInformation.set(entry.id, entry);

View file

@ -1,28 +0,0 @@
# treefmt.nix
{ pkgs, ... }:
{
# Used to find the project root
projectRootFile = "flake.nix";
# go
programs.gofmt.enable = true;
# js/ts
programs.prettier.enable = true;
# markdown
programs.mdformat.enable = true;
# nix
programs.nixfmt-rfc-style.enable = true;
programs.statix.enable = true;
# python
programs.black.enable = true;
# rust
programs.rustfmt.enable = true;
# swift
programs.swift-format.enable = true;
}