Skip to content

Commit c93dfa6

Browse files
authored
Merge branch 'main' into mc-version-1_21_6
2 parents 078f751 + 9641207 commit c93dfa6

32 files changed

Lines changed: 1360 additions & 587 deletions

File tree

bun.lock

Lines changed: 203 additions & 98 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

gen_search_indexes.js

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,6 @@ const matchingFiles = fileGlob.scan("./src/routes");
1919

2020
// read all routes
2121
for await (const file of matchingFiles) {
22-
// ignore the error page
23-
if (file.includes("+error.svx")) {
24-
log.warn("Skipping error page");
25-
continue;
26-
}
2722

2823
log.info("Transforming", file);
2924
const rawContent = await defineFile(`./src/routes/${file}`).text();
@@ -35,8 +30,9 @@ for await (const file of matchingFiles) {
3530
// add to posts
3631
const contentNoHtml = stripHtml(frontmatter.content).result;
3732
const strippedMarkdown = RemoveMarkdown(contentNoHtml)
38-
.replace(/:::.*/, "")
39-
.replace(/:::/, "") // remove admonitions
33+
.replaceAll(/:::.*/g, "")
34+
.replaceAll(/:::/g, "") // remove admonitions
35+
.replaceAll(/[^\S\r\n]{2,}/g, ""); // remove extra spaces
4036

4137
const tags = frontmatter.data.tags || "";
4238

gen_search_indexes_node.js

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
// Compatibility for Node.js
2+
// Use the Bun script if you are using Bun
3+
14
import { createConsola } from "consola";
25
import fg from "fast-glob";
36
import matter from "gray-matter";
@@ -16,12 +19,6 @@ const matchingFiles = fg.stream("**/+page.svx", { dot: true });
1619

1720
// read all routes
1821
for await (const file of matchingFiles) {
19-
// ignore the error page
20-
if (file.includes("+error.svx")) {
21-
log.warn("Skipping error page");
22-
continue;
23-
}
24-
2522
const rawContent = await readFile(file);
2623

2724
log.info("Transforming", file);
@@ -32,14 +29,21 @@ for await (const file of matchingFiles) {
3229
// add to posts
3330
const contentNoHtml = stripHtml(frontmatter.content).result;
3431
const strippedMarkdown = RemoveMarkdown(contentNoHtml)
35-
.replace(/:::.*/, "")
36-
.replace(/:::/, "") // remove admonitions
32+
.replaceAll(/:::.*/g, "")
33+
.replaceAll(/:::/g, "") // remove admonitions
34+
.replaceAll(/[^\S\r\n]{2,}/g, ""); // remove extra spaces
3735

36+
const tags = frontmatter.data.tags || "";
3837

3938
posts.push({
4039
title: frontmatter.data.title || "MissingNo.",
4140
content: strippedMarkdown,
41+
description: frontmatter.data.description || null,
4242
url: "/" + filePath,
43+
tags: tags
44+
.split(",")
45+
.map(el => el.trim())
46+
.filter(String),
4347
});
4448
}
4549

0 commit comments

Comments
 (0)