Skip to content

Extend render_md with ansi='html' to render ANSI colors as an {=html} block - #880

Open
RensDimmendaal wants to merge 1 commit into
mainfrom
render-md-ansi
Open

Extend render_md with ansi='html' to render ANSI colors as an {=html} block#880
RensDimmendaal wants to merge 1 commit into
mainfrom
render-md-ansi

Conversation

@RensDimmendaal

@RensDimmendaal RensDimmendaal commented Jul 29, 2026

Copy link
Copy Markdown
Contributor

render_md strips ANSI escape codes from pooled stream/error text, which is right for portable markdown but loses colored outputs (like tracebacks) where an HTML renderer is the known target (e.g. share solveit).

This PR adds an ansi= parameter: 'strip' (default, behavior unchanged) or 'html', which processes the output with fastcore's ansi2html and wraps it in as a pandoc/mdhtml-flavored md {=html} raw block.

Example output:

```{=html}
<pre><code class="ansi"><span class="ansi-red-intense-fg ansi-bold">1 failed</span>, 3   passed</code></pre>
```

@RensDimmendaal RensDimmendaal added the enhancement New feature or request label Jul 29, 2026
@RensDimmendaal
RensDimmendaal requested a review from jph00 July 29, 2026 15:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant