-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
19 changed files
with
1,477 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,13 @@ | ||
import cloudflare from "@astrojs/cloudflare"; | ||
import mdx from "@astrojs/mdx"; | ||
import solidJs from "@astrojs/solid-js"; | ||
import tailwind from "@astrojs/tailwind"; | ||
import icon from "astro-icon"; | ||
import { defineConfig } from "astro/config"; | ||
|
||
// https://astro.build/config | ||
export default defineConfig({ | ||
integrations: [solidJs(), tailwind(), icon()], | ||
integrations: [mdx(), solidJs(), tailwind(), icon()], | ||
output: "hybrid", | ||
adapter: cloudflare(), | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,6 +17,7 @@ | |
}, | ||
"dependencies": { | ||
"@astrojs/cloudflare": "^11.0.4", | ||
"@astrojs/mdx": "^3.1.9", | ||
"@astrojs/solid-js": "^4.4.0", | ||
"astro": "^4.13.2", | ||
"astro-icon": "^1.1.0", | ||
|
@@ -27,6 +28,7 @@ | |
"@astrojs/check": "^0.9.2", | ||
"@astrojs/tailwind": "^5.1.0", | ||
"@biomejs/biome": "^1.8.3", | ||
"@tailwindcss/typography": "^0.5.15", | ||
"typescript": "^5.5.4" | ||
}, | ||
"packageManager": "[email protected]" | ||
|
Large diffs are not rendered by default.
Oops, something went wrong.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
--- | ||
import type { MarkdownHeading } from "astro"; | ||
type Props = { | ||
headings: MarkdownHeading[]; | ||
// The depth of the headings to display. | ||
depth: number; | ||
class?: string; | ||
}; | ||
const props = Astro.props; | ||
type TocHeading = MarkdownHeading & { | ||
subHeadings: MarkdownHeading[]; | ||
}; | ||
/** | ||
Format headings into a nested structure. Note it works correctly only for depth 2 and 3. | ||
*/ | ||
function formatHeadings({ | ||
headings, | ||
depth, | ||
}: { headings: MarkdownHeading[]; depth: number }): TocHeading[] | undefined { | ||
const toc: TocHeading[] = []; | ||
for (const heading of headings) { | ||
if (depth < heading.depth) return; | ||
if (heading.depth === 2) { | ||
toc.push({ ...heading, subHeadings: [] }); | ||
return; | ||
} | ||
toc[toc.length - 1].subHeadings.push(heading); | ||
} | ||
return toc; | ||
} | ||
const headings = formatHeadings({ | ||
headings: props.headings, | ||
depth: props.depth, | ||
}); | ||
--- | ||
|
||
<aside class:list={["font-nunito", props.class]}> | ||
<ul class="w-56 list-none"> | ||
{ | ||
headings?.map((heading) => ( | ||
<li> | ||
<a | ||
href={`#${heading.slug}`} | ||
class="w-full text-sm text-gray-300 no-underline hover:text-indigo-500" | ||
> | ||
{heading.text} | ||
</a> | ||
{heading.subHeadings.length > 0 ? ( | ||
<ul class="flex list-none flex-col space-y-1"> | ||
{heading.subHeadings.map((subHeading: MarkdownHeading) => ( | ||
<a | ||
href={`#${subHeading.slug}`} | ||
class="w-full pl-6 text-sm text-gray-300 no-underline hover:text-indigo-500" | ||
> | ||
{subHeading.text} | ||
</a> | ||
))} | ||
</ul> | ||
) : null} | ||
</li> | ||
)) | ||
} | ||
</ul> | ||
</aside> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
// @ts-expect-error - Ignore missing types when the project has not been built e.g. CI environment | ||
Check failure on line 1 in src/content/config.ts GitHub Actions / build (22)
|
||
import { defineCollection, z } from "astro:content"; | ||
|
||
const posts = defineCollection({ | ||
type: "content", | ||
schema: z.object({ | ||
title: z.string(), | ||
description: z.string(), | ||
author: z.literal("Roushou"), | ||
date: z.date(), | ||
draft: z.boolean(), | ||
tags: z.array(z.string()), | ||
}), | ||
}); | ||
|
||
export const collections = { | ||
posts, | ||
}; |
Oops, something went wrong.