stranger-quarkdown 4.0.0-alpha.2 → 4.0.0-alpha.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md ADDED
@@ -0,0 +1,48 @@
1
+ # Stranger Quarkdown
2
+
3
+ Markdown preprocessing automation for Svelte/Kit projects.
4
+
5
+ Please visit [the GitHub](https://github.com/Sup2point0/stranger-quarkdown#readme) for the full README :]
6
+
7
+
8
+ <br>
9
+
10
+
11
+ ## Quickstart
12
+
13
+ Run:
14
+
15
+ ```bash
16
+ > npx squarkdown
17
+ ```
18
+
19
+ With extras:
20
+
21
+ ```bash
22
+ > npx squarkdown --assets --fonts
23
+ ```
24
+
25
+ Remind yourself:
26
+
27
+ ```bash
28
+ > npx squarkdown --help
29
+ ```
30
+
31
+
32
+ <br>
33
+
34
+
35
+ ## Library
36
+
37
+ ```svelte
38
+ <script lang="ts">
39
+ import type { PageData } from "stranger-quarkdown";
40
+
41
+ import { page } from "$app/state";
42
+
43
+ let page_data: PageData<"long"> = $derived(page.data);
44
+
45
+ // if you set `out.shorter-fields = true`:
46
+ let shorter_page_data: PageData<"short"> = $derived(page.data);
47
+ </script>
48
+ ```
Binary file
Binary file
package/index.d.ts CHANGED
@@ -1,7 +1,21 @@
1
1
  /**
2
2
  * The metadata exported by Squarkdown for a Markdown page, returned from `load()` in `+page.ts`.
3
+ *
4
+ * The generic type parameter describes what format the field names use. `long` means full, clear identifiers like `description` and `last_update_raw`. `short` means more compact identifiers like `desc` and `update_raw`.
5
+ *
6
+ * Which format is used in `+page.ts` and `site-data.json` is configured by `out.shorter-fields` in your squarkup config.
3
7
  */
4
- export interface PageData
8
+ export type PageData<
9
+ FieldLength extends "long" | "short"
10
+ = "long" | "short"
11
+ > = (
12
+ FieldLength extends "long" ?
13
+ LongFields
14
+ : ShortFields
15
+ );
16
+
17
+
18
+ interface LongFields
5
19
  {
6
20
  /** The unique stable identifier for the page. */
7
21
  shard: string;
@@ -30,3 +44,34 @@ export interface PageData
30
44
  /** Other arbitrary user-provided fields not intrinsic to Squarkdown. */
31
45
  other: Record<string, string[]>;
32
46
  }
47
+
48
+
49
+ interface ShortFields
50
+ {
51
+ /** The unique stable identifier for the page. */
52
+ shard: string;
53
+
54
+ /** The location of the original `.md` file this page represents. */
55
+ filepath: string;
56
+
57
+ /** The folder to render this page's `+page.svx` and `+page.ts` to, relative to `out.folder`. */
58
+ dest: string;
59
+
60
+ /** The flags provided in this page's charm squark, excluding `live!`. */
61
+ flags: string[];
62
+
63
+ title?: string;
64
+ desc?: string;
65
+ head?: string;
66
+ capt?: string;
67
+
68
+ tags: string[];
69
+
70
+ date?: Date;
71
+ date_raw?: string;
72
+ update?: Date;
73
+ update_raw?: string;
74
+
75
+ /** Other arbitrary user-provided fields not intrinsic to Squarkdown. */
76
+ other: Record<string, string[]>;
77
+ }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "stranger-quarkdown",
3
3
  "author": "Sup#2.0",
4
- "version": "4.0.0-alpha.2",
4
+ "version": "4.0.0-alpha.3",
5
5
  "license": "MIT",
6
6
 
7
7
  "description": "Markdown preprocessing for SvelteKit projects",
@@ -24,6 +24,7 @@
24
24
  "./bin/",
25
25
  "index.d.ts",
26
26
  "package.json",
27
+ "README.md",
27
28
  "LICENCE"
28
29
  ],
29
30
  "exports": {