Closed Hoofoo-WHU closed 9 months ago
We temporarily closed this due to the lack of enough information. We could not identify whether it was a bug or a userland misconfiguration with the given info. Please provide a minimal reproduction to reopen the issue. Thanks.
got a repro https://jsfiddle.net/7rLk5fqa/1/ :
import { codeToHtml } from 'https://esm.sh/shiki@1.0.0';
async function main() {
const options = {
lang: 'ansi',
theme: 'github-light',
};
document.body.innerHTML = await codeToHtml('this works', options);
document.body.innerHTML = await codeToHtml(`but this doesn't
[01m[Kfoo.cc:[m[K In function â[01m[Kint[01;32m[K main[m[K()[m[Kâ:
[01m[Kfoo.cc:8:13:[m[K [01;31m[Kerror: [m[Kexpected â[01m[K;[m[Kâ before â[01m[K}[m[Kâ token
8 | return 0
| [01;31m[K^[m[K
| [32m[K;[m[K
9 | [32m[K}[m[K
| [32m[K~[m[K
`, options);
}
main();
(base64 encoded payload)
G1swMW0bW0tmb28uY2M6G1ttG1tLIEluIGZ1bmN0aW9uIOKAmBtbMDFtG1tLaW50G1swMTszMm0b
W0sgbWFpbhtbbRtbSygpG1ttG1tL4oCZOgogICAgG1swMW0bW0tmb28uY2M6ODoxMzobW20bW0sg
G1swMTszMW0bW0tlcnJvcjogG1ttG1tLZXhwZWN0ZWQg4oCYG1swMW0bW0s7G1ttG1tL4oCZIGJl
Zm9yZSDigJgbWzAxbRtbS30bW20bW0vigJkgdG9rZW4KICAgICAgICA4IHwgICAgIHJldHVybiAw
CiAgICAgICAgICB8ICAgICAgICAgICAgIBtbMDE7MzFtG1tLXhtbbRtbSwogICAgICAgICAgfCAg
ICAgICAgICAgICAbWzMybRtbSzsbW20bW0sKICAgICAgICA5IHwgG1szMm0bW0t9G1ttG1tLCiAg
ICAgICAgICB8IBtbMzJtG1tLfhtbbRtbSw==
The root cause of this bug appears to be related to this issue, which has already been resolved. It's possible that updating to the latest version of the dependency could fix this issue in Shiki.