Skip to content

✨ feat(color): add color output support and configuration options#1242

Merged
harehare merged 9 commits intomainfrom
feat/color-output
Feb 10, 2026
Merged

✨ feat(color): add color output support and configuration options#1242
harehare merged 9 commits intomainfrom
feat/color-output

Conversation

@harehare
Copy link
Copy Markdown
Owner

@harehare harehare commented Feb 9, 2026

No description provided.

Add jq-like -C flag to colorize markdown output with ANSI escape codes.
Each markdown element type gets a distinct color (headings=bold+cyan,
code=green, links=underline+blue, emphasis=italic+yellow, etc.).

Implemented using a ColorTheme struct with PLAIN and COLORED constants
to share rendering logic between to_string_with() and
to_colored_string_with() without code duplication. Uses raw ANSI escape
codes behind a "color" feature flag to avoid additional dependencies.
Copilot AI review requested due to automatic review settings February 9, 2026 15:03
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds opt-in ANSI colorized Markdown output to mq, with configuration via CLI flag and environment variables.

Changes:

  • Introduces -C/--color-output in mq-run and documents it in the CLI reference + README.
  • Adds mq-markdown color rendering via ColorTheme, including env-based customization (MQ_COLORS) and NO_COLOR support.
  • Adds unit tests for colored rendering and a basic CLI smoke test.

Reviewed changes

Copilot reviewed 9 out of 9 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
docs/books/src/reference/env.md Documents NO_COLOR and MQ_COLORS configuration and available theme keys.
docs/books/src/reference/cli.md Adds -C/--color-output to CLI reference.
crates/mq-run/src/cli.rs Implements -C flag behavior and NO_COLOR override; adds a CLI test.
crates/mq-run/Cargo.toml Enables mq-markdown’s new color feature.
crates/mq-markdown/src/node.rs Introduces ColorTheme and theme-aware rendering for nodes.
crates/mq-markdown/src/markdown.rs Adds theme-aware Markdown rendering APIs + color tests.
crates/mq-markdown/src/lib.rs Re-exports ColorTheme.
crates/mq-markdown/Cargo.toml Adds the color feature flag.
README.md Documents -C, MQ_COLORS, and NO_COLOR.

Copilot AI review requested due to automatic review settings February 9, 2026 15:29
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 9 out of 10 changed files in this pull request and generated 3 comments.

Comments suppressed due to low confidence (1)

crates/mq-markdown/src/markdown.rs:1

  • Markdown::render_with_theme special-cases TableAlign and bypasses node.render_with_theme(..., theme), so colored output won't apply theme.table_separator (or any future theming) to the table alignment row. To keep behavior consistent, incorporate the theme into this branch (or remove the special-case and rely on the node renderer while preserving the buffering logic).
#[cfg(feature = "html-to-markdown")]

Copilot AI review requested due to automatic review settings February 9, 2026 23:55
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 8 out of 9 changed files in this pull request and generated 3 comments.

Copilot AI review requested due to automatic review settings February 10, 2026 12:42
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 9 out of 10 changed files in this pull request and generated 4 comments.

Comments suppressed due to low confidence (1)

crates/mq-markdown/src/markdown.rs:1

  • Markdown::render_with_theme special-cases TableAlign but ignores the passed theme, so to_colored_string() won’t color table separators/alignment lines even when a colored theme is used. Apply theme.table_separator (or otherwise route this through themed rendering) in this special-case so tables are consistently colored.
#[cfg(feature = "html-to-markdown")]

Copilot AI review requested due to automatic review settings February 10, 2026 13:11
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 8 out of 9 changed files in this pull request and generated 2 comments.

@harehare harehare merged commit 82af97f into main Feb 10, 2026
6 checks passed
@harehare harehare deleted the feat/color-output branch February 10, 2026 13:22
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.

2 participants