From df02ea20d7e12e8b9ffdd2968afaf5893c433488 Mon Sep 17 00:00:00 2001
From: Jacky Zhao <j.zhao2k19@gmail.com>
Date: Fri, 11 Aug 2023 04:32:11 +0000
Subject: [PATCH] spacing fix
---
content/advanced/paths.md | 14 ++++++++++++--
1 files changed, 12 insertions(+), 2 deletions(-)
diff --git a/content/advanced/paths.md b/content/advanced/paths.md
index 2a5e09f..68fc181 100644
--- a/content/advanced/paths.md
+++ b/content/advanced/paths.md
@@ -11,7 +11,7 @@
Luckily, we can mimic nominal typing using [brands](https://www.typescriptlang.org/play#example/nominal-typing).
```typescript
-// instead of
+// instead of
type ClientSlug = string
// we do
@@ -21,7 +21,7 @@
const slug: ClientSlug = "some random slug"
```
-While this prevents most typing mistakes *within* our nominal typing system (e.g. mistaking a server slug for a client slug), it doesn't prevent us from *accidentally* mistaking a string for a client slug when we forcibly cast it.
+While this prevents most typing mistakes _within_ our nominal typing system (e.g. mistaking a server slug for a client slug), it doesn't prevent us from _accidentally_ mistaking a string for a client slug when we forcibly cast it.
Thus, we still need to be careful when casting from a string to one of these nominal types in the 'entrypoints', illustrated with hexagon shapes in the diagram below.
@@ -43,3 +43,13 @@
Server --"canonicalizeServer()"--> Canonical
style Canonical stroke-width:4px
```
+
+Here are the main types of slugs with a rough description of each type of path:
+
+- `ClientSlug`: client-side slug, usually obtained through `window.location`. Contains the protocol (i.e. starts with `https://`)
+- `CanonicalSlug`: should be used whenever you need to refer to the location of a file/note. Shouldn't be a relative path and shouldn't have leading or trailing slashes `/` either. Also shouldn't have `/index` as an ending or a file extension.
+- `RelativeURL`: must start with `.` or `..` to indicate it's a relative URL. Shouldn't have `/index` as an ending or a file extension.
+- `ServerSlug`: cannot be relative and may not have leading or trailing slashes.
+- `FilePath`: a real file path to a file on disk. Cannot be relative and must have a file extension.
+
+To get a clearer picture of how these relate to each other, take a look at the path tests in `quartz/path.test.ts`.
--
Gitblit v1.10.0