7 Commits

Author SHA1 Message Date
7f1f1aeeb0 Fix PDF diagram text rendering with format-optimized generation
Problem: SVG diagrams had missing text in PDFs due to Inkscape conversion
issues with foreignObject elements used by Mermaid for HTML text rendering.

Solution: Implement format-specific optimal generation:
- HTML: SVG files for perfect vector scaling and text rendering
- PDF: High-resolution PNG files (3x scale) for sharp images with readable text

Changes:
- Generate SVG for HTML output using standard mmdc command
- Generate PNG for PDF output using mmdc with --scale 3 for high resolution
- Remove SVG LaTeX package dependency and Inkscape requirement
- Update documentation to reflect the dual-format approach

Results:
- HTML: Crisp, scalable vector diagrams with perfect text
- PDF: Sharp, high-resolution raster diagrams with clear text
- No external dependencies beyond mermaid-cli

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-07-29 19:20:13 +02:00
4aab281f4b Fix broken diagram links by implementing format-aware image paths
Problem: HTML output contained broken image links because all formats
used the same full path (e.g., living-documentation/diagram-536389.png).
This worked for PDFs but failed for HTML since both files are in the
same directory and need relative paths.

Solution:
- Add output format detection with isHTMLOutput function
- Update processMermaidBlock to take OutputPath parameter
- Generate context-appropriate paths:
  * HTML: relative path (diagram-536389.png)
  * PDF: full path (living-documentation/diagram-536389.png)
- Update transformDocument and compilation functions to pass output path

Both HTML and PDF generation now work correctly with proper image embedding.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-07-29 19:06:14 +02:00
1a92427b90 Refactor Haskell code for better maintainability and safety
Major improvements:
- Add custom DocsterError type with proper exception handling
- Introduce type-safe newtypes (SourceDir, OutputPath, DiagramId)
- Consistent Text usage throughout, eliminating String/Text mixing
- Extract LaTeX template generation into separate functions
- Add resource cleanup with bracket pattern for temporary files
- Improve function naming and comprehensive documentation
- Extract constants for better maintainability
- Remove all unused imports and fix compiler warnings

The refactored code maintains identical functionality while being
much more maintainable, type-safe, and following Haskell best practices.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-07-29 18:54:21 +02:00
90891d3797 Fix LaTeX PDF generation by adding comprehensive package support
- Add fancyvrb package and Shaded environment for syntax highlighting
- Include amsmath and amssymb packages for mathematical symbols
- Switch from pdflatex to xelatex with fontspec for Unicode support
- Add complete set of syntax highlighting commands for code blocks
- Fix directory-relative Mermaid file generation

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-07-29 18:26:15 +02:00
0bbff27b44 Set maximum width, no warnings in chromium 2025-07-29 17:47:50 +02:00
e248395557 Fix Haskell project setup and implement Mermaid processing
- Update docster.cabal to modern format with GHC 9.12.2 compatibility
- Fix Mermaid code block detection using getDefaultExtensions
- Switch from SVG to PNG output for PDF compatibility
- Add CLAUDE.md with development instructions
- Update tooling from mise to ghcup for Haskell management

Known issues:
- Generated diagram files are created in root directory instead of alongside source files
- PDF generation fails with LaTeX errors for complex documents (missing \tightlist support)
- HTML output lacks proper DOCTYPE (quirks mode)
- Debug output still present in code

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-07-29 17:23:04 +02:00
68507e85d1 initial version generated by chatgpt, but cabal file does not work 2025-07-29 12:48:18 +02:00