mirror of
https://github.com/youwen5/site.git
synced 2024-11-24 17:33:51 -08:00
chore: use prettierrc.toml and format markdown
This commit is contained in:
parent
79a24a0809
commit
eb93966e5f
8 changed files with 165 additions and 120 deletions
40
.github/workflows/spelling.yml
vendored
40
.github/workflows/spelling.yml
vendored
|
@ -103,24 +103,18 @@ jobs:
|
|||
report-timing: 1
|
||||
warnings: bad-regex,binary-file,deprecated-feature,large-file,limited-references,no-newline-at-eof,noisy-file,non-alpha-in-dictionary,token-is-substring,unexpected-line-ending,whitespace-in-dictionary,minified-file,unsupported-configuration,no-files-to-check
|
||||
experimental_apply_changes_via_bot: 1
|
||||
use_sarif: ${{ (!github.event.pull_request || (github.event.pull_request.head.repo.full_name == github.repository)) && 1 }}
|
||||
use_sarif:
|
||||
${{ (!github.event.pull_request || (github.event.pull_request.head.repo.full_name ==
|
||||
github.repository)) && 1 }}
|
||||
extra_dictionary_limit: 20
|
||||
extra_dictionaries: cspell:software-terms/dict/softwareTerms.txt
|
||||
cspell:html/dict/html.txt
|
||||
cspell:svelte/src/svelte.txt
|
||||
cspell:bash/src/bash-words.txt
|
||||
cspell:lorem-ipsum/dictionary.txt
|
||||
cspell:typescript/dict/typescript.txt
|
||||
cspell:npm/dict/npm.txt
|
||||
cspell:latex/dict/latex.txt
|
||||
cspell:node/dict/node.txt
|
||||
cspell:php/dict/php.txt
|
||||
cspell:golang/dict/go.txt
|
||||
cspell:filetypes/filetypes.txt
|
||||
cspell:fullstack/dict/fullstack.txt
|
||||
cspell:python/src/python/python-lib.txt
|
||||
cspell:aws/aws.txt
|
||||
cspell:css/dict/css.txt
|
||||
extra_dictionaries:
|
||||
cspell:software-terms/dict/softwareTerms.txt cspell:html/dict/html.txt
|
||||
cspell:svelte/src/svelte.txt cspell:bash/src/bash-words.txt
|
||||
cspell:lorem-ipsum/dictionary.txt cspell:typescript/dict/typescript.txt
|
||||
cspell:npm/dict/npm.txt cspell:latex/dict/latex.txt cspell:node/dict/node.txt
|
||||
cspell:php/dict/php.txt cspell:golang/dict/go.txt cspell:filetypes/filetypes.txt
|
||||
cspell:fullstack/dict/fullstack.txt cspell:python/src/python/python-lib.txt
|
||||
cspell:aws/aws.txt cspell:css/dict/css.txt
|
||||
|
||||
comment-push:
|
||||
name: Report (Push)
|
||||
|
@ -146,7 +140,9 @@ jobs:
|
|||
permissions:
|
||||
contents: read
|
||||
pull-requests: write
|
||||
if: (success() || failure()) && needs.spelling.outputs.followup && contains(github.event_name, 'pull_request')
|
||||
if:
|
||||
(success() || failure()) && needs.spelling.outputs.followup && contains(github.event_name,
|
||||
'pull_request')
|
||||
steps:
|
||||
- name: comment
|
||||
uses: check-spelling/check-spelling@main
|
||||
|
@ -163,11 +159,9 @@ jobs:
|
|||
pull-requests: write
|
||||
actions: read
|
||||
runs-on: ubuntu-latest
|
||||
if: ${{
|
||||
github.event_name == 'issue_comment' &&
|
||||
github.event.issue.pull_request &&
|
||||
contains(github.event.comment.body, '@check-spelling-bot apply')
|
||||
}}
|
||||
if:
|
||||
${{ github.event_name == 'issue_comment' && github.event.issue.pull_request &&
|
||||
contains(github.event.comment.body, '@check-spelling-bot apply') }}
|
||||
concurrency:
|
||||
group: spelling-update-${{ github.event.issue.number }}
|
||||
cancel-in-progress: false
|
||||
|
|
|
@ -1,8 +0,0 @@
|
|||
{
|
||||
"useTabs": true,
|
||||
"singleQuote": true,
|
||||
"trailingComma": "none",
|
||||
"printWidth": 100,
|
||||
"plugins": ["prettier-plugin-svelte"],
|
||||
"overrides": [{ "files": "*.svelte", "options": { "parser": "svelte" } }]
|
||||
}
|
7
.prettierrc.toml
Normal file
7
.prettierrc.toml
Normal file
|
@ -0,0 +1,7 @@
|
|||
overrides = [{ "files" = "*.svelte", "options" = { "parser" = "svelte" } }]
|
||||
useTabs = true
|
||||
singleQuote = true
|
||||
trailingComma = "none"
|
||||
printWidth = 100
|
||||
proseWrap = "always"
|
||||
plugins = ["prettier-plugin-svelte"]
|
14
README.md
14
README.md
|
@ -2,7 +2,9 @@
|
|||
|
||||
[![pnpm](https://img.shields.io/badge/maintained%20with-pnpm-cc00ff.svg?style=for-the-badge&logo=pnpm)](https://pnpm.io/)
|
||||
|
||||
My personal website and its associated blog. Written in [SvelteKit](https://kit.svelte.dev) using [TailwindCSS](https://tailwindcss.com/) and components from [shadcn-svelte](https://www.shadcn-svelte.com/).
|
||||
My personal website and its associated blog. Written in [SvelteKit](https://kit.svelte.dev) using
|
||||
[TailwindCSS](https://tailwindcss.com/) and components from
|
||||
[shadcn-svelte](https://www.shadcn-svelte.com/).
|
||||
|
||||
## Running locally
|
||||
|
||||
|
@ -21,8 +23,14 @@ pnpm preview
|
|||
|
||||
## Adding posts
|
||||
|
||||
To add posts, create a directory in `/blog`. The top level subdirectories should be the year, but there's no hard rules on what the rest of the subdirectories will be. The blog will build itself based on the file structure in `/blog/[year]/**`, and posts will be located wherever there exists `content.md` + `post.toml` files. Check `post.schema.json` for the specification of the `post.toml` format. Finally, you can add a `.blogignore` file to any directory in `/blog` to exclude it from static rendering (useful for work-in-progress blog posts).
|
||||
To add posts, create a directory in `/blog`. The top level subdirectories should be the year, but
|
||||
there's no hard rules on what the rest of the subdirectories will be. The blog will build itself
|
||||
based on the file structure in `/blog/[year]/**`, and posts will be located wherever there exists
|
||||
`content.md` + `post.toml` files. Check `post.schema.json` for the specification of the `post.toml`
|
||||
format. Finally, you can add a `.blogignore` file to any directory in `/blog` to exclude it from
|
||||
static rendering (useful for work-in-progress blog posts).
|
||||
|
||||
## License
|
||||
|
||||
The website's source code is licensed under the [MIT License](LICENSE). The contents of my blog are licensed under [CC BY-NC-SA 4.0](https://creativecommons.org/licenses/by-nc-sa/4.0/).
|
||||
The website's source code is licensed under the [MIT License](LICENSE). The contents of my blog are
|
||||
licensed under [CC BY-NC-SA 4.0](https://creativecommons.org/licenses/by-nc-sa/4.0/).
|
||||
|
|
|
@ -1,21 +1,32 @@
|
|||
## Introduction
|
||||
|
||||
Recently, I made the switch from Windows 11 to Arch Linux. I can confirm
|
||||
that Arch does live up to its meme reputation as an OS that takes hours
|
||||
of configuration to get working.
|
||||
Recently, I made the switch from Windows 11 to Arch Linux. I can confirm that Arch does live up to
|
||||
its meme reputation as an OS that takes hours of configuration to get working.
|
||||
|
||||
I'm making a (non-exhaustive) list of the most important tweaks and setup I had to go through to get everything running smoothly on my system. This is partially intended for anyone who's running into the same issues, and partially for my own reference in case I have to go through this again.
|
||||
I'm making a (non-exhaustive) list of the most important tweaks and setup I had to go through to get
|
||||
everything running smoothly on my system. This is partially intended for anyone who's running into
|
||||
the same issues, and partially for my own reference in case I have to go through this again.
|
||||
|
||||
I'm running KDE Plasma 6 with the Layan rices from XeroLinux. I make heavy use of the XeroLinux utility script to get everything set up with sane defaults easily.
|
||||
I'm running KDE Plasma 6 with the Layan rices from XeroLinux. I make heavy use of the XeroLinux
|
||||
utility script to get everything set up with sane defaults easily.
|
||||
|
||||
Here's the general gist of the main setup steps:
|
||||
|
||||
1. Follow the Arch Wiki's installation guide, until you set up GRUB and boot into the tty. Create a user for yourself, and add yourself to the `sudoers` list with `visudo`.
|
||||
2. Install `paru` and install `plasma`. Then, run the XeroLinux script. Install all of the recommended tweaks and KDE Plasma rices/addons, EXCEPT the GPU drivers (we'll do those later).
|
||||
3. Install `sddm` and enable its service with `systemctl`. Then, `sudo reboot`. You should restart into KDE Plasma.
|
||||
4. At the bottom left, make sure you're using X11 and not Wayland. Wayland is completely broken at the time of writing on Nvidia without some configuration. Log in.
|
||||
1. Follow the Arch Wiki's installation guide, until you set up GRUB and boot into the tty. Create a
|
||||
user for yourself, and add yourself to the `sudoers` list with `visudo`.
|
||||
2. Install `paru` and install `plasma`. Then, run the XeroLinux script. Install all of the
|
||||
recommended tweaks and KDE Plasma rices/addons, EXCEPT the GPU drivers (we'll do those later).
|
||||
3. Install `sddm` and enable its service with `systemctl`. Then, `sudo reboot`. You should restart
|
||||
into KDE Plasma.
|
||||
4. At the bottom left, make sure you're using X11 and not Wayland. Wayland is completely broken at
|
||||
the time of writing on Nvidia without some configuration. Log in.
|
||||
5. Once loaded in, go to the XeroLinux GPU drivers installation guide. Run these commands
|
||||
<!-- TODO: add gpu driver guide -->
|
||||
6. If you were successful in setting up the GPU drivers, you should now be able to enter Plasma with Wayland. For me, performance is much better and smoother, and I'm able to set up the display configurations that I want without weird `xrander` hacks. However, at this point, Wayland is still super problematic, and even more setup will need to be done.
|
||||
7. Set the environment variable to tell all electron apps to use native Wayland instead of xwayland. This will stop weird behavior in discord, vscode, obsidian. etc.
|
||||
8. Enable the experimental Nvidia kernel flag to preserve the entire video memory on suspend. This will allow you to use suspend properly and not break everything.
|
||||
6. If you were successful in setting up the GPU drivers, you should now be able to enter Plasma with
|
||||
Wayland. For me, performance is much better and smoother, and I'm able to set up the display
|
||||
configurations that I want without weird `xrander` hacks. However, at this point, Wayland is
|
||||
still super problematic, and even more setup will need to be done.
|
||||
7. Set the environment variable to tell all electron apps to use native Wayland instead of xwayland.
|
||||
This will stop weird behavior in discord, vscode, obsidian. etc.
|
||||
8. Enable the experimental Nvidia kernel flag to preserve the entire video memory on suspend. This
|
||||
will allow you to use suspend properly and not break everything.
|
||||
|
|
|
@ -1,27 +1,41 @@
|
|||
## Introduction
|
||||
|
||||
The following content is a test post for the blog's markdown and $\KaTeX$ rendering capabilities. There's a few errors, and wikilinks aren't supported. This file was copy pasted directly out of my `obsidian.md` notebook, so it contains some weird formatting.
|
||||
The following content is a test post for the blog's markdown and $\KaTeX$ rendering capabilities.
|
||||
There's a few errors, and wikilinks aren't supported. This file was copy pasted directly out of my
|
||||
`obsidian.md` notebook, so it contains some weird formatting.
|
||||
|
||||
<br />
|
||||
|
||||
The methods in [[9.8 Power Series]] and [[9.9 Representation of (Rational) Functions by Power Series]] allow us to find power series for rational functions, $\ln$, and $\arctan$. To get power series for other elementary functions, we need a more general method.
|
||||
The methods in [[9.8 Power Series]] and
|
||||
[[9.9 Representation of (Rational) Functions by Power Series]] allow us to find power series for
|
||||
rational functions, $\ln$, and $\arctan$. To get power series for other elementary functions, we
|
||||
need a more general method.
|
||||
|
||||
We can approximate some non-polynomial functions by constructing a polynomial with the _same derivatives_ as the function. This is called a _Taylor Polynomial_.
|
||||
We can approximate some non-polynomial functions by constructing a polynomial with the _same
|
||||
derivatives_ as the function. This is called a _Taylor Polynomial_.
|
||||
|
||||
> [!NOTE]
|
||||
> In general, if $c \neq 0$, it's called a Taylor Polynomial. If $c = 0$, then it's a Maclaurin Polynomial.
|
||||
> [!NOTE] In general, if $c \neq 0$, it's called a Taylor Polynomial. If $c = 0$, then it's a
|
||||
> Maclaurin Polynomial.
|
||||
|
||||
> [!CAUTION]
|
||||
> test lorem ipsum dolor sit amet consectetur adipiscing elit sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.
|
||||
> [!CAUTION] test lorem ipsum dolor sit amet consectetur adipiscing elit sed do eiusmod tempor
|
||||
> incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam quis nostrud exercitation
|
||||
> ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in
|
||||
> voluptate velit esse cillum dolore eu fugiat nulla pariatur.
|
||||
|
||||
> [!WARNING]
|
||||
> test lorem ipsum dolor sit amet consectetur adipiscing elit sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.
|
||||
> [!WARNING] test lorem ipsum dolor sit amet consectetur adipiscing elit sed do eiusmod tempor
|
||||
> incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam quis nostrud exercitation
|
||||
> ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in
|
||||
> voluptate velit esse cillum dolore eu fugiat nulla pariatur.
|
||||
|
||||
> [!TIP]
|
||||
> test lorem ipsum dolor sit amet consectetur adipiscing elit sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.
|
||||
> [!TIP] test lorem ipsum dolor sit amet consectetur adipiscing elit sed do eiusmod tempor
|
||||
> incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam quis nostrud exercitation
|
||||
> ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in
|
||||
> voluptate velit esse cillum dolore eu fugiat nulla pariatur.
|
||||
|
||||
> [!IMPORTANT]
|
||||
> test lorem ipsum dolor sit amet consectetur adipiscing elit sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.
|
||||
> [!IMPORTANT] test lorem ipsum dolor sit amet consectetur adipiscing elit sed do eiusmod tempor
|
||||
> incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam quis nostrud exercitation
|
||||
> ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in
|
||||
> voluptate velit esse cillum dolore eu fugiat nulla pariatur.
|
||||
|
||||
Consider $f(x) = e^x$. Let's find the best cubic approximation $P_3(x)$ for $f(x)$ at $c=0$.
|
||||
|
||||
|
@ -63,8 +77,7 @@ You can confirm that this polynomial has the same first, second, and third deriv
|
|||
|
||||
Taking repeated derivatives like this leads to a common pattern in all Taylor polynomials.
|
||||
|
||||
> [!NOTE]
|
||||
> We use the notation $P_n(x)$ to denote the $n^{th}$ Taylor polynomial
|
||||
> [!NOTE] We use the notation $P_n(x)$ to denote the $n^{th}$ Taylor polynomial
|
||||
|
||||
Taylor polynomials take the form:
|
||||
|
||||
|
@ -72,7 +85,8 @@ $$
|
|||
P_n(x) = a_0 + a_1 (x-c) + a_2(x-c)^2 + a_3 (x-c)^3 + \dots + a_n(x-c)^n
|
||||
$$
|
||||
|
||||
where $a_n$ is the coefficient of the $n^{th}$ term (indexed from 0). It turns out that these coefficients are actually common across Taylor polynomials.
|
||||
where $a_n$ is the coefficient of the $n^{th}$ term (indexed from 0). It turns out that these
|
||||
coefficients are actually common across Taylor polynomials.
|
||||
|
||||
$$
|
||||
P_n(c) = a_0 = f(c)
|
||||
|
@ -100,7 +114,9 @@ $$
|
|||
|
||||
## Tying up loose ends
|
||||
|
||||
We've seen Taylor and Maclaurin polynomials. We will eventually extend them to [[9.10 Taylor and Maclaurin Series|Maclaurin and Taylor series]]. Before this is mathematically valid (at least, valid enough), we need to do some stuff first.
|
||||
We've seen Taylor and Maclaurin polynomials. We will eventually extend them to
|
||||
[[9.10 Taylor and Maclaurin Series|Maclaurin and Taylor series]]. Before this is mathematically
|
||||
valid (at least, valid enough), we need to do some stuff first.
|
||||
|
||||
We can use Maclaurin and Taylor polynomials (or series) to estimate the value of functions by hand.
|
||||
|
||||
|
@ -116,8 +132,7 @@ $$
|
|||
z \in [c,\,x]
|
||||
$$
|
||||
|
||||
> [!TIP]
|
||||
> This is a fancy way of saying that $z$ is between $c$ and $x$.
|
||||
> [!TIP] This is a fancy way of saying that $z$ is between $c$ and $x$.
|
||||
|
||||
$$
|
||||
\text{Error} = \left|R_n(x)\right|
|
||||
|
@ -127,28 +142,28 @@ $$
|
|||
|
||||
#### Applying to $e^x$
|
||||
|
||||
How many terms of the Maclaurin Polynomial for $f(x) = e^x$ do we need to guarantee that our estimate for $f(1) = e$ is within $\displaystyle\frac{1}{1000000}$?
|
||||
The error is
|
||||
How many terms of the Maclaurin Polynomial for $f(x) = e^x$ do we need to guarantee that our
|
||||
estimate for $f(1) = e$ is within $\displaystyle\frac{1}{1000000}$? The error is
|
||||
|
||||
$$
|
||||
|R_n(1)| = \frac{|f^{(n+1)}(z)|}{(n+1)!}\,\cancel{|1-0|^{n+1}}
|
||||
$$
|
||||
|
||||
for some $z$ between $c=0$ and $x=1$
|
||||
So we want an $n$ such that
|
||||
for some $z$ between $c=0$ and $x=1$ So we want an $n$ such that
|
||||
|
||||
$$
|
||||
\frac{|e^z|}{(n+1)!} \le \frac{1}{1000000}
|
||||
$$
|
||||
|
||||
The worst case scenario is $z=1$.
|
||||
If $\displaystyle\frac{e}{(n+1)!} \le \frac{1}{1000000}$, we're all set.
|
||||
The worst case scenario is $z=1$. 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.
|
||||
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$.
|
||||
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. So
|
||||
$P_9(1) = 1 + 1 + \frac{1}{2!} + \frac{1}{3!} + \dots + \frac{1}{9!}$ is within $\frac{1}{1000000}$
|
||||
of $e$.
|
||||
|
||||
```rust
|
||||
let mut var: u32 = 10030;
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
## 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:
|
||||
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!
|
||||
> [!NOTE] GitHub-style notifications!
|
||||
|
||||
> [!TIP]
|
||||
> The full Commonmark spec is supported, and it's extended by the GFM spec
|
||||
> [!TIP] The full Commonmark spec is supported, and it's extended by the GFM spec
|
||||
|
||||
## Tables!
|
||||
|
||||
|
@ -17,7 +17,8 @@ Welcome! This blog is powered by a custom static site generator I made using Sve
|
|||
|
||||
## 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.
|
||||
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
|
||||
|
||||
|
@ -55,20 +56,25 @@ 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).
|
||||
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:
|
||||
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!
|
||||
> [!NOTE] GitHub-style notifications!
|
||||
|
||||
> [!TIP]
|
||||
> The full Commonmark spec is supported, and it's extended by the GFM spec
|
||||
> [!TIP] The full Commonmark spec is supported, and it's extended by the GFM spec
|
||||
|
||||
## Tables!
|
||||
|
||||
|
@ -79,7 +85,8 @@ Welcome! This blog is powered by a custom static site generator I made using Sve
|
|||
|
||||
## 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.
|
||||
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
|
||||
|
||||
|
@ -118,7 +125,12 @@ 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).
|
||||
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,12 +1,14 @@
|
|||
## Introduction
|
||||
|
||||
The modal editor's fall into obscurity is truly one of the greatest losses in the history of computing.
|
||||
The modal editor's fall into obscurity is truly one of the greatest losses in the history of
|
||||
computing.
|
||||
|
||||
There's no denying that point-and-click is _easy_, and sure, it's enough for the majority of people using
|
||||
their computer as a minor tool.
|
||||
There's no denying that point-and-click is _easy_, and sure, it's enough for the majority of people
|
||||
using their computer as a minor tool.
|
||||
|
||||
But for those who use a text editor as their natural habitat, there's no reason why text editors should stop at
|
||||
pointing the mouse where you want to go and typing. This leads to the typical editing session consisting of:
|
||||
But for those who use a text editor as their natural habitat, there's no reason why text editors
|
||||
should stop at pointing the mouse where you want to go and typing. This leads to the typical editing
|
||||
session consisting of:
|
||||
|
||||
- Scroll around with mouse
|
||||
- Locate the location where you want to add text
|
||||
|
@ -15,38 +17,42 @@ pointing the mouse where you want to go and typing. This leads to the typical ed
|
|||
|
||||
Then, switch back to your mouse and repeat.
|
||||
|
||||
Of course, there are ways in which users seek to streamline this process. Almost everyone who edits text
|
||||
daily knows at least a few keyboard shortcuts to quickly jump around words and in between lines to move to nearby
|
||||
points of interest quickly without switching back to the mouse. Other more dedicated power users might learn a slew of
|
||||
modifier-key based commands to quickly navigate around, removing the need for a mouse entirely when editing within
|
||||
a file.
|
||||
Of course, there are ways in which users seek to streamline this process. Almost everyone who edits
|
||||
text daily knows at least a few keyboard shortcuts to quickly jump around words and in between lines
|
||||
to move to nearby points of interest quickly without switching back to the mouse. Other more
|
||||
dedicated power users might learn a slew of modifier-key based commands to quickly navigate around,
|
||||
removing the need for a mouse entirely when editing within a file.
|
||||
|
||||
All of these, however, are halfway solutions. Namely, they generally utilize a modifier based approach. Hold `ctrl`
|
||||
(or `option`, on macOS) and use the arrow keys to navigate quickly. Hold `ctrl` and hit `delete` to delete entire words at once.
|
||||
Hold `shift` to highlight text. `ctrl + c` copies, `ctrl + v` pastes, `ctrl + x` cuts. You get the idea.
|
||||
All of these, however, are halfway solutions. Namely, they generally utilize a modifier based
|
||||
approach. Hold `ctrl` (or `option`, on macOS) and use the arrow keys to navigate quickly. Hold
|
||||
`ctrl` and hit `delete` to delete entire words at once. Hold `shift` to highlight text. `ctrl + c`
|
||||
copies, `ctrl + v` pastes, `ctrl + x` cuts. You get the idea.
|
||||
|
||||
A pseudo- medical condition has even been coined for this reliance on modifier keys: the dreaded Emacs pinky, where
|
||||
users of emacs, which relies heavily on `ctrl`, `meta`, and other modifier based shortcuts, experience RSI due to their
|
||||
frequent usage of their pinky to stretch down to those keys.
|
||||
A pseudo- medical condition has even been coined for this reliance on modifier keys: the dreaded
|
||||
Emacs pinky, where users of emacs, which relies heavily on `ctrl`, `meta`, and other modifier based
|
||||
shortcuts, experience RSI due to their frequent usage of their pinky to stretch down to those keys.
|
||||
|
||||
This method of designing and organizing the text editor is wrong. _Moving around text_ (and files) is just as, if not
|
||||
more prevalent than inserting text itself. So why treat navigation as an afterthought? Why should you _edit by default_,
|
||||
and hold a modifier key to temporarily enable a different control scheme which handles locomotion? This is where the
|
||||
genius of the modal editor comes in.
|
||||
This method of designing and organizing the text editor is wrong. _Moving around text_ (and files)
|
||||
is just as, if not more prevalent than inserting text itself. So why treat navigation as an
|
||||
afterthought? Why should you _edit by default_, and hold a modifier key to temporarily enable a
|
||||
different control scheme which handles locomotion? This is where the genius of the modal editor
|
||||
comes in.
|
||||
|
||||
## Vim
|
||||
|
||||
In Vim, the editor itself is split into three main "modes", hence the classification of "modal". Instead of treating
|
||||
navigation as an afterthought, Vim opens in its "normal mode", which provides the user with many keys to move around their
|
||||
text file: `hjkl` as arrow keys, `b`, `e`, and `w`, to navigate around words, `0`, `$`, and `_` to jump around lines, `{`, `}`,
|
||||
`z`, and more, for quickly repositioning your cursor and screen vertically. Notice how all of these keys are easily accessible
|
||||
from the home row. Just as importantly, notice how there's no need for you to hold any modifiers to access these actions.
|
||||
These keys don't input text in normal mode; they simply handle navigation. Many point-and-click acolytes believe this to be
|
||||
a failure. "Why wouldn't you want your editor to _edit_ by default?" Of course, this is not a failure, but one of its
|
||||
greatest strengths. How many times do you open a file and immediately need to start editing? Almost always, you need to first
|
||||
navigate to a specific location, usually move or change some text, and then begin editing. In Vim, this is streamlined by
|
||||
default. You can navigate the entire file using just commands found near the home row, without needing to use a mouse or
|
||||
hit complicated chords. Instead of treating navigation as an afterthought for power-users, it treats it as a primary
|
||||
feature of the editor itself.
|
||||
In Vim, the editor itself is split into three main "modes", hence the classification of "modal".
|
||||
Instead of treating navigation as an afterthought, Vim opens in its "normal mode", which provides
|
||||
the user with many keys to move around their text file: `hjkl` as arrow keys, `b`, `e`, and `w`, to
|
||||
navigate around words, `0`, `$`, and `_` to jump around lines, `{`, `}`, `z`, and more, for quickly
|
||||
repositioning your cursor and screen vertically. Notice how all of these keys are easily accessible
|
||||
from the home row. Just as importantly, notice how there's no need for you to hold any modifiers to
|
||||
access these actions. These keys don't input text in normal mode; they simply handle navigation.
|
||||
Many point-and-click acolytes believe this to be a failure. "Why wouldn't you want your editor to
|
||||
_edit_ by default?" Of course, this is not a failure, but one of its greatest strengths. How many
|
||||
times do you open a file and immediately need to start editing? Almost always, you need to first
|
||||
navigate to a specific location, usually move or change some text, and then begin editing. In Vim,
|
||||
this is streamlined by default. You can navigate the entire file using just commands found near the
|
||||
home row, without needing to use a mouse or hit complicated chords. Instead of treating navigation
|
||||
as an afterthought for power-users, it treats it as a primary feature of the editor itself.
|
||||
|
||||
Written on Neovim.
|
||||
|
|
Loading…
Reference in a new issue