mirror of
https://github.com/youwen5/site.git
synced 2024-11-28 10:53:50 -08:00
feat: add .blogignore and more formatting
This commit is contained in:
parent
373d2d165b
commit
70b0031c10
6 changed files with 154 additions and 21 deletions
0
blog/2024/taylor-series/.blogignore
Normal file
0
blog/2024/taylor-series/.blogignore
Normal file
|
@ -144,10 +144,16 @@ $$
|
||||||
The worst case scenario is $z=1$.
|
The worst case scenario is $z=1$.
|
||||||
If $\displaystyle\frac{e}{(n+1)!} \le \frac{1}{1000000}$, we're all set.
|
If $\displaystyle\frac{e}{(n+1)!} \le \frac{1}{1000000}$, we're all set.
|
||||||
|
|
||||||
|
![Test image](https://upload.wikimedia.org/wikipedia/commons/thumb/6/66/SMPTE_Color_Bars.svg/1200px-SMPTE_Color_Bars.svg.png)
|
||||||
|
|
||||||
Assume that $e \le 3$, which implies that if $\displaystyle\frac{3}{(n+1)!} \le \frac{1}{1000000}$, we're all set.
|
Assume that $e \le 3$, which implies that if $\displaystyle\frac{3}{(n+1)!} \le \frac{1}{1000000}$, we're all set.
|
||||||
After trying terms, we find that $n=9$ works.
|
After trying terms, we find that $n=9$ works.
|
||||||
So $P_9(1) = 1 + 1 + \frac{1}{2!} + \frac{1}{3!} + \dots + \frac{1}{9!}$ is within $\frac{1}{1000000}$ of $e$.
|
So $P_9(1) = 1 + 1 + \frac{1}{2!} + \frac{1}{3!} + \dots + \frac{1}{9!}$ is within $\frac{1}{1000000}$ of $e$.
|
||||||
|
|
||||||
```rust
|
```rust
|
||||||
let mut var: u32 = 10030;
|
let mut var: u32 = 10030;
|
||||||
|
|
||||||
|
fn takes_var(var: &mut u32) {
|
||||||
|
var += 1;
|
||||||
|
}
|
||||||
```
|
```
|
||||||
|
|
|
@ -1,3 +1,125 @@
|
||||||
## This is some test content
|
## Introduction
|
||||||
|
|
||||||
Whatever gets written here will be rendered statically!
|
Welcome! This blog is powered by a custom static site generator I made using SvelteKit. I'm working on upgrades ([see: lorelei](https://github.com/couscousdude/lorelei)), but in the meantime, check this out:
|
||||||
|
|
||||||
|
> [!NOTE]
|
||||||
|
> GitHub-style notifications!
|
||||||
|
|
||||||
|
> [!TIP]
|
||||||
|
> The full Commonmark spec is supported, and it's extended by the GFM spec
|
||||||
|
|
||||||
|
## Tables!
|
||||||
|
|
||||||
|
| First Header | Second Header |
|
||||||
|
| ------------ | ------------- |
|
||||||
|
| Content Cell | Content Cell |
|
||||||
|
| Content Cell | Content Cell |
|
||||||
|
|
||||||
|
## More stuff!
|
||||||
|
|
||||||
|
Notice the table of contents generated on the right (on desktop) or under the navbar (on mobile). It's auto-populated at build time from the content on the page.
|
||||||
|
|
||||||
|
### Math
|
||||||
|
|
||||||
|
Math is powered by $\KaTeX$, either inline, or in display mode:
|
||||||
|
|
||||||
|
$$
|
||||||
|
\int^\infty_{-\infty} e^{-x^2}\, dx = \sqrt{\tau / 2}
|
||||||
|
$$
|
||||||
|
|
||||||
|
## Post metadata
|
||||||
|
|
||||||
|
Additional metadata is attached to each post via a `TOML` file, the Rustacean way. Here's a sample:
|
||||||
|
|
||||||
|
```toml
|
||||||
|
#:schema ../../../post.schema.json
|
||||||
|
title = "Test Post"
|
||||||
|
|
||||||
|
[manifest]
|
||||||
|
date = 2024-04-12T20:48:40.799Z
|
||||||
|
authors = ["Youwen Wu"]
|
||||||
|
blurb = "A display of all the blog's rendering capabilities!"
|
||||||
|
description = "A blog post to test all of the rendering capabilities, with remarks on the side."
|
||||||
|
type = "article"
|
||||||
|
highlight = true
|
||||||
|
|
||||||
|
[manifest.tags]
|
||||||
|
primary = ["test", "first post", "formatting"]
|
||||||
|
secondary = ["blog", "placeholder"]
|
||||||
|
|
||||||
|
[cover]
|
||||||
|
src = "https://images.unsplash.com/photo-1712230879699-e8a0a389da63?q=80&w=3132&auto=format&fit=crop&ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D"
|
||||||
|
alt = "A beautiful landscape"
|
||||||
|
caption = "This is the first post!"
|
||||||
|
```
|
||||||
|
|
||||||
|
Code highlighting is also supported, via `highlight.js`.
|
||||||
|
|
||||||
|
The `unified` plugin ecosystem is used to transform markdown into the HTML in this document. Check out the parser [here](https://github.com/couscousdude/coredump/blob/main/src/lib/utils/parseMarkdown.ts). It handles all the parsing server-side at build time, so these posts are a collection of mostly static HTML. The formatting is done mostly with a [custom stylesheet](https://github.com/couscousdude/coredump/blob/main/src/lib/styles/markdown.pcss).
|
||||||
|
|
||||||
|
## Raw source code of this post
|
||||||
|
|
||||||
|
````markdown
|
||||||
|
## Introduction
|
||||||
|
|
||||||
|
Welcome! This blog is powered by a custom static site generator I made using SvelteKit. I'm working on upgrades ([see: lorelei](https://github.com/couscousdude/lorelei)), but in the meantime, check this out:
|
||||||
|
|
||||||
|
> [!NOTE]
|
||||||
|
> GitHub-style notifications!
|
||||||
|
|
||||||
|
> [!TIP]
|
||||||
|
> The full Commonmark spec is supported, and it's extended by the GFM spec
|
||||||
|
|
||||||
|
## Tables!
|
||||||
|
|
||||||
|
| First Header | Second Header |
|
||||||
|
| ------------ | ------------- |
|
||||||
|
| Content Cell | Content Cell |
|
||||||
|
| Content Cell | Content Cell |
|
||||||
|
|
||||||
|
## More stuff!
|
||||||
|
|
||||||
|
Notice the table of contents generated on the right (on desktop) or under the navbar (on mobile). It's auto-populated at build time from the content on the page.
|
||||||
|
|
||||||
|
### Math
|
||||||
|
|
||||||
|
Math is powered by $\KaTeX$, either inline, or in display mode:
|
||||||
|
|
||||||
|
$$
|
||||||
|
\int^\infty_{-\infty} e^{-x^2}\, dx = \sqrt{\frac{\tau}{2}}
|
||||||
|
$$
|
||||||
|
|
||||||
|
## Post metadata
|
||||||
|
|
||||||
|
Additional metadata is attached to each post via a `TOML` file, the Rustacean way. Here's a sample:
|
||||||
|
|
||||||
|
```toml
|
||||||
|
#:schema ../../../post.schema.json
|
||||||
|
title = "Test Post"
|
||||||
|
|
||||||
|
[manifest]
|
||||||
|
date = 2024-04-12T20:48:40.799Z
|
||||||
|
authors = ["Youwen Wu"]
|
||||||
|
blurb = "A display of all the blog's rendering capabilities!"
|
||||||
|
description = "A blog post to test all of the rendering capabilities, with remarks on the side."
|
||||||
|
type = "article"
|
||||||
|
highlight = true
|
||||||
|
|
||||||
|
[manifest.tags]
|
||||||
|
primary = ["test", "first post", "formatting"]
|
||||||
|
secondary = ["blog", "placeholder"]
|
||||||
|
|
||||||
|
[cover]
|
||||||
|
src = "https://images.unsplash.com/photo-1712230879699-e8a0a389da63?q=80&w=3132&auto=format&fit=crop&ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D"
|
||||||
|
alt = "A beautiful landscape"
|
||||||
|
caption = "This is the first post!"
|
||||||
|
```
|
||||||
|
````
|
||||||
|
|
||||||
|
Code highlighting is also supported, via `highlight.js`.
|
||||||
|
|
||||||
|
The `unified` plugin ecosystem is used to transform markdown into the HTML in this document. Check out the parser [here](https://github.com/couscousdude/coredump/blob/main/src/lib/utils/parseMarkdown.ts). It handles all the parsing server-side at build time, so these posts are a collection of mostly static HTML. The formatting is done mostly with a [custom stylesheet](https://github.com/couscousdude/coredump/blob/main/src/lib/styles/markdown.pcss).
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
|
```
|
||||||
|
|
|
@ -1,19 +1,19 @@
|
||||||
#:schema ../../../post.schema.json
|
#:schema ../../../post.schema.json
|
||||||
title = "My Awesome Blog Post"
|
title = "Test Post"
|
||||||
|
|
||||||
[manifest]
|
[manifest]
|
||||||
date = 2024-04-12T20:48:40.799Z
|
date = 2024-04-12T20:48:40.799Z
|
||||||
authors = ["Youwen Wu"]
|
authors = ["Youwen Wu"]
|
||||||
blurb = "A blog post about Rust and WebAssembly"
|
blurb = "A display of all the blog's rendering capabilities!"
|
||||||
description = "A blog post about Rust and WebAssembly, and how to use it in web development. This post will cover the basics of Rust and WebAssembly, and how to use it in web development. We will also discuss the benefits of using Rust and WebAssembly, and how it can help you build faster and more efficient web applications."
|
description = "A blog post to test all of the rendering capabilities, with remarks on the side."
|
||||||
type = "article"
|
type = "article"
|
||||||
highlight = false
|
highlight = true
|
||||||
|
|
||||||
[manifest.tags]
|
[manifest.tags]
|
||||||
primary = ["Rust", "WebAssembly"]
|
primary = ["test", "first post", "formatting"]
|
||||||
secondary = ["Web Development", "Frontend"]
|
secondary = ["blog", "placeholder"]
|
||||||
|
|
||||||
[cover]
|
[cover]
|
||||||
src = "https://machinelearningmastery.com/wp-content/uploads/2021/07/tayloreq6.png"
|
src = "https://images.unsplash.com/photo-1712230879699-e8a0a389da63?q=80&w=3132&auto=format&fit=crop&ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D"
|
||||||
alt = "A Rust and WebAssembly logo"
|
alt = "A beautiful landscape"
|
||||||
caption = "Rust and WebAssembly"
|
caption = "This is the first post! (image courtesy of unsplash)"
|
||||||
|
|
|
@ -30,6 +30,10 @@
|
||||||
margin: 0;
|
margin: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
a {
|
||||||
|
@apply text-blue-500 dark:text-blue-600 hover:underline;
|
||||||
|
}
|
||||||
|
|
||||||
dl {
|
dl {
|
||||||
font-family: monospace;
|
font-family: monospace;
|
||||||
}
|
}
|
||||||
|
@ -41,14 +45,11 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
img {
|
img {
|
||||||
max-width: 100%;
|
@apply max-w-[80%] mx-auto my-8 rounded-xl shadow-lg;
|
||||||
display: block;
|
|
||||||
margin: 0 auto;
|
|
||||||
padding: 0.5em;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
blockquote:not(.markdown-alert) {
|
blockquote:not(.markdown-alert) {
|
||||||
@apply border-l-2 border-l-muted-foreground my-4 pl-4 italic;
|
@apply border-l-4 border-l-muted-foreground my-4 pl-4 italic mx-4;
|
||||||
}
|
}
|
||||||
|
|
||||||
table {
|
table {
|
||||||
|
@ -82,13 +83,11 @@
|
||||||
table,
|
table,
|
||||||
.highlight > pre,
|
.highlight > pre,
|
||||||
pre.example {
|
pre.example {
|
||||||
|
@apply p-4 border-2 border-primary/10 font-sans;
|
||||||
max-height: 70vh;
|
max-height: 70vh;
|
||||||
margin: 1em 0;
|
margin: 1em 0;
|
||||||
padding: 1em;
|
|
||||||
overflow: auto;
|
overflow: auto;
|
||||||
font-size: 0.85rem;
|
font-size: 0.85rem;
|
||||||
font-family: monospace;
|
|
||||||
border: 1px dashed rgba(250, 100, 50, 0.5);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
figure {
|
figure {
|
||||||
|
@ -103,7 +102,7 @@
|
||||||
|
|
||||||
/* KaTeX formatting */
|
/* KaTeX formatting */
|
||||||
.katex-display {
|
.katex-display {
|
||||||
@apply max-w-4xl overflow-x-auto overflow-y-hidden;
|
@apply max-w-3xl overflow-x-auto overflow-y-hidden;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Markdown Alert formatting */
|
/* Markdown Alert formatting */
|
||||||
|
@ -162,6 +161,6 @@
|
||||||
height: 1em;
|
height: 1em;
|
||||||
}
|
}
|
||||||
.hljs {
|
.hljs {
|
||||||
@apply mx-2 my-4 rounded-xl shadow-lg;
|
@apply my-4 rounded-xl shadow-lg max-w-3xl overflow-x-auto;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,6 +19,12 @@ const crawl = async () => {
|
||||||
|
|
||||||
for (const directory of directories) {
|
for (const directory of directories) {
|
||||||
const postPath = join(yearPath, directory);
|
const postPath = join(yearPath, directory);
|
||||||
|
try {
|
||||||
|
await readFile(join(postPath, '.blogignore'), 'utf-8');
|
||||||
|
continue;
|
||||||
|
} catch (error) {
|
||||||
|
// If the file doesn't exist, continue with the rest of the code
|
||||||
|
}
|
||||||
const postTomlPath = join(postPath, 'post.toml');
|
const postTomlPath = join(postPath, 'post.toml');
|
||||||
const contentPath = join(postPath, 'content.md');
|
const contentPath = join(postPath, 'content.md');
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue