Merge branch 'partial-uwu' into uwu-search-page

# Conflicts:
#	astro.config.ts
#	package-lock.json
#	package.json
#	src/types/plausible.d.ts
#	src/utils/debounce.ts
This commit is contained in:
Corbin Crutchley
2023-07-26 17:44:00 -07:00
145 changed files with 6739 additions and 4249 deletions

View File

@@ -8,29 +8,29 @@ import { visit } from "unist-util-visit";
* Plugin to add `data-header-text`s to headings.
*/
export const rehypeHeaderText = () => {
return (tree: Root, file) => {
visit(tree, "element", (node: Parent["children"][number]) => {
if (
headingRank(node) &&
"properties" in node &&
node.properties &&
!hasProperty(node, "data-header-text")
) {
const headerText = toString(node);
node.properties["data-header-text"] = headerText;
return (tree: Root, file) => {
visit(tree, "element", (node: Parent["children"][number]) => {
if (
headingRank(node) &&
"properties" in node &&
node.properties &&
!hasProperty(node, "data-header-text")
) {
const headerText = toString(node);
node.properties["data-header-text"] = headerText;
const headingWithID = {
value: headerText,
depth: headingRank(node)!,
slug: node.properties["id"] as string,
};
const headingWithID = {
value: headerText,
depth: headingRank(node)!,
slug: node.properties["id"] as string,
};
if (file.data.astro.frontmatter.headingsWithId) {
file.data.astro.frontmatter.headingsWithId.push(headingWithID);
} else {
file.data.astro.frontmatter.headingsWithId = [headingWithID];
}
}
});
};
if (file.data.astro.frontmatter.headingsWithId) {
file.data.astro.frontmatter.headingsWithId.push(headingWithID);
} else {
file.data.astro.frontmatter.headingsWithId = [headingWithID];
}
}
});
};
};