Fancy formatter removes backticks
Author: stafyniaksachaCreated Apr 4, 2025Updated Sep 10, 2025
Labelsbug
Environment
Node v22.x / Bun v1.1.x Tested on WSL / Win
Reproduction
import { consola } from 'consola'
consola.wrapAll()
const template = [
'```html',
'<div>hello</div>',
'```',
'```html',
'<div>hello</div>',
'```',
].join('\n')
console.log(template)Actual Output (tested bash / zsh / TERM=dumb sh):
```html
<div>hello</div>
``
`html
<div>hello</div>
``Expected Output (minus ):
```html
<div>hello</div>
\```
```html
<div>hello</div>
\```Describe the bug
Using console.log in context where consola.wrapConsole() // consola.wrapStd() was called may result in incorrect output.
I was trying to log two simple markdown code block in nuxt and realized that the output is wrong (I became mad because I did not knew console.log was wrapped)
The second html <div>hello</div> is written in blue, so I guess term caps are the cause, but node test.mjs > log && cat -e log doesn't show them.
Maybe related to backtick highlight ? https://github.com/unjs/consola/blob/main/src/reporters/fancy.ts#L141
Source: unjs/consola