feat: init

This commit is contained in:
hh
2026-08-08 16:30:22 +02:00
commit 8a609da778
59 changed files with 10053 additions and 0 deletions
+57
View File
@@ -0,0 +1,57 @@
export class TFile {
constructor(
public path: string,
public extension = "md",
) {}
}
export class TFolder {
constructor(public path: string) {}
}
export const notices: string[] = [];
export class Notice {
constructor(message: string) {
notices.push(message);
}
hide(): void {}
}
export class Plugin {}
export class ItemView {}
export class PluginSettingTab {}
export class Setting {}
export class Component {}
export const moment = () => undefined;
function escapeHtml(value: string): string {
return value
.replace(/&/g, "&")
.replace(/</g, "&lt;")
.replace(/>/g, "&gt;");
}
export const MarkdownRenderer = {
async render(
_app: unknown,
markdown: string,
el: HTMLElement,
_sourcePath: string,
_component: unknown,
): Promise<void> {
const html = escapeHtml(markdown)
.replace(
/!?\[\[([^\]|]+)(?:\|([^\]]+))?\]\]/g,
(_full, target: string, alias?: string) =>
`<a class="internal-link" href="${target}">${alias ?? target}</a>`,
)
.replace(/\*\*([^*]+)\*\*/g, "<strong>$1</strong>")
.replace(
/(^|\s)(https?:\/\/[^\s]+)/g,
(_full, lead: string, url: string) =>
`${lead}<a class="external-link" href="${url}">${url}</a>`,
);
el.innerHTML = `<p>${html}</p>`;
},
};