Files
ragas/mkdocs-pdf.yml
ASWIN C G f6e8c76951 feat(docs): add offline mermaid support to PDF export (#2530)
## Issue Link / Problem Description
- Fixes https://github.com/vibrantlabsai/ragas/issues/2529

## Changes Made
- Added the `mkdocs-mermaid-to-svg` plugin to the `docs-pdf` dependency
group in `pyproject.toml`.
- Configured `mkdocs-pdf.yml` to use `mermaid-to-svg` (gated by
`ENABLE_PDF_EXPORT`), converting Mermaid diagrams to SVG images before
PDF generation.
- Added a new `check-mermaid-deps` Makefile target to verify Node.js and
Mermaid CLI (`mmdc`) are available before PDF build.
- Updated the PDF export documentation to mention offline Mermaid
rendering requirements.

## Testing
### How to Test
- [ ] Automated tests added/updated
- [ ] Manual testing steps:
  1. Run `make build-docs-pdf` in your local environment.
2. Open `site/pdf/document.pdf` and verify that Mermaid diagrams are
rendered as SVGs (not as raw code blocks).
3. Confirm that HTML builds (via `make build-docs` or `make serve-docs`)
are unaffected.

## References
- Documentation: `docs/community/pdf_export.md`
2025-12-22 11:19:54 +05:30

56 lines
1.6 KiB
YAML

# This file inherits settings from mkdocs.yml but adds the PDF plugin.
# We separate this to avoid forcing 'weasyprint' dependencies on all developers.
INHERIT: ./mkdocs.yml
plugins:
- social:
enabled: !ENV [MKDOCS_CI, true]
# --- Mermaid PLUGIN (Exclusive to this file) ---
- mermaid-to-svg:
enabled_if_env: ENABLE_PDF_EXPORT
mmdc_path: "mmdc"
error_on_fail: true
mermaid_config:
htmlLabels: false
flowchart:
htmlLabels: false
class:
htmlLabels: false
# --- PDF PLUGIN (Exclusive to this file) ---
- to-pdf:
enabled_if_env: ENABLE_PDF_EXPORT
author: RAGAS Team
copyright: RAGAS Contributors
cover_title: RAGAS Documentation
cover_subtitle: Evaluation Framework for AI Applications
exclude_pages:
- 'community/'
output_path: pdf/document.pdf
# -------------------------------------------
- search
- git-revision-date-localized:
enabled: !ENV [MKDOCS_CI, false]
enable_creation_date: true
- git-committers:
enabled: !ENV [MKDOCS_CI, false]
repository: vibrantlabsai/ragas
branch: main
- mkdocstrings:
handlers:
python:
paths: [src]
options:
docstring_style: numpy
members_order: source
separate_signature: true
filters: ["!^_"]
docstring_options:
ignore_init_summary: true
merge_init_into_class: true
show_signature_annotations: true
signature_crossrefs: true
- glightbox