Skip to content

Make exception display color-aware for DocumenterVitepress#449

Merged
ocots merged 2 commits into
mainfrom
vitepress
Jun 15, 2026
Merged

Make exception display color-aware for DocumenterVitepress#449
ocots merged 2 commits into
mainfrom
vitepress

Conversation

@ocots

@ocots ocots commented Jun 14, 2026

Copy link
Copy Markdown
Member

This PR makes exception display color-aware to work correctly with DocumenterVitepress, and adds the full DocumenterVitepress migration setup.

Changes

Exception display color-aware

  • Add _apply_ansi(s, code, io) helper that checks get(io, :color, false) before applying ANSI codes
  • Update all ANSI helpers (_dim, _bold, _red, _yellow, _green) to accept io parameter
  • Propagate io to all call sites in display functions (_print_colored, _print_pipe_field, _format_user_friendly_error)
  • Add IOContext(stdout, :color => false) in @repl block to avoid raw ANSI codes in VitePress output
  • Add color-aware tests to verify both branches (color=true/false)

Documentation

  • Fix URI malformed error in coverage.md (heading with % literal)
  • Add MIGRATION.md with complete DocumenterVitepress migration guide
  • Document ANSI color handling workaround for @repl blocks (issue [General] New release #321)
  • Add Vitepress configuration files (config, theme, components)
  • Add remote assets configuration for control-toolbox CSS/JS

Rationale

DocumenterVitepress does not automatically convert ANSI escape codes to HTML in @repl blocks (unlike @example blocks). This causes raw ANSI codes to appear in the generated markdown. The workaround is to use IOContext(stdout, :color => false) in @repl blocks, and make custom display functions color-aware by checking get(io, :color, false).

This ensures:

  • REPL / GitHub Actions → colors enabled (:color => true by default)
  • Documenter / VitePress → plain text when wrapped with IOContext(stdout, :color => false)

Tests

  • Suite ciblée exceptions: 355 tests ✓
  • Suite complète: 1242 tests ✓
  • Documentation build: successful, no raw ANSI codes in output

- Add _apply_ansi helper to check get(io, :color, false) before applying ANSI codes
- Update all ANSI helpers (_dim, _bold, _red, _yellow, _green) to accept io parameter
- Propagate io to all call sites in display functions
- Add IOContext(stdout, :color => false) in @repl block to avoid raw ANSI codes in VitePress
- Add color-aware tests to verify both branches (color=true/false)
- Document ANSI color handling in MIGRATION.md with workaround for issue #321
- Fix URI malformed error in coverage.md (heading with % literal)
- Add DocumenterVitepress migration guide with remote assets configuration
@ocots ocots merged commit d2eb7f5 into main Jun 15, 2026
4 checks passed
@ocots ocots deleted the vitepress branch June 15, 2026 21:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant