mirror of
https://github.com/TriliumNext/Notes.git
synced 2025-08-01 20:52:27 +08:00
feat(export/single): mermaid with right extension and MIME
This commit is contained in:
parent
6ab820f172
commit
16cbd2f793
17
src/services/export/single.spec.ts
Normal file
17
src/services/export/single.spec.ts
Normal file
@ -0,0 +1,17 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
import BNote from "../../becca/entities/bnote.js";
|
||||
import { mapByNoteType } from "./single.js";
|
||||
|
||||
describe("Note type mappings", () => {
|
||||
it("supports mermaid note", () => {
|
||||
const note = new BNote({
|
||||
type: "mermaid",
|
||||
title: "New note"
|
||||
});
|
||||
|
||||
expect(mapByNoteType(note, "", "html")).toMatchObject({
|
||||
extension: "mermaid",
|
||||
mime: "text/vnd.mermaid"
|
||||
});
|
||||
});
|
||||
});
|
@ -65,6 +65,10 @@ export function mapByNoteType(note: BNote, content: string | Buffer<ArrayBufferL
|
||||
payload = content;
|
||||
extension = "excalidraw";
|
||||
mime = "application/json";
|
||||
} else if (note.type === "mermaid") {
|
||||
payload = content;
|
||||
extension = "mermaid";
|
||||
mime = "text/vnd.mermaid";
|
||||
} else if (note.type === "relationMap" || note.type === "search") {
|
||||
payload = content;
|
||||
extension = "json";
|
||||
|
Loading…
x
Reference in New Issue
Block a user