Commit 95139850 authored by Miguel Angel Reina Ortega's avatar Miguel Angel Reina Ortega
Browse files

Fix mermaid filter to produce always a Word figure

parent 0e0d3719
Loading
Loading
Loading
Loading
Loading
+3 −9
Changes for generateBaseline/mermaid-filter.js: 3 added lines, 9 removed lines.
Original line number Diff line number Diff line
@@ -117,20 +117,14 @@ function renderMermaid(el, caption) {
	const captionInlines = Array.isArray(caption) ? caption : [];
	const image = {
		t: 'Image',
		c: [[id, [], []], captionInlines, [src, captionInlines.length ? 'fig:' : '']]
		c: [[id, [], []], captionInlines, [src, 'fig:']]
	};
	if (!captionInlines.length) {
		return {
			t: 'Para',
			c: [image]
		};
	}
	// Pandoc 3+ docx writer only styles a caption for Figure blocks.
	// Always a Figure so docx postprocessing can style mermaid like other figures.
	return {
		t: 'Figure',
		c: [
			[id, [], []],
			[null, [{ t: 'Plain', c: captionInlines }]],
			[null, captionInlines.length ? [{ t: 'Plain', c: captionInlines }] : []],
			[{ t: 'Plain', c: [image] }]
		]
	};