From c4bc77402e0b3d9e871c1b7c265d313a6e151199 Mon Sep 17 00:00:00 2001 From: Narayan Sainaney Date: Fri, 24 Sep 2021 02:12:27 -0700 Subject: [PATCH] Chg: Treat SVG files as embeddable images This will ensure SVG files are included as an image when using `![[foo.svg]]` syntax, as opposed to only being linked to. --- src/lib.rs | 2 +- tests/testdata/expected/main-samples/embeds.md | 2 ++ tests/testdata/input/main-samples/bulb.svg | 1 + tests/testdata/input/main-samples/embeds.md | 2 ++ 4 files changed, 6 insertions(+), 1 deletion(-) create mode 100644 tests/testdata/input/main-samples/bulb.svg diff --git a/src/lib.rs b/src/lib.rs index 0222d07..1b52a09 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -627,7 +627,7 @@ impl<'a> Exporter<'a> { } events } - Some("png") | Some("jpg") | Some("jpeg") | Some("gif") | Some("webp") => { + Some("png") | Some("jpg") | Some("jpeg") | Some("gif") | Some("webp") | Some("svg") => { self.make_link_to_file(note_ref, &child_context) .into_iter() .map(|event| match event { diff --git a/tests/testdata/expected/main-samples/embeds.md b/tests/testdata/expected/main-samples/embeds.md index eb5d7c2..6ac6c95 100644 --- a/tests/testdata/expected/main-samples/embeds.md +++ b/tests/testdata/expected/main-samples/embeds.md @@ -11,6 +11,8 @@ Image embed: ![white.png](white.png) +![bulb.svg](bulb.svg) + PDF embed: [note.pdf](note.pdf) diff --git a/tests/testdata/input/main-samples/bulb.svg b/tests/testdata/input/main-samples/bulb.svg new file mode 100644 index 0000000..3eb07fd --- /dev/null +++ b/tests/testdata/input/main-samples/bulb.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/tests/testdata/input/main-samples/embeds.md b/tests/testdata/input/main-samples/embeds.md index 4b91bab..94fbd57 100644 --- a/tests/testdata/input/main-samples/embeds.md +++ b/tests/testdata/input/main-samples/embeds.md @@ -10,6 +10,8 @@ Image embed: ![[white.png]] +![[bulb.svg]] + PDF embed: ![[note.pdf]]