add DOCX support to Mermaid diagram rendering
- Transform.hs: DOCX case returns blocks unchanged (no unicode substitution needed) - Mermaid.hs: DOCX uses PNG images at normal scale (like HTML, not 3x like PDF)
This commit is contained in:
parent
f4dab3e354
commit
f016950ac7
1
.gitignore
vendored
1
.gitignore
vendored
@ -18,4 +18,5 @@ stack-setup-2.yaml
|
|||||||
analytics-charts.md
|
analytics-charts.md
|
||||||
architecture-deep-dive.md
|
architecture-deep-dive.md
|
||||||
devcontainer.org
|
devcontainer.org
|
||||||
|
.devcontainer/
|
||||||
root.json
|
root.json
|
||||||
|
|||||||
@ -79,6 +79,8 @@ generateDiagramPaths (DiagramConfig _ (OutputDir outDir) format) (DiagramId diag
|
|||||||
in (svgFile, T.pack $ takeFileName svgFile)
|
in (svgFile, T.pack $ takeFileName svgFile)
|
||||||
PDF -> let pngFile = outDir </> diagIdStr <> ".png"
|
PDF -> let pngFile = outDir </> diagIdStr <> ".png"
|
||||||
in (pngFile, T.pack pngFile)
|
in (pngFile, T.pack pngFile)
|
||||||
|
DOCX -> let pngFile = outDir </> diagIdStr <> ".png"
|
||||||
|
in (pngFile, T.pack pngFile)
|
||||||
|
|
||||||
-- | Puppeteer configuration content for disabling sandbox
|
-- | Puppeteer configuration content for disabling sandbox
|
||||||
puppeteerConfigContent :: Text
|
puppeteerConfigContent :: Text
|
||||||
@ -90,6 +92,7 @@ callMermaidProcess format mmdFile outputFile = do
|
|||||||
let baseArgs = case format of
|
let baseArgs = case format of
|
||||||
HTML -> ["-i", mmdFile, "-o", outputFile]
|
HTML -> ["-i", mmdFile, "-o", outputFile]
|
||||||
PDF -> ["-i", mmdFile, "-o", outputFile, "--scale", "3"]
|
PDF -> ["-i", mmdFile, "-o", outputFile, "--scale", "3"]
|
||||||
|
DOCX -> ["-i", mmdFile, "-o", outputFile]
|
||||||
|
|
||||||
-- Create temporary puppeteer config file
|
-- Create temporary puppeteer config file
|
||||||
result <- bracket
|
result <- bracket
|
||||||
|
|||||||
@ -36,8 +36,9 @@ transformDocument config docName (Pandoc meta blocks) = do
|
|||||||
Left err -> return $ Left err
|
Left err -> return $ Left err
|
||||||
Right (newBlocks, _finalState) ->
|
Right (newBlocks, _finalState) ->
|
||||||
case dcOutputFormat config of
|
case dcOutputFormat config of
|
||||||
PDF -> return $ Right $ substituteUnicodeSymbols (Pandoc meta newBlocks)
|
PDF -> return $ Right $ substituteUnicodeSymbols (Pandoc meta newBlocks)
|
||||||
HTML -> return $ Right $ Pandoc meta newBlocks
|
HTML -> return $ Right $ Pandoc meta newBlocks
|
||||||
|
DOCX -> return $ Right $ Pandoc meta newBlocks
|
||||||
|
|
||||||
-- | Process a single block with heading tracking state
|
-- | Process a single block with heading tracking state
|
||||||
processBlockStateful :: DiagramConfig -> Block -> TransformM Block
|
processBlockStateful :: DiagramConfig -> Block -> TransformM Block
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user