Excalidraw embed image Proof of Concept

This commit is contained in:
saberzero1 2024-09-02 22:08:24 +02:00
parent 01fc26d2c0
commit bf9d0092a9
No known key found for this signature in database
GPG Key ID: 41AEE99107640F10
3 changed files with 15 additions and 0 deletions

View File

@ -0,0 +1,9 @@
import { QuartzFilterPlugin } from "../types"
export const RemoveExcalidrawMarkdown: QuartzFilterPlugin = () => ({
name: "RemoveExcalidrawMarkdown",
shouldPublish(_ctx, [_tree, vfile]) {
const publishFlag: boolean = !vfile.basename?.match(/\.excalidraw\./) || false
return !publishFlag
},
})

View File

@ -1,2 +1,3 @@
export { RemoveDrafts } from "./draft"
export { RemoveExcalidrawMarkdown } from "./excalidraw"
export { ExplicitPublish } from "./explicit"

View File

@ -226,6 +226,11 @@ export const ObsidianFlavoredMarkdown: QuartzTransformerPlugin<Partial<Options>>
const anchor = rawHeader?.trim() ?? ""
const alias = rawAlias?.slice(1).trim()
// excalidraw
if (fp.match(/\.excalidraw\./)) {
fp.replace(".excalidraw", "")
}
// embed cases
if (value.startsWith("!")) {
const ext: string = path.extname(fp).toLowerCase()