This commit is contained in:
Michael Zhang 2024-05-29 13:33:23 -05:00
parent 22a8c36fff
commit d85b7f729f
8 changed files with 4462 additions and 3482 deletions

View file

@ -36,6 +36,7 @@
"remark-parse": "^10.0.2" "remark-parse": "^10.0.2"
}, },
"devDependencies": { "devDependencies": {
"@biomejs/biome": "^1.7.3",
"@types/lodash-es": "^4.17.9", "@types/lodash-es": "^4.17.9",
"date-fns": "^2.30.0", "date-fns": "^2.30.0",
"hast-util-from-html": "^2.0.1", "hast-util-from-html": "^2.0.1",

File diff suppressed because it is too large Load diff

View file

@ -11,6 +11,7 @@ interface Props {
filteredPosts?: Post[]; filteredPosts?: Post[];
class?: string | undefined; class?: string | undefined;
timeFormat?: string | undefined; timeFormat?: string | undefined;
collection?: string;
} }
type Post = CollectionEntry<"posts">; type Post = CollectionEntry<"posts">;
@ -20,6 +21,7 @@ const {
drafts: includeDrafts, drafts: includeDrafts,
filteredPosts, filteredPosts,
timeFormat, timeFormat,
collection,
} = Astro.props; } = Astro.props;
type FilterFn = (_: Post) => boolean; type FilterFn = (_: Post) => boolean;
@ -44,7 +46,7 @@ function getFilter(): FilterFn {
const filter = getFilter(); const filter = getFilter();
let allPosts; let allPosts;
if (filteredPosts) allPosts = filteredPosts.filter(filter); if (filteredPosts) allPosts = filteredPosts.filter(filter);
else allPosts = await getCollection("posts", filter); else allPosts = await getCollection(collection ?? "posts", filter);
const sortedPosts = sortBy(allPosts, (post) => -post.data.date); const sortedPosts = sortBy(allPosts, (post) => -post.data.date);
--- ---

View file

@ -9,5 +9,5 @@ import { format } from "date-fns";
--- ---
<span class="timestamp" title={timestamp.toISOString()}> <span class="timestamp" title={timestamp.toISOString()}>
{format(timestamp, customFormat ?? "yyyy MMM d")} {format(timestamp, customFormat ?? "yyyy MMM dd")}
</span> </span>

View file

@ -24,7 +24,7 @@ const posts = defineCollection({
heroImage: image().optional(), heroImage: image().optional(),
heroAlt: z.string().optional(), heroAlt: z.string().optional(),
tags: z.array(z.string()), tags: z.array(z.string()).default([]),
draft: z.boolean().default(false), draft: z.boolean().default(false),
math: z.boolean().default(false), math: z.boolean().default(false),
toc: z.boolean().default(false), toc: z.boolean().default(false),

View file

@ -1,4 +1,4 @@
I'm a computer science master's student at the [University of Minnesota][1] I'm a computer science master's student at the [University of Minnesota][1],
advised by [Favonia]. I've previously worked as a software engineer at [Swoop advised by [Favonia]. I've previously worked as a software engineer at [Swoop
Search], [AWS] and [SIFT] in the past. My computing-related interests lie in Search], [AWS] and [SIFT] in the past. My computing-related interests lie in
programming language design and formal verification, systems security, programming language design and formal verification, systems security,

View file

@ -36,7 +36,7 @@ I'm going to implement this using [Deno].
[deno]: https://deno.land/ [deno]: https://deno.land/
> **&#x1f4a1; This is a literate document.** I wrote a [small utility][3] to > **:bulb: This is a literate document.** I wrote a [small utility][3] to
> extract the code blocks out of markdown files, and it should produce working > extract the code blocks out of markdown files, and it should produce working
> example for this file. If you have the utility, then running the following > example for this file. If you have the utility, then running the following
> should get you a copy of all the code extracted from this blog post: > should get you a copy of all the code extracted from this blog post:

View file

@ -128,7 +128,7 @@
z-index: 2; z-index: 2;
} }
&[open] summary { &[open]>summary {
border-bottom: 1px dotted var(--hr-color); border-bottom: 1px dotted var(--hr-color);
margin-bottom: 15px; margin-bottom: 15px;
} }