Skip to content

Commit 72554c6

Browse files
committed
refactor: change fromString variable to formatName, improve comments
1 parent 9a6e0b2 commit 72554c6

File tree

1 file changed

+15
-5
lines changed

1 file changed

+15
-5
lines changed

index.ts

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -59,13 +59,23 @@ export const handler = async function (
5959
markdown: string,
6060
implicitFigures: boolean = false
6161
) => {
62-
// pandoc source format
63-
// If implicitFigures, enable the implicit_figures extension and add image captions
64-
const fromString = implicitFigures ? "markdown+implicit_figures" : "markdown-implicit_figures";
62+
// Use standard Pandoc style via format name `markdown`
63+
// (see https://pandoc.org/chunkedhtml-demo/3.1-general-options.html)
64+
//
65+
// The "+implicit_figures" extension wraps images in figures and uses the image's alt text as the caption.
66+
// NOTE: The "Figure X." prefix is removed in the LaTeX template via:
67+
// ```tex
68+
// % Remove "Figure X." prefix from captions
69+
// \usepackage{caption}
70+
// \captionsetup[figure]{labelformat=empty}
71+
// ```
72+
//
73+
// If `implicitFigures`, enable the `implicit_figures`, disable otherwise...
74+
const formatName = implicitFigures ? "markdown+implicit_figures" : "markdown-implicit_figures";
6575

6676
try {
6777
await pdcTs.Execute({
68-
from: fromString,
78+
from: formatName,
6979
to: "latex", // pandoc output format
7080
pandocArgs,
7181
spawnOpts: { argv0: "+RTS -M512M -RTS" },
@@ -82,7 +92,7 @@ export const handler = async function (
8292
}
8393

8494
const TeXoutput = await pdcTs.Execute({
85-
from: fromString,
95+
from: formatName,
8696
to: "latex", // pandoc output format
8797
pandocArgs,
8898
outputToFile: false, // Controls whether the output will be returned as a string or written to a file

0 commit comments

Comments
 (0)