summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlbert Krewinkel <albert@zeitkraut.de>2023-03-14 07:16:18 +0100
committerAlbert Krewinkel <albert@zeitkraut.de>2023-03-14 07:22:11 +0100
commiteffca7f7cf7afeb381154f77e33a16b7b19c02b7 (patch)
tree0b882954fbf4cf94504ceb0e2bf82e40f9f6c016
parent32e351ba8bfe159233acd69e6ac2f51baa5bcb1d (diff)
Markdown writer: use implicit figures if there's a caption but no alt.
Closes: #8689
-rw-r--r--src/Text/Pandoc/Writers/Markdown.hs2
-rw-r--r--test/8689.md11
2 files changed, 12 insertions, 1 deletions
diff --git a/src/Text/Pandoc/Writers/Markdown.hs b/src/Text/Pandoc/Writers/Markdown.hs
index 6822c6c1a..43b2e7d5b 100644
--- a/src/Text/Pandoc/Writers/Markdown.hs
+++ b/src/Text/Pandoc/Writers/Markdown.hs
@@ -677,7 +677,7 @@ blockToMarkdown' opts (Figure figattr capt body) = do
then Just [Str "image"]
else Just alt
Caption Nothing [Plain captInlines]
- | captInlines == alt -> Just captInlines
+ | captInlines == alt || null alt -> Just captInlines
_ -> Nothing
case body of
[Plain [Image imgAttr alt (src, ttl)]]
diff --git a/test/8689.md b/test/8689.md
new file mode 100644
index 000000000..3b1c2e993
--- /dev/null
+++ b/test/8689.md
@@ -0,0 +1,11 @@
+# Org figures should be rendered implicit figures
+
+```
+% pandoc -f org -t markdown+implicit_figures
+#+label: fig:bsdd-graphql-voyager-orig-detail
+#+caption: Original bSDD GraphQL Schema: Detail of Classification and ClassificationProperty
+[[./Classification-ClassificationProperty.png]]
+^D
+![Original bSDD GraphQL Schema: Detail of Classification and
+ClassificationProperty](./Classification-ClassificationProperty.png)
+``` \ No newline at end of file