Unable to render mermaid diagrams on PDF generation.
Hi @StefanSSSchroeder During the process of generating PDF documents from Markdown source files, we faced an issue with rendering Mermaid diagrams. Mermaid diagrams, which are written within the Markdown source using Mermaid syntax, do not display diagram in pdf file, this is observed while using CI configuration to build.
Note – Rendering Mermaid diagrams in PDF is successful with the same plugin on local environment but failing while using in CI.
pandoc-mermaid-filter is used. This filter is supported with pandoc hence is said to process Mermaid diagrams during the pdf conversion process.
pandoc-mermaid-filter requires node and npm environment, hence using the docker image node:lts-bookworm. Read about pandoc-mermaid-filter from the below link.
https://gist.github.com/letientai299/2c974b4f5e7b05be52d369ff8693c29a#file-mermaid-pandoc-guide-pdf
current ci configuration
image:
name: node:lts-bookworm
entrypoint: [""]
build:
script:
- cat /etc/os-release
- npm i -g mermaid-filter
- apt update && DEBIAN_FRONTEND=noninteractive apt install -y pandoc texlive-xetex curl unzip fonts-noto-core
- tlmgr update --self && tlmgr install titlesec noto
- mkdir output
- curl -L https://fonts.google.com/download?family=PT%20Sans%20Narrow > output/pt.zip
- unzip -q output/pt.zip -d /usr/share/fonts
- fc-cache -f && rm -rf /var/cache/*
- bash generate_docs.sh
artifacts:
paths:
- "output"
Updated generate_docs.sh with
pandoc $out_md --template=$TEMPLATE --pdf-engine=$ENGINE --metadata-file=$METADATA -F mermaid-filter -o $out_pdf
I am attaching the logs link of observed errors refer(Lines 1629 -1691, Lines 1824 -1890) in build log below.
https://gitlab.com/cip-project/cip-documents/-/jobs/5159840505
Currently trying to debug this error by installing necessary packages. Got to know from @dinesh-toshiba that you currently using mermaid tool in your work, could you please review these logs and provide inputs on this.
Thanks & Regards
Zaiba Sanglikar