diff --git a/.editorconfig b/.editorconfig index 59595ecf..8272d5ac 100644 --- a/.editorconfig +++ b/.editorconfig @@ -40,6 +40,6 @@ indent_style = space indent_size = 2 [**.astro] -indent_size = 4 +indent_size = 2 indent_style = tab end_of_line = lf diff --git a/docs/src/pages/glossary.astro b/docs/src/pages/glossary.astro index ee32b31a..5b71cda1 100644 --- a/docs/src/pages/glossary.astro +++ b/docs/src/pages/glossary.astro @@ -1,58 +1,58 @@ ---- -import StarlightPage from "@astrojs/starlight/components/StarlightPage.astro"; - -import fs from "fs"; -import path from "path"; - -// Directory containing the files -const dir = "src/content/docs/glossary"; - -// Read the directory and get an array of filenames -const filenames = fs.readdirSync(dir); - -// Map over the filenames and read each file's content and metadata -const files = filenames.map((filename) => { - const filePath = path.join(dir, filename); - const content = fs.readFileSync(filePath, "utf-8"); - const title = path.basename(filename, path.extname(filename)); - return { title, content }; -}); - -// Sort the files alphabetically by title -files.sort((a, b) => a.title.localeCompare(b.title)); - -// Group the files by the first letter of their title -const sections = files.reduce((acc: { [key: string]: any[] }, file) => { - const firstLetter = file.title.charAt(0).toUpperCase(); - if (!acc[firstLetter]) { - acc[firstLetter] = []; - } - acc[firstLetter].push(file); - return acc; -}, {}); - -const headings = Object.entries(sections).map((section: [string, any]) => ({ - depth: 2, - slug: section[0], - text: section[0], -})); ---- - - - { - Object.entries(sections).map((section: [string, any]) => ( - <> -

{section[0]}

- - - )) - } -
+--- +import StarlightPage from "@astrojs/starlight/components/StarlightPage.astro"; + +import fs from "fs"; +import path from "path"; + +// Directory containing the files +const dir = "src/content/docs/glossary"; + +// Read the directory and get an array of filenames +const filenames = fs.readdirSync(dir); + +// Map over the filenames and read each file's content and metadata +const files = filenames.map((filename) => { + const filePath = path.join(dir, filename); + const content = fs.readFileSync(filePath, "utf-8"); + const title = path.basename(filename, path.extname(filename)); + return { title, content }; +}); + +// Sort the files alphabetically by title +files.sort((a, b) => a.title.localeCompare(b.title)); + +// Group the files by the first letter of their title +const sections = files.reduce((acc: { [key: string]: any[] }, file) => { + const firstLetter = file.title.charAt(0).toUpperCase(); + if (!acc[firstLetter]) { + acc[firstLetter] = []; + } + acc[firstLetter].push(file); + return acc; +}, {}); + +const headings = Object.entries(sections).map((section: [string, any]) => ({ + depth: 2, + slug: section[0], + text: section[0], +})); +--- + + + { + Object.entries(sections).map((section: [string, any]) => ( + <> +

{section[0]}

+ + + )) + } +