@wizzlethorpe/vaults 0.6.1 → 0.7.1
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 +135 -17
- package/dist/build.js +501 -190
- package/dist/build.js.map +1 -1
- package/dist/commands/build.js +4 -4
- package/dist/commands/build.js.map +1 -1
- package/dist/commands/init.js +13 -10
- package/dist/commands/init.js.map +1 -1
- package/dist/commands/password.js +3 -1
- package/dist/commands/password.js.map +1 -1
- package/dist/commands/patreon.js +30 -20
- package/dist/commands/patreon.js.map +1 -1
- package/dist/commands/preview.js +10 -8
- package/dist/commands/preview.js.map +1 -1
- package/dist/commands/push.js +11 -9
- package/dist/commands/push.js.map +1 -1
- package/dist/commands/role.js +5 -0
- package/dist/commands/role.js.map +1 -1
- package/dist/config.js +30 -15
- package/dist/config.js.map +1 -1
- package/dist/escape.js +29 -0
- package/dist/escape.js.map +1 -0
- package/dist/favicon.js +3 -36
- package/dist/favicon.js.map +1 -1
- package/dist/foundry-importer.js +61 -0
- package/dist/foundry-importer.js.map +1 -0
- package/dist/images.js +0 -30
- package/dist/images.js.map +1 -1
- package/dist/index.js +37 -4
- package/dist/index.js.map +1 -1
- package/dist/migrate/0.6-legacy-auth-settings.js +96 -0
- package/dist/migrate/0.6-legacy-auth-settings.js.map +1 -0
- package/dist/migrate/0.7-vaults-dir.js +74 -0
- package/dist/migrate/0.7-vaults-dir.js.map +1 -0
- package/dist/migrate/registry.js +6 -0
- package/dist/migrate/registry.js.map +1 -0
- package/dist/migrate/run.js +38 -0
- package/dist/migrate/run.js.map +1 -0
- package/dist/migrate/types.js +8 -0
- package/dist/migrate/types.js.map +1 -0
- package/dist/paths.js +66 -0
- package/dist/paths.js.map +1 -0
- package/dist/render/auth-template.js +23 -141
- package/dist/render/auth-template.js.map +1 -1
- package/dist/render/bases.js +56 -44
- package/dist/render/bases.js.map +1 -1
- package/dist/render/callouts.js +29 -10
- package/dist/render/callouts.js.map +1 -1
- package/dist/render/embed.js +124 -26
- package/dist/render/embed.js.map +1 -1
- package/dist/render/extensions.js +68 -0
- package/dist/render/extensions.js.map +1 -0
- package/dist/render/external-links.js +32 -0
- package/dist/render/external-links.js.map +1 -0
- package/dist/render/footer.js +37 -0
- package/dist/render/footer.js.map +1 -0
- package/dist/render/frontmatter.js +17 -0
- package/dist/render/frontmatter.js.map +1 -0
- package/dist/render/handlers/assets.js +123 -0
- package/dist/render/handlers/assets.js.map +1 -0
- package/dist/render/handlers/builtin/battlemap.js +199 -0
- package/dist/render/handlers/builtin/battlemap.js.map +1 -0
- package/dist/render/handlers/builtin/dice.js +78 -0
- package/dist/render/handlers/builtin/dice.js.map +1 -0
- package/dist/render/handlers/builtin/fm-code.js +50 -0
- package/dist/render/handlers/builtin/fm-code.js.map +1 -0
- package/dist/render/handlers/builtin/fm.js +83 -0
- package/dist/render/handlers/builtin/fm.js.map +1 -0
- package/dist/render/handlers/builtin/index.js +13 -0
- package/dist/render/handlers/builtin/index.js.map +1 -0
- package/dist/render/handlers/builtin/inline-format.js +26 -0
- package/dist/render/handlers/builtin/inline-format.js.map +1 -0
- package/dist/render/handlers/builtin/statblock.js +491 -0
- package/dist/render/handlers/builtin/statblock.js.map +1 -0
- package/dist/render/handlers/dispatch.js +182 -0
- package/dist/render/handlers/dispatch.js.map +1 -0
- package/dist/render/handlers/loader.js +90 -0
- package/dist/render/handlers/loader.js.map +1 -0
- package/dist/render/handlers/types.js +60 -0
- package/dist/render/handlers/types.js.map +1 -0
- package/dist/render/image-srcs.js +42 -0
- package/dist/render/image-srcs.js.map +1 -0
- package/dist/render/layout.js +62 -9
- package/dist/render/layout.js.map +1 -1
- package/dist/render/pipeline.js +38 -9
- package/dist/render/pipeline.js.map +1 -1
- package/dist/render/preview.js +53 -18
- package/dist/render/preview.js.map +1 -1
- package/dist/render/slug.js +5 -0
- package/dist/render/slug.js.map +1 -1
- package/dist/render/styles.js +124 -15
- package/dist/render/styles.js.map +1 -1
- package/dist/render/wikilink.js +15 -4
- package/dist/render/wikilink.js.map +1 -1
- package/dist/scan.js +1 -1
- package/dist/scan.js.map +1 -1
- package/dist/settings.js +25 -4
- package/dist/settings.js.map +1 -1
- package/dist/version.js +36 -0
- package/dist/version.js.map +1 -0
- package/package.json +12 -12
- package/dist/api.js +0 -42
- package/dist/api.js.map +0 -1
- package/dist/render/mcp-template.js +0 -239
- package/dist/render/mcp-template.js.map +0 -1
package/dist/render/pipeline.js
CHANGED
|
@@ -9,40 +9,55 @@ import rehypeStringify from "rehype-stringify";
|
|
|
9
9
|
import matter from "gray-matter";
|
|
10
10
|
import { wikiLinkPlugin } from "./wikilink.js";
|
|
11
11
|
import { embedPlugin } from "./embed.js";
|
|
12
|
+
import { externalLinksPlugin } from "./external-links.js";
|
|
13
|
+
import { imageSrcsPlugin } from "./image-srcs.js";
|
|
12
14
|
import { calloutPlugin } from "./callouts.js";
|
|
13
15
|
import { basesPlugin } from "./bases.js";
|
|
16
|
+
import { handlersPlugin } from "./handlers/dispatch.js";
|
|
17
|
+
import { htmlEscape } from "../escape.js";
|
|
18
|
+
import { extractH1 } from "./frontmatter.js";
|
|
14
19
|
const sanitizeSchema = {
|
|
15
20
|
...defaultSchema,
|
|
16
21
|
clobberPrefix: "",
|
|
17
22
|
// Bases emit interactive HTML beyond what the default schema allows:
|
|
18
23
|
// <input> (filter), <button> (tab buttons + dialog actions). Add them
|
|
19
24
|
// and the attributes they need to function.
|
|
20
|
-
tagNames: [...(defaultSchema.tagNames ?? []), "input", "button"],
|
|
25
|
+
tagNames: [...(defaultSchema.tagNames ?? []), "input", "button", "audio", "video", "source"],
|
|
21
26
|
attributes: {
|
|
22
27
|
...defaultSchema.attributes,
|
|
23
28
|
// role + aria-selected/haspopup/label ride on tabs, dialogs, etc.
|
|
24
29
|
// `hidden` is essential — Bases tab panels and card-filter rows toggle
|
|
25
30
|
// it from JS to show/hide elements. Without it on the allowlist the
|
|
26
31
|
// initial render shows everything because the sanitizer strips it.
|
|
27
|
-
"*": [...(defaultSchema.attributes?.["*"] ?? []), "className", "role", "ariaSelected", "ariaLabel", "ariaHaspopup", "tabindex", "hidden"],
|
|
32
|
+
"*": [...(defaultSchema.attributes?.["*"] ?? []), "className", "role", "ariaSelected", "ariaPressed", "ariaLabel", "ariaHaspopup", "tabindex", "hidden"],
|
|
28
33
|
img: ["src", "alt", "width", "height", "loading"],
|
|
29
|
-
|
|
34
|
+
audio: ["src", "controls", "preload", "loop", "muted"],
|
|
35
|
+
video: ["src", "controls", "preload", "loop", "muted", "width", "height", "poster"],
|
|
36
|
+
source: ["src", "type"],
|
|
37
|
+
a: ["href", "title", "className", "id", "target", "rel"],
|
|
30
38
|
div: ["className", "data*", "role"],
|
|
31
39
|
span: ["className", "data*"],
|
|
40
|
+
code: ["className", "title"],
|
|
32
41
|
table: ["className"],
|
|
33
42
|
th: ["className", "data*", "tabindex"],
|
|
34
43
|
td: ["className", "data*"],
|
|
35
44
|
tr: ["className", "data*"],
|
|
36
45
|
input: ["type", "placeholder", "className", "ariaLabel"],
|
|
37
46
|
button: ["type", "className", "data*", "role", "ariaSelected", "ariaLabel", "ariaHaspopup", "tabindex", "title"],
|
|
47
|
+
// Foldable callouts emit <details open>; the default schema allows
|
|
48
|
+
// `open` on <summary> only.
|
|
49
|
+
details: ["className", "data*", "open"],
|
|
38
50
|
},
|
|
39
51
|
// The default schema forces <input> to type=checkbox and disabled=true
|
|
40
52
|
// to safely render GFM task lists. We don't render task lists here, and
|
|
41
53
|
// the Bases filter input needs to be a writable search box, so reset.
|
|
42
54
|
required: { ...(defaultSchema.required ?? {}), input: {} },
|
|
43
55
|
};
|
|
44
|
-
export async function renderMarkdown(source, context, fallbackTitle) {
|
|
45
|
-
const parsed =
|
|
56
|
+
export async function renderMarkdown(source, context, fallbackTitle, preParsed) {
|
|
57
|
+
const parsed = preParsed ?? (() => {
|
|
58
|
+
const m = matter(source);
|
|
59
|
+
return { data: (m.data ?? {}), content: m.content };
|
|
60
|
+
})();
|
|
46
61
|
const fm = parsed.data;
|
|
47
62
|
const outlinks = [];
|
|
48
63
|
const warnings = [];
|
|
@@ -58,12 +73,30 @@ export async function renderMarkdown(source, context, fallbackTitle) {
|
|
|
58
73
|
const file = await unified()
|
|
59
74
|
.use(remarkParse)
|
|
60
75
|
.use(remarkGfm)
|
|
76
|
+
// Handlers run early so any markdown they emit is processed by the
|
|
77
|
+
// rest of the pipeline (wikilinks resolve, embeds inline, etc.).
|
|
78
|
+
// Empty registry (no built-ins, no user handlers) short-circuits to
|
|
79
|
+
// a no-op walk.
|
|
80
|
+
.use(handlersPlugin({
|
|
81
|
+
registry: context.handlers ?? { inline: new Map(), codeBlock: new Map() },
|
|
82
|
+
context: {
|
|
83
|
+
pagePath: fallbackTitle,
|
|
84
|
+
frontmatter: fm,
|
|
85
|
+
render: context,
|
|
86
|
+
escape: htmlEscape,
|
|
87
|
+
},
|
|
88
|
+
}))
|
|
61
89
|
.use(calloutPlugin({ redactRoles: context.redactRoles }))
|
|
62
90
|
// Bases runs before wikilink/embed: it consumes ```base code fences
|
|
63
91
|
// wholesale and emits raw HTML, so downstream plugins won't try to
|
|
64
92
|
// process anything inside the table.
|
|
65
93
|
.use(basesPlugin({ context, warnings }))
|
|
66
94
|
.use(embedPlugin({ context, warnings }))
|
|
95
|
+
// Normalise plain markdown image URLs (``) to the
|
|
96
|
+
// absolute slugified URL the build emits. Sits after embedPlugin (which
|
|
97
|
+
// handles the wikilink form) so both shapes converge on the same output.
|
|
98
|
+
.use(imageSrcsPlugin({ context }))
|
|
99
|
+
.use(externalLinksPlugin())
|
|
67
100
|
.use(wikiLinkPlugin({ context, outlinks, warnings }))
|
|
68
101
|
.use(remarkRehype, { allowDangerousHtml: true })
|
|
69
102
|
.use(rehypeRaw)
|
|
@@ -76,8 +109,4 @@ export async function renderMarkdown(source, context, fallbackTitle) {
|
|
|
76
109
|
|| fallbackTitle;
|
|
77
110
|
return { html: String(file), title, frontmatter: fm, outlinks, warnings };
|
|
78
111
|
}
|
|
79
|
-
function extractH1(markdown) {
|
|
80
|
-
const m = /^#\s+(.+)$/m.exec(markdown);
|
|
81
|
-
return m ? m[1].trim() : null;
|
|
82
|
-
}
|
|
83
112
|
//# sourceMappingURL=pipeline.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pipeline.js","sourceRoot":"","sources":["../../src/render/pipeline.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAClC,OAAO,WAAW,MAAM,cAAc,CAAC;AACvC,OAAO,SAAS,MAAM,YAAY,CAAC;AACnC,OAAO,YAAY,MAAM,eAAe,CAAC;AACzC,OAAO,SAAS,MAAM,YAAY,CAAC;AACnC,OAAO,cAAc,EAAE,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChE,OAAO,UAAU,MAAM,aAAa,CAAC;AACrC,OAAO,eAAe,MAAM,kBAAkB,CAAC;AAC/C,OAAO,MAAM,MAAM,aAAa,CAAC;AAEjC,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAC/C,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AACzC,OAAO,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAC9C,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"pipeline.js","sourceRoot":"","sources":["../../src/render/pipeline.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAClC,OAAO,WAAW,MAAM,cAAc,CAAC;AACvC,OAAO,SAAS,MAAM,YAAY,CAAC;AACnC,OAAO,YAAY,MAAM,eAAe,CAAC;AACzC,OAAO,SAAS,MAAM,YAAY,CAAC;AACnC,OAAO,cAAc,EAAE,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChE,OAAO,UAAU,MAAM,aAAa,CAAC;AACrC,OAAO,eAAe,MAAM,kBAAkB,CAAC;AAC/C,OAAO,MAAM,MAA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AC;SACvC,GAAG,CAAC,WAAW,CAAC,EAAE,OAAO,EAAE,QAAQ,EAAE,CAAC,CAAC;QACxC,uEAAuE;QACvE,wEAAwE;QACxE,yEAAyE;SACxE,GAAG,CAAC,eAAe,CAAC,EAAE,OAAO,EAAE,CAAC,CAAC;SACjC,GAAG,CAAC,mBAAmB,EAAE,CAAC;SAC1B,GAAG,CAAC,cAAc,CAAC,EAAE,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,CAAC,CAAC;SACpD,GAAG,CAAC,YAAY,EAAE,EAAE,kBAAkB,EAAE,IAAI,EAAE,CAAC;SAC/C,GAAG,CAAC,SAAS,CAAC;SACd,GAAG,CAAC,UAAU,CAAC;SACf,GAAG,CAAC,cAAc,EAAE,cAAc,CAAC;SACnC,GAAG,CAAC,eAAe,CAAC;SACpB,OAAO,CAAC,OAAO,CAAC,CAAC;IAEpB,MAAM,KAAK,GAAG,CAAC,OAAO,EAAE,CAAC,KAAK,KAAK,QAAQ,IAAI,EAAE,CAAC,KAAK,CAAC;WACnD,SAAS,CAAC,MAAM,CAAC,OAAO,CAAC;WACzB,aAAa,CAAC;IAEnB,OAAO,EAAE,IAAI,EAAE,MAAM,CAAC,IAAI,CAAC,EAAE,KAAK,EAAE,WAAW,EAAE,EAAE,EAAE,QAAQ,EAAE,QAAQ,EAAE,CAAC;AAC5E,CAAC"}
|
package/dist/render/preview.js
CHANGED
|
@@ -2,24 +2,62 @@ import { unified } from "unified";
|
|
|
2
2
|
import remarkParse from "remark-parse";
|
|
3
3
|
import remarkGfm from "remark-gfm";
|
|
4
4
|
import remarkRehype from "remark-rehype";
|
|
5
|
+
import rehypeRaw from "rehype-raw";
|
|
5
6
|
import rehypeSanitize, { defaultSchema } from "rehype-sanitize";
|
|
6
7
|
import rehypeStringify from "rehype-stringify";
|
|
7
8
|
import { slugify } from "./slug.js";
|
|
9
|
+
import { stripFrontmatter } from "./frontmatter.js";
|
|
10
|
+
import { handlersPlugin } from "./handlers/dispatch.js";
|
|
11
|
+
import { htmlEscape } from "../escape.js";
|
|
8
12
|
const SUMMARY_CHARS = 320;
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
.use(remarkRehype)
|
|
13
|
-
.use(rehypeSanitize, {
|
|
13
|
+
// Span/code className survive sanitisation so handler output like
|
|
14
|
+
// <span class="fm-value">…</span> keeps its styling hook in the popover.
|
|
15
|
+
const previewSanitizeSchema = {
|
|
14
16
|
...defaultSchema,
|
|
15
|
-
// Strip away anything heavy or risky for a tiny popover.
|
|
16
17
|
tagNames: defaultSchema.tagNames?.filter((t) => !["img", "iframe", "video"].includes(t)),
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
18
|
+
attributes: {
|
|
19
|
+
...defaultSchema.attributes,
|
|
20
|
+
"*": [...(defaultSchema.attributes?.["*"] ?? []), "className"],
|
|
21
|
+
code: ["className", "title"],
|
|
22
|
+
},
|
|
23
|
+
};
|
|
24
|
+
// handlersPlugin needs a HandlerContext; an empty no-op plugin keeps the
|
|
25
|
+
// pipeline shape identical when no handler context is supplied so we don't
|
|
26
|
+
// have to fork the chain type.
|
|
27
|
+
const noopRemarkPlugin = () => () => { };
|
|
28
|
+
function buildPipeline(opts) {
|
|
29
|
+
// allowDangerousHtml + rehypeRaw are needed so HTML emitted by handlers
|
|
30
|
+
// (e.g. fm's <span>) survives into the rendered output instead of being
|
|
31
|
+
// dropped as raw nodes at the markdown→hast boundary.
|
|
32
|
+
return unified()
|
|
33
|
+
.use(remarkParse)
|
|
34
|
+
.use(remarkGfm)
|
|
35
|
+
.use(opts ? handlersPlugin({
|
|
36
|
+
registry: opts.registry,
|
|
37
|
+
context: {
|
|
38
|
+
pagePath: opts.pagePath,
|
|
39
|
+
frontmatter: opts.frontmatter,
|
|
40
|
+
render: opts.renderContext,
|
|
41
|
+
escape: htmlEscape,
|
|
42
|
+
},
|
|
43
|
+
}) : noopRemarkPlugin)
|
|
44
|
+
.use(remarkRehype, { allowDangerousHtml: true })
|
|
45
|
+
.use(rehypeRaw)
|
|
46
|
+
.use(rehypeSanitize, previewSanitizeSchema)
|
|
47
|
+
.use(rehypeStringify);
|
|
48
|
+
}
|
|
49
|
+
export async function buildPreview(rawMarkdown, title, opts) {
|
|
50
|
+
// Strip frontmatter, Obsidian %% comments %%, and fenced code blocks
|
|
51
|
+
// before walking the body. Code fences render as a wall of source text
|
|
52
|
+
// in a tiny hover popover, which looks worse than just omitting them —
|
|
53
|
+
// same rationale as the table skip in truncateMarkdown.
|
|
54
|
+
const body = stripFrontmatter(rawMarkdown)
|
|
55
|
+
.replace(/%%[\s\S]*?%%/g, "")
|
|
56
|
+
.replace(/^```[\s\S]*?^```[^\n]*$/gm, "")
|
|
57
|
+
.replace(/^~~~[\s\S]*?^~~~[^\n]*$/gm, "")
|
|
58
|
+
.trim();
|
|
59
|
+
const pipeline = buildPipeline(opts);
|
|
60
|
+
const summary = await renderSnippet(body, pipeline);
|
|
23
61
|
const headings = {};
|
|
24
62
|
// Match headings even when nested inside a callout/blockquote.
|
|
25
63
|
const sectionRe = /^(?:>\s*)?(#{1,6})\s+(.+)$/gm;
|
|
@@ -34,7 +72,7 @@ export async function buildPreview(rawMarkdown, title) {
|
|
|
34
72
|
const anchor = slugify(headingTitle);
|
|
35
73
|
headings[anchor] = {
|
|
36
74
|
title: headingTitle,
|
|
37
|
-
summary: await renderSnippet(sectionBody),
|
|
75
|
+
summary: await renderSnippet(sectionBody, pipeline),
|
|
38
76
|
};
|
|
39
77
|
}
|
|
40
78
|
return { title, summary, headings };
|
|
@@ -43,11 +81,11 @@ export async function buildPreview(rawMarkdown, title) {
|
|
|
43
81
|
* Truncate the markdown to the first ~SUMMARY_CHARS of body content (skipping
|
|
44
82
|
* headings, image embeds, tables) and render it to sanitised HTML.
|
|
45
83
|
*/
|
|
46
|
-
async function renderSnippet(source) {
|
|
84
|
+
async function renderSnippet(source, pipeline) {
|
|
47
85
|
const truncated = truncateMarkdown(source.trim(), SUMMARY_CHARS);
|
|
48
86
|
if (!truncated)
|
|
49
87
|
return "";
|
|
50
|
-
const file = await
|
|
88
|
+
const file = await pipeline.process(truncated);
|
|
51
89
|
return String(file).trim();
|
|
52
90
|
}
|
|
53
91
|
function truncateMarkdown(source, maxChars) {
|
|
@@ -75,7 +113,4 @@ function truncateMarkdown(source, maxChars) {
|
|
|
75
113
|
}
|
|
76
114
|
return out.join("\n\n");
|
|
77
115
|
}
|
|
78
|
-
function stripFrontmatter(s) {
|
|
79
|
-
return s.replace(/^---\r?\n[\s\S]*?\r?\n---\r?\n?/, "");
|
|
80
|
-
}
|
|
81
116
|
//# sourceMappingURL=preview.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"preview.js","sourceRoot":"","sources":["../../src/render/preview.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAClC,OAAO,WAAW,MAAM,cAAc,CAAC;AACvC,OAAO,SAAS,MAAM,YAAY,CAAC;AACnC,OAAO,YAAY,MAAM,eAAe,CAAC;AACzC,OAAO,cAAc,EAAE,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChE,OAAO,eAAe,MAAM,kBAAkB,CAAC;AAC/C,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"preview.js","sourceRoot":"","sources":["../../src/render/preview.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAClC,OAAO,WAAW,MAAM,cAAc,CAAC;AACvC,OAAO,SAAS,MAAM,YAAY,CAAC;AACnC,OAAO,YAAY,MAAM,eAAe,CAAC;AACzC,OAAO,SAAS,MAAM,YAAY,CAAC;AACnC,OAAO,cAAc,EAAE,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChE,OAAO,eAAe,MAAM,kBAAkB,CAAC;AAC/C,OAAO,EAAE,OAAO,EAAE,M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AC,yBAAyB,EAAE,EAAE,CAAC,CAAQ,uCAAuC;aACrF,KAAK,CAAC,IAAI,CAAC,CAAC,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,WAAW,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAE,qBAAqB;aACvF,IAAI,EAAE,CAAC;QACV,IAAI,CAAC,CAAC;YAAE,SAAS;QACjB,IAAI,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC;YAAE,SAAS,CAAkB,oBAAoB;QACrE,IAAI,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC;YAAE,SAAS,CAAqB,cAAc;QAC/D,8EAA8E;QAC9E,CAAC,GAAG,CAAC,CAAC,OAAO,CAAC,oEAAoE,EAChF,CAAC,CAAC,EAAE,IAAY,EAAE,KAAc,EAAE,EAAE,CAAC,KAAK,IAAI,IAAI,CAAC,CAAC;QACtD,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QACZ,KAAK,IAAI,CAAC,CAAC,MAAM,CAAC;QAClB,IAAI,KAAK,IAAI,QAAQ;YAAE,MAAM;IAC/B,CAAC;IACD,OAAO,GAAG,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;AAC1B,CAAC"}
|
package/dist/render/slug.js
CHANGED
|
@@ -9,4 +9,9 @@ export function slugify(name) {
|
|
|
9
9
|
.replace(/[^a-z0-9]+/g, "-")
|
|
10
10
|
.replace(/^-+|-+$/g, "");
|
|
11
11
|
}
|
|
12
|
+
// Historical alias retained for the bases plugin. The "sibling-import
|
|
13
|
+
// avoidance" comment in bases.ts predates the current shape of slug.ts (which
|
|
14
|
+
// has no imports of its own), so a direct re-export is fine — the alias is
|
|
15
|
+
// kept so existing call sites don't churn.
|
|
16
|
+
export { slugify as slugifySimple };
|
|
12
17
|
//# sourceMappingURL=slug.js.map
|
package/dist/render/slug.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"slug.js","sourceRoot":"","sources":["../../src/render/slug.ts"],"names":[],"mappings":"AAAA,+EAA+E;AAC/E,gFAAgF;AAChF,MAAM,UAAU,OAAO,CAAC,IAAY;IAClC,OAAO,IAAI;SACR,SAAS,CAAC,MAAM,CAAC;SACjB,OAAO,CAAC,QAAQ,EAAE,EAAE,CAAC;SACrB,WAAW,EAAE;SACb,OAAO,CAAC,QAAQ,EAAE,EAAE,CAAC;SACrB,OAAO,CAAC,aAAa,EAAE,GAAG,CAAC;SAC3B,OAAO,CAAC,UAAU,EAAE,EAAE,CAAC,CAAC;AAC7B,CAAC"}
|
|
1
|
+
{"version":3,"file":"slug.js","sourceRoot":"","sources":["../../src/render/slug.ts"],"names":[],"mappings":"AAAA,+EAA+E;AAC/E,gFAAgF;AAChF,MAAM,UAAU,OAAO,CAAC,IAAY;IAClC,OAAO,IAAI;SACR,SAAS,CAAC,MAAM,CAAC;SACjB,OAAO,CAAC,QAAQ,EAAE,EAAE,CAAC;SACrB,WAAW,EAAE;SACb,OAAO,CAAC,QAAQ,EAAE,EAAE,CAAC;SACrB,OAAO,CAAC,aAAa,EAAE,GAAG,CAAC;SAC3B,OAAO,CAAC,UAAU,EAAE,EAAE,CAAC,CAAC;AAC7B,CAAC;AAED,sEAAsE;AACtE,8EAA8E;AAC9E,2EAA2E;AAC3E,2CAA2C;AAC3C,OAAO,EAAE,OAAO,IAAI,aAAa,EAAE,CAAC"}
|
package/dist/render/styles.js
CHANGED
|
@@ -1,25 +1,42 @@
|
|
|
1
1
|
// Theme + layout styles for the rendered wiki. Self-contained, no build step.
|
|
2
2
|
// Single light theme: parchment + scarlet.
|
|
3
3
|
/**
|
|
4
|
-
* Per-vault theme overrides. When `accent_color
|
|
5
|
-
* settings.md, append this
|
|
6
|
-
* shades (--accent-soft,
|
|
7
|
-
*
|
|
4
|
+
* Per-vault theme overrides. When any of `accent_color`, `bg_color`,
|
|
5
|
+
* `accent_color_dark`, `bg_color_dark` are set in settings.md, append this
|
|
6
|
+
* block after DEFAULT_CSS so it wins. The derived shades (--accent-soft,
|
|
7
|
+
* --wikilink-bg, --rule, etc) are recomputed via color-mix so they stay
|
|
8
|
+
* coherent with whatever colors the user picked.
|
|
9
|
+
*
|
|
10
|
+
* Dark overrides target both the explicit `[data-theme="dark"]` selector
|
|
11
|
+
* and the auto/prefers-dark form, so a vault setting `bg_color_dark`
|
|
12
|
+
* applies whether the visitor forced dark or arrived via OS preference.
|
|
8
13
|
*/
|
|
9
14
|
export function renderThemeOverride(opts) {
|
|
10
15
|
const blocks = [];
|
|
11
16
|
if (opts.lightAccent)
|
|
12
17
|
blocks.push(accentBlock(":root", opts.lightAccent));
|
|
13
18
|
if (opts.lightBg)
|
|
14
|
-
blocks.push(bgBlock(":root", opts.lightBg));
|
|
19
|
+
blocks.push(bgBlock(":root", opts.lightBg, "light"));
|
|
20
|
+
if (opts.darkAccent) {
|
|
21
|
+
blocks.push(accentBlock(`:root[data-theme="dark"]`, opts.darkAccent));
|
|
22
|
+
blocks.push(`@media (prefers-color-scheme: dark) {\n${accentBlock(` :root[data-theme="auto"]`, opts.darkAccent)}\n}`);
|
|
23
|
+
}
|
|
24
|
+
if (opts.darkBg) {
|
|
25
|
+
blocks.push(bgBlock(`:root[data-theme="dark"]`, opts.darkBg, "dark"));
|
|
26
|
+
blocks.push(`@media (prefers-color-scheme: dark) {\n${bgBlock(` :root[data-theme="auto"]`, opts.darkBg, "dark")}\n}`);
|
|
27
|
+
}
|
|
15
28
|
if (!blocks.length)
|
|
16
29
|
return "";
|
|
17
30
|
return "\n\n/* User theme overrides (settings.md) */\n" + blocks.join("\n");
|
|
18
31
|
}
|
|
19
|
-
|
|
32
|
+
/** `--rule` is a slightly off-bg shade for hairlines + borders. In light
|
|
33
|
+
* mode that means "darker than bg"; in dark mode the relationship inverts
|
|
34
|
+
* to "lighter than bg" or the rule disappears against the background. */
|
|
35
|
+
function bgBlock(selector, color, mode) {
|
|
36
|
+
const tint = mode === "light" ? "#000" : "#fff";
|
|
20
37
|
return `${selector} {
|
|
21
38
|
--bg: ${color};
|
|
22
|
-
--rule: color-mix(in srgb, ${color} 85%,
|
|
39
|
+
--rule: color-mix(in srgb, ${color} 85%, ${tint});
|
|
23
40
|
}`;
|
|
24
41
|
}
|
|
25
42
|
function accentBlock(selector, color) {
|
|
@@ -38,6 +55,26 @@ export const DEFAULT_CSS = `:root {
|
|
|
38
55
|
--max-width: 56rem;
|
|
39
56
|
font-family: 'Iowan Old Style', 'Palatino Linotype', Georgia, serif;
|
|
40
57
|
}
|
|
58
|
+
/* Dark palette: deep warm bg, brighter scarlet for readable contrast.
|
|
59
|
+
Activates when settings.theme = "dark", or when the visitor's OS prefers
|
|
60
|
+
dark and settings.theme = "auto". The light defaults above are the base;
|
|
61
|
+
these vars override only when [data-theme=...] matches. */
|
|
62
|
+
:root[data-theme="dark"],
|
|
63
|
+
:root[data-theme="dark"] body {
|
|
64
|
+
--bg: #1d1a17; --fg: #e8dec8; --muted: #9a8e78;
|
|
65
|
+
--accent: #d35550; --accent-soft: #e87a75; --accent-fg: #1d1a17;
|
|
66
|
+
--rule: #3a342d;
|
|
67
|
+
--wikilink-bg: rgba(211,85,80,0.16); --wikilink-bg-hover: rgba(211,85,80,0.28);
|
|
68
|
+
}
|
|
69
|
+
@media (prefers-color-scheme: dark) {
|
|
70
|
+
:root[data-theme="auto"],
|
|
71
|
+
:root[data-theme="auto"] body {
|
|
72
|
+
--bg: #1d1a17; --fg: #e8dec8; --muted: #9a8e78;
|
|
73
|
+
--accent: #d35550; --accent-soft: #e87a75; --accent-fg: #1d1a17;
|
|
74
|
+
--rule: #3a342d;
|
|
75
|
+
--wikilink-bg: rgba(211,85,80,0.16); --wikilink-bg-hover: rgba(211,85,80,0.28);
|
|
76
|
+
}
|
|
77
|
+
}
|
|
41
78
|
* { box-sizing: border-box; }
|
|
42
79
|
body { margin: 0; background: var(--bg); color: var(--fg); line-height: 1.6; }
|
|
43
80
|
a { color: var(--accent); text-decoration: none; }
|
|
@@ -63,8 +100,18 @@ article a.internal.new, article a.internal.is-unresolved { opacity: 0.7; font-st
|
|
|
63
100
|
.app-grid {
|
|
64
101
|
display: grid; grid-template-columns: 15rem minmax(0, 56rem) 17rem;
|
|
65
102
|
gap: 2.5rem; max-width: 96rem; margin: 0 auto; padding: 1.5rem;
|
|
66
|
-
|
|
67
|
-
|
|
103
|
+
/* Sticky-footer plumbing: the grid fills the viewport so the main
|
|
104
|
+
column can stretch even when the article is short, and the flex
|
|
105
|
+
column inside main (below) pushes the footer to its bottom. */
|
|
106
|
+
min-height: 100vh; box-sizing: border-box;
|
|
107
|
+
}
|
|
108
|
+
main {
|
|
109
|
+
display: flex; flex-direction: column;
|
|
110
|
+
padding: 2rem 0 0; min-width: 0;
|
|
111
|
+
}
|
|
112
|
+
/* Article grows to absorb spare space; the footer falls naturally to
|
|
113
|
+
the bottom of main whatever the article's intrinsic height. */
|
|
114
|
+
main > article { flex: 1 0 auto; }
|
|
68
115
|
.sidebar { padding: 1.5rem 1.5rem 1.5rem 0; border-right: 1px solid var(--rule); font-size: 0.9rem; display: flex; flex-direction: column; gap: 0.6rem; }
|
|
69
116
|
/* Visual break between the header group (brand/search/auth) and the sitemap. */
|
|
70
117
|
.sidebar > nav:last-child { margin-top: 0.9rem; padding-top: 0.9rem; border-top: 1px solid var(--rule); }
|
|
@@ -78,7 +125,7 @@ main { padding: 2rem 0 4rem; min-width: 0; }
|
|
|
78
125
|
.app-grid { grid-template-columns: 1fr; gap: 0; padding: 0.75rem; max-width: 100%; }
|
|
79
126
|
.sidebar { border: none; padding: 0.5rem 0 0; }
|
|
80
127
|
.rightbar { display: none; }
|
|
81
|
-
main { padding: 0.5rem 0
|
|
128
|
+
main { padding: 0.5rem 0 0; }
|
|
82
129
|
article h1 { font-size: 2rem; }
|
|
83
130
|
article h2 { font-size: 1.4rem; }
|
|
84
131
|
}
|
|
@@ -121,6 +168,37 @@ main { padding: 2rem 0 4rem; min-width: 0; }
|
|
|
121
168
|
.search-result-folder { font-size: 0.72rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em; margin-top: 0.15rem; }
|
|
122
169
|
.search-empty { padding: 0.75rem; color: var(--muted); font-style: italic; font-size: 0.85rem; }
|
|
123
170
|
|
|
171
|
+
/* Sidebar row that holds the theme toggle (always present) and, on
|
|
172
|
+
multi-role builds, the auth box. Lays them out left-to-right with the
|
|
173
|
+
auth box absorbing remaining width so its existing button styling stays
|
|
174
|
+
correct regardless of theme-toggle width. */
|
|
175
|
+
.sidebar-row {
|
|
176
|
+
display: flex; align-items: center; gap: 0.5rem;
|
|
177
|
+
}
|
|
178
|
+
.sidebar-row > .auth-box { flex: 1; min-width: 0; }
|
|
179
|
+
|
|
180
|
+
/* Theme toggle: small square icon button matching the auth-box height so
|
|
181
|
+
they line up. Sun icon when current theme is dark (click → switch to
|
|
182
|
+
light); moon icon when current is light. The script paints the icon. */
|
|
183
|
+
.theme-toggle {
|
|
184
|
+
flex: 0 0 auto;
|
|
185
|
+
display: inline-flex; align-items: center; justify-content: center;
|
|
186
|
+
width: 2rem; height: 2rem;
|
|
187
|
+
padding: 0; margin: 0;
|
|
188
|
+
background: transparent;
|
|
189
|
+
color: var(--accent);
|
|
190
|
+
border: 1px solid var(--rule);
|
|
191
|
+
border-radius: 4px;
|
|
192
|
+
cursor: pointer;
|
|
193
|
+
transition: background 0.12s ease, border-color 0.12s ease, color 0.12s ease;
|
|
194
|
+
}
|
|
195
|
+
.theme-toggle:hover {
|
|
196
|
+
background: var(--wikilink-bg);
|
|
197
|
+
border-color: var(--accent-soft);
|
|
198
|
+
}
|
|
199
|
+
.theme-toggle .theme-toggle-icon { display: inline-flex; }
|
|
200
|
+
.theme-toggle .theme-toggle-icon svg { display: block; }
|
|
201
|
+
|
|
124
202
|
/* Auth box; sits under the search box; populated by JS from a non-HttpOnly
|
|
125
203
|
display cookie set by the Function on login. */
|
|
126
204
|
.auth-box {
|
|
@@ -145,7 +223,8 @@ main { padding: 2rem 0 4rem; min-width: 0; }
|
|
|
145
223
|
width: 100%;
|
|
146
224
|
display: block;
|
|
147
225
|
text-align: center;
|
|
148
|
-
padding: 0.
|
|
226
|
+
padding: 0.55rem 0.75rem;
|
|
227
|
+
line-height: 1;
|
|
149
228
|
border-radius: 4px;
|
|
150
229
|
border: 1px solid var(--accent);
|
|
151
230
|
background: transparent;
|
|
@@ -165,7 +244,8 @@ main { padding: 2rem 0 4rem; min-width: 0; }
|
|
|
165
244
|
/* Signed-in auth UI: keep status on the left and present Sign out as a
|
|
166
245
|
right-side action split by a divider. */
|
|
167
246
|
.auth-box.auth-signed-in {
|
|
168
|
-
|
|
247
|
+
height: 2rem;
|
|
248
|
+
padding: 0 0.35rem 0 0.65rem;
|
|
169
249
|
flex-wrap: nowrap;
|
|
170
250
|
gap: 0;
|
|
171
251
|
}
|
|
@@ -182,12 +262,12 @@ main { padding: 2rem 0 4rem; min-width: 0; }
|
|
|
182
262
|
align-items: center;
|
|
183
263
|
justify-content: center;
|
|
184
264
|
margin-left: auto;
|
|
185
|
-
padding: 0.
|
|
265
|
+
padding: 0.25rem 0.6rem;
|
|
186
266
|
border-left: 1px solid var(--rule);
|
|
187
267
|
border-radius: 0;
|
|
188
268
|
text-decoration: none;
|
|
189
269
|
font-weight: 600;
|
|
190
|
-
line-height: 1
|
|
270
|
+
line-height: 1;
|
|
191
271
|
white-space: nowrap;
|
|
192
272
|
}
|
|
193
273
|
.auth-box.auth-signed-in .auth-action:hover {
|
|
@@ -279,6 +359,20 @@ main { padding: 2rem 0 4rem; min-width: 0; }
|
|
|
279
359
|
.page-meta time { font-variant-numeric: tabular-nums; }
|
|
280
360
|
.page-meta .meta-sep { opacity: 0.5; }
|
|
281
361
|
|
|
362
|
+
/* Site-wide footer rendered from the footer setting (markdown). Sits
|
|
363
|
+
below the article, outside <article>, so it's clearly chrome and
|
|
364
|
+
doesn't get caught by article-scoped selectors. */
|
|
365
|
+
.site-footer {
|
|
366
|
+
margin: 2rem 0 0;
|
|
367
|
+
padding-top: 0.75rem;
|
|
368
|
+
border-top: 1px solid var(--rule);
|
|
369
|
+
text-align: center;
|
|
370
|
+
font-size: 0.8rem;
|
|
371
|
+
color: var(--muted);
|
|
372
|
+
}
|
|
373
|
+
.site-footer a { color: inherit; text-decoration: underline; text-decoration-color: var(--rule); }
|
|
374
|
+
.site-footer a:hover { color: var(--accent); text-decoration-color: var(--accent); }
|
|
375
|
+
|
|
282
376
|
.frontmatter-toggle {
|
|
283
377
|
display: inline-flex; align-items: center; gap: 0.35rem;
|
|
284
378
|
padding: 0.15rem 0.5rem;
|
|
@@ -407,7 +501,7 @@ article td > img:first-child:last-child {
|
|
|
407
501
|
/* Default size for ![[image]] embeds without an explicit |N hint. The
|
|
408
502
|
width itself is set by --default-img-width on <body>, configurable via
|
|
409
503
|
the default_image_width setting. */
|
|
410
|
-
article img.default-width { width: var(--default-img-width,
|
|
504
|
+
article img.default-width { width: var(--default-img-width, 300px); max-width: 100%; }
|
|
411
505
|
|
|
412
506
|
/* Centre images when settings.center_images is on. Scoped to standalone
|
|
413
507
|
<p><img></p> wrappers (Markdown emits these for image-only paragraphs)
|
|
@@ -752,6 +846,21 @@ article blockquote { margin: 1rem 0; padding: 0.5rem 1rem; border-left: 3px soli
|
|
|
752
846
|
.callout-dm { border-left-color: var(--accent); background: color-mix(in srgb, var(--accent) 12%, transparent); }
|
|
753
847
|
.callout-dm > .callout-title { color: var(--accent); }
|
|
754
848
|
|
|
849
|
+
/* Inline dice-roll buttons emitted by the built-in dice handler. */
|
|
850
|
+
button.dice-roll {
|
|
851
|
+
display: inline-block; padding: 0.05rem 0.5rem; margin: 0;
|
|
852
|
+
font: inherit; font-variant-numeric: tabular-nums;
|
|
853
|
+
background: var(--wikilink-bg); color: var(--accent);
|
|
854
|
+
border: 1px solid color-mix(in srgb, var(--accent) 40%, transparent);
|
|
855
|
+
border-radius: 4px; cursor: pointer; line-height: 1.4;
|
|
856
|
+
}
|
|
857
|
+
button.dice-roll:hover { background: color-mix(in srgb, var(--accent) 12%, transparent); }
|
|
858
|
+
code.dice-roll-invalid { color: var(--muted); text-decoration: line-through; }
|
|
859
|
+
|
|
860
|
+
/* Inline frontmatter values emitted by the built-in fm handler when the
|
|
861
|
+
key is missing — visible so authors notice the typo. */
|
|
862
|
+
code.fm-missing { color: #b94a3a; background: color-mix(in srgb, #b94a3a 10%, transparent); }
|
|
863
|
+
|
|
755
864
|
/* Embed (transcluded ![[Page]]) */
|
|
756
865
|
.embed {
|
|
757
866
|
position: relative; border-left: 3px solid var(--accent-soft);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"styles.js","sourceRoot":"","sources":["../../src/render/styles.ts"],"names":[],"mappings":"AAAA,8EAA8E;AAC9E,2CAA2C;AAE3C
|
|
1
|
+
{"version":3,"file":"styles.js","sourceRoot":"","sources":["../../src/render/styles.ts"],"names":[],"mappings":"AAAA,8EAA8E;AAC9E,2CAA2C;AAE3C;;;;;;;;;;GAUG;AACH,MAAM,UAAU,mBAAmB,CAAC,IAKnC;IACC,MAAM,MAAM,GAAa,EAAE,CAAC;IAC5B,IAAI,IAAI,CAAC,WAAW;QAAE,MAAM,CAAC,IAAI,CAAC,WAAW,CAAC,OAAO,EAAE,IAAI,CAAC,WAAW,CAAC,CAAC,CAAC;IAC1E,IAAI,IAAI,CAAC,OAAO;QAAE,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,OAAO,EAAE,IAAI,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC,CAAC;IACvE,IAAI,IAAI,CAAC,UAAU,EAAE,CAAC;QACpB,MAAM,CAAC,IAAI,CAAC,WAAW,CAAC,0BAA0B,EAAE,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC;QACtE,MAAM,CAAC,IAAI,CAAC,0CAA0C,WAAW,CAAC,4BAA4B,EAAE,IAAI,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC;IACzH,CAAC;IACD,IAAI,IAAI,CAAC,MAAM,EAAE,CAAC;QAChB,MAAM,CAAC,IAA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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAy0B1B,CAAC"}
|
package/dist/render/wikilink.js
CHANGED
|
@@ -1,8 +1,13 @@
|
|
|
1
1
|
import { findAndReplace } from "mdast-util-find-and-replace";
|
|
2
2
|
import { slugify } from "./slug.js";
|
|
3
|
-
// Matches [[Page]], [[Page|alias]], [[Page#anchor]], [[Page#anchor|alias]]
|
|
4
|
-
//
|
|
5
|
-
|
|
3
|
+
// Matches [[Page]], [[Page|alias]], [[Page#anchor]], [[Page#anchor|alias]],
|
|
4
|
+
// and chained [[Page#H1#H2]] (Obsidian's nested-heading form). Negative
|
|
5
|
+
// lookbehind blocks ![[embed]] from being consumed here.
|
|
6
|
+
//
|
|
7
|
+
// The anchor capture allows `#` so chained headings parse as a single
|
|
8
|
+
// anchor string; the resolver below splits on `#` and uses the deepest
|
|
9
|
+
// segment for the URL fragment.
|
|
10
|
+
const WIKILINK_RE = /(?<!!)(?<!\[)\[\[([^\[\]|#\n]+?)(?:#([^\[\]|\n]+?))?(?:\|([^\[\]#\n]+?))?\]\]/g;
|
|
6
11
|
export function wikiLinkPlugin(opts) {
|
|
7
12
|
return () => (tree) => {
|
|
8
13
|
findAndReplace(tree, [
|
|
@@ -10,7 +15,13 @@ export function wikiLinkPlugin(opts) {
|
|
|
10
15
|
WIKILINK_RE,
|
|
11
16
|
(_match, rawName, rawAnchor, rawAlias) => {
|
|
12
17
|
const name = rawName.trim();
|
|
13
|
-
|
|
18
|
+
// Chained heading anchors like `H1#H2` resolve to the deepest segment
|
|
19
|
+
// (the actual heading the reader lands on); the URL fragment is just
|
|
20
|
+
// that final slug since rehype-slug emits one slug per heading.
|
|
21
|
+
const rawAnchorTrimmed = rawAnchor?.trim();
|
|
22
|
+
const anchor = rawAnchorTrimmed?.includes("#")
|
|
23
|
+
? rawAnchorTrimmed.split("#").map((s) => s.trim()).filter(Boolean).pop()
|
|
24
|
+
: rawAnchorTrimmed;
|
|
14
25
|
const display = rawAlias?.trim() ?? name;
|
|
15
26
|
const slug = slugify(name);
|
|
16
27
|
// Resolution order:
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"wikilink.js","sourceRoot":"","sources":["../../src/render/wikilink.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC;AAE7D,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC,4EAA4E;AAC5E,
|
|
1
|
+
{"version":3,"file":"wikilink.js","sourceRoot":"","sources":["../../src/render/wikilink.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC;AAE7D,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC,4EAA4E;AAC5E,wEAAwE;AACxE,yDAAyD;AACzD,EAAE;AACF,sEAAsE;AACtE,uEAAuE;AACvE,gCAAgC;AAChC,MAAM,WAAW,GAAG,gFAAgF,CAAC;AAErG,MAAM,UAAU,cAAc,CAAC,IAM9B;IACC,OAAO,GAAG,EAAE,CAAC,CAAC,IAAI,EAAE,EAAE;QACpB,cAAc,CAAC,IAAI,E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,KAAK,EAAE,OAAO,EAAiB,CAAC;wBAC3D,IAAI,EAAE,EAAE,WAAW,EAAE,EAAE,SAAS,EAAE,EAAE;qBACrC,CAAC;oBACF,OAAO,IAAI,CAAC;gBACd,CAAC;aACF;SACF,CAAC,CAAC;IACL,CAAC,CAAC;AACJ,CAAC"}
|
package/dist/scan.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { readdir, readFile, stat } from "node:fs/promises";
|
|
2
2
|
import { createHash } from "node:crypto";
|
|
3
3
|
import { join, relative, sep } from "node:path";
|
|
4
|
-
const IGNORED_DIRS = new Set([".git", ".obsidian", ".trash", "node_modules", ".
|
|
4
|
+
const IGNORED_DIRS = new Set([".git", ".obsidian", ".trash", "node_modules", ".vaults"]);
|
|
5
5
|
const IGNORED_FILES = new Set([".DS_Store", ".vaultrc.json"]);
|
|
6
6
|
export async function scanVault(root) {
|
|
7
7
|
const out = [];
|
package/dist/scan.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"scan.js","sourceRoot":"","sources":["../src/scan.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAC3D,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,GAAG,EAAE,MAAM,WAAW,CAAC;AAgBhD,MAAM,YAAY,GAAG,IAAI,GAAG,CAAC,CAAC,MAAM,EAAE,WAAW,EAAE,QAAQ,EAAE,cAAc,EAAE,
|
|
1
|
+
{"version":3,"file":"scan.js","sourceRoot":"","sources":["../src/scan.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAC3D,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,GAAG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UAAU,CAAC,GAAG,CAAC;YAAE,SAAS;QAEzC,MAAM,IAAI,GAAG,MAAM,QAAQ,CAAC,GAAG,CAAC,CAAC;QACjC,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,GAAG,CAAC,CAAC;QAC7B,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,CAAC;QAC9C,yEAAyE;QACzE,uCAAuC;QACvC,MAAM,QAAQ,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC,CAAC;QACrD,MAAM,SAAS,GAAG,QAAQ,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC;QAClD,GAAG,CAAC,IAAI,CAAC;YACP,IAAI,EAAE,QAAQ,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC;YAC9C,QAAQ,EAAE,GAAG;YACb,IAAI,EAAE,IAAI,CAAC,IAAI;YACf,IAAI,EAAE,UAAU,CAAC,KAAK,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC;YAClD,KAAK;YACL,SAAS;SACV,CAAC,CAAC;IACL,CAAC;AACH,CAAC"}
|
package/dist/settings.js
CHANGED
|
@@ -28,9 +28,9 @@ const SCHEMA = {
|
|
|
28
28
|
description: "Inject the page title as an <h1> at the top. Set false if your notes already start with a '# Title' heading and you don't want the duplicate.",
|
|
29
29
|
},
|
|
30
30
|
default_image_width: {
|
|
31
|
-
default: "
|
|
31
|
+
default: "300px",
|
|
32
32
|
type: "string",
|
|
33
|
-
description: "CSS width applied to images embedded without an explicit '|N' size hint. Any valid CSS dimension works (
|
|
33
|
+
description: "CSS width applied to images embedded without an explicit '|N' size hint. Any valid CSS dimension works (300px, 50vw, 100%, etc). Set empty string to leave images at natural size.",
|
|
34
34
|
},
|
|
35
35
|
center_images: {
|
|
36
36
|
default: true,
|
|
@@ -50,7 +50,22 @@ const SCHEMA = {
|
|
|
50
50
|
bg_color: {
|
|
51
51
|
default: "",
|
|
52
52
|
type: "string",
|
|
53
|
-
description: "Override the background color. Any CSS color works: '#f4ecd8', 'wheat', 'rgb(244 236 216)'. Empty = use the built-in parchment.",
|
|
53
|
+
description: "Override the background color for the light palette. Any CSS color works: '#f4ecd8', 'wheat', 'rgb(244 236 216)'. Empty = use the built-in parchment.",
|
|
54
|
+
},
|
|
55
|
+
accent_color_dark: {
|
|
56
|
+
default: "",
|
|
57
|
+
type: "string",
|
|
58
|
+
description: "Override the accent color for the dark palette. Any CSS color works. Empty = use the built-in dark accent (a brighter scarlet).",
|
|
59
|
+
},
|
|
60
|
+
bg_color_dark: {
|
|
61
|
+
default: "",
|
|
62
|
+
type: "string",
|
|
63
|
+
description: "Override the background color for the dark palette. Any CSS color works. Empty = use the built-in deep warm dark.",
|
|
64
|
+
},
|
|
65
|
+
theme: {
|
|
66
|
+
default: "auto",
|
|
67
|
+
type: "string",
|
|
68
|
+
description: "Default colour theme: 'auto' (follows the visitor's OS preference), 'light' (parchment + scarlet), or 'dark'. Visitors can flip via the sidebar toggle; their choice persists in localStorage.",
|
|
54
69
|
},
|
|
55
70
|
favicon: {
|
|
56
71
|
default: "",
|
|
@@ -67,8 +82,14 @@ const SCHEMA = {
|
|
|
67
82
|
type: "boolean",
|
|
68
83
|
description: "Ship files with unrecognized extensions to every deploy variant. Default false skips them (with a warning) so a stray file in your vault can't accidentally bypass role gating. Recognized media types (audio/video/pdf/epub) are reference-gated like images regardless of this setting.",
|
|
69
84
|
},
|
|
85
|
+
footer: {
|
|
86
|
+
default: "Generated with [Wizzlethorpe Vaults](https://vaults.wizzlethorpe.com).",
|
|
87
|
+
type: "string",
|
|
88
|
+
description: "Markdown text rendered in a small <footer> at the bottom of every page. Supports inline markdown (links, *italic*, **bold**). Set to an empty string to hide the footer entirely.",
|
|
89
|
+
},
|
|
70
90
|
};
|
|
71
|
-
export
|
|
91
|
+
export { SETTINGS_FILE } from "./paths.js";
|
|
92
|
+
import { SETTINGS_FILE } from "./paths.js";
|
|
72
93
|
/**
|
|
73
94
|
* Read settings.md from a vault, normalise its values against the schema,
|
|
74
95
|
* fill defaults, and surface warnings for unknown keys.
|