Deploy deepseek 2
Some checks failed
Test / test (push) Failing after 2s
Build and Deploy Nuxt / build (push) Successful in 1m51s

This commit is contained in:
2026-10-19 19:04:28 +02:00
parent b5d5e570d5
commit 1ec29121e1
45 changed files with 3438 additions and 166 deletions

View File

@@ -88,6 +88,32 @@ const inlineExtension = {
},
};
// `![[Name]]` embeds the entry itself instead of linking it: the note mounts a card with the
// character's sheet or the item's description where the token was written.
const embedExtension = {
name: "embed",
level: "inline",
start(src) {
return src.indexOf("![[");
},
tokenizer(src) {
const rule = /^!\[\[([^\n]*)\]\]/;
const match = rule.exec(src);
if (!match) return;
return {
type: "embed",
raw: match[0],
link: match[1],
};
},
renderer(token) {
return `<span class="vue-embed" data-href="${escapeAttr(token.link)}"></span>`;
},
};
const linkExtension = {
name: "link_to",
level: "inline",
@@ -108,16 +134,32 @@ const linkExtension = {
},
renderer(token) {
return `<span class="vue-link" data-href="${escapeAttr(token.link)}">Link</span>`;
// The link shows the entry's name, not a generic "Link", so a note reads as written. The
// note looks the target up by this label and turns the span into a preview link.
const label = String(token.link ?? "").trim() || token.link;
return `<span class="vue-link" data-href="${escapeAttr(token.link)}" role="link" tabindex="0">${escapeAttr(label)}</span>`;
},
};
marker.use({
extensions: [extension, inlineExtension, linkExtension],
// The embed comes before the link: at the `!` of `![[…]]` the embed tokenizer is offered first,
// so the same label written with the bang does not fall through to the plain link.
extensions: [extension, inlineExtension, embedExtension, linkExtension],
});
function ParseMarkdown(source) {
return marker.parse(source || "");
}
export { ParseMarkdown, GetWidget };
// The widgets a note can use, as `{ inline: [...names], display: [...names] }`. The note editor's
// `@` autocomplete reads this, so a widget added to `widget_map` is offered there without any other
// change.
const GetWidgetRegistry = () => {
const registry = {};
for (const type of Object.keys(widget_map)) {
registry[type] = Object.keys(widget_map[type]);
}
return registry;
};
export { ParseMarkdown, GetWidget, GetWidgetRegistry };