This PR contains the following updates: | Package | Type | Update | Change | [Age](https://docs.renovatebot.com/merge-confidence/) | [Confidence](https://docs.renovatebot.com/merge-confidence/) | |---|---|---|---|---|---| | [biome](https://redirect.github.com/biomejs/biome) | | patch | `2.3.9` -> `2.3.10` |  |  | | [esbuild](https://redirect.github.com/evanw/esbuild) | | patch | `0.27.1` -> `0.27.2` |  |  | | [github.com/alecthomas/chroma/v2](https://redirect.github.com/alecthomas/chroma) | require | minor | `v2.20.0` -> `v2.21.1` |  |  | | [tinygo](https://redirect.github.com/tinygo-org/tinygo) | | patch | `0.40.0` -> `0.40.1` |  |  | | [uv](https://redirect.github.com/astral-sh/uv) | | patch | `0.9.17` -> `0.9.18` |  |  | --- ### Release Notes <details> <summary>biomejs/biome (biome)</summary> ### [`v2.3.10`](https://redirect.github.com/biomejs/biome/releases/tag/%40biomejs/biome%402.3.10): Biome CLI v2.3.10 #### 2.3.10 ##### Patch Changes - [#​8417](https://redirect.github.com/biomejs/biome/pull/8417) [`c3a2557`](c3a255709c) Thanks [@​taga3s](https://redirect.github.com/taga3s)! - Fixed [#​7809](https://redirect.github.com/biomejs/biome/issues/7809): [`noRedeclare`](https://biomejs.dev/linter/rules/no-redeclare/) no longer reports redeclarations for `infer` type in conditional types. - [#​8477](https://redirect.github.com/biomejs/biome/pull/8477) [`90e8684`](90e86848a9) Thanks [@​dyc3](https://redirect.github.com/dyc3)! - Fixed [#​8475](https://redirect.github.com/biomejs/biome/issues/8475): fixed a regression in how `noExtraNonNullAssertion` flags extra non-null assertions - [#​8479](https://redirect.github.com/biomejs/biome/pull/8479) [`250b519`](250b51974f) Thanks [@​dyc3](https://redirect.github.com/dyc3)! - Fixed [#​8473](https://redirect.github.com/biomejs/biome/issues/8473): The semantic model now indexes typescript constructor method definitions, and no longer panics if you use one (a regression in 2.3.9). - [#​8448](https://redirect.github.com/biomejs/biome/pull/8448) [`2af85c1`](2af85c16ae) Thanks [@​mdevils](https://redirect.github.com/mdevils)! - Improved handling of `defineProps()` macro in Vue components. The [`noVueReservedKeys`](https://biomejs.dev/linter/rules/no-vue-reserved-keys/) rule now avoids false positives in non-setup scripts. - [#​8420](https://redirect.github.com/biomejs/biome/pull/8420) [`42033b0`](42033b041f) Thanks [@​vsn4ik](https://redirect.github.com/vsn4ik)! - Fixed the nursery rule [`noLeakedRender`](https://biomejs.dev/linter/rules/no-leaked-render/). The `biome migrate eslint` command now correctly detects the rule `react/jsx-no-leaked-render` in your eslint configurations. - [#​8426](https://redirect.github.com/biomejs/biome/pull/8426) [`285d932`](285d9321d8) Thanks [@​anthonyshew](https://redirect.github.com/anthonyshew)! - Added a Turborepo domain and a new "noUndeclaredEnvVars" rule in it for warning users of unsafe environment variable usage in Turborepos. - [#​8410](https://redirect.github.com/biomejs/biome/pull/8410) [`a21db74`](a21db74bc0) Thanks [@​ematipico](https://redirect.github.com/ematipico)! - Fixed [#​2988](https://redirect.github.com/biomejs/biome/issues/2988) where Biome couldn't handle properly characters that contain multiple code points when running in `stdin` mode. - [#​8372](https://redirect.github.com/biomejs/biome/pull/8372) [`b352ee4`](b352ee4759) Thanks [@​Netail](https://redirect.github.com/Netail)! - Added the nursery rule [`noAmbiguousAnchorText`](https://biomejs.dev/linter/rules/no-ambiguous-anchor-text/), which disallows ambiguous anchor descriptions. ##### Invalid ```html <a>learn more</a> ``` #### What's Changed - feat: new Turborepo domain and `noUndeclaredEnvVars` rule by [@​anthonyshew](https://redirect.github.com/anthonyshew) in [#​8426](https://redirect.github.com/biomejs/biome/pull/8426) - fix(noExtraNonNullAssertion): fix regression by [@​dyc3](https://redirect.github.com/dyc3) in [#​8477](https://redirect.github.com/biomejs/biome/pull/8477) - fix(analyze/js): index ts constructor methods in semantic model (regression) by [@​dyc3](https://redirect.github.com/dyc3) in [#​8479](https://redirect.github.com/biomejs/biome/pull/8479) - fix(lint): `lint/suspicous/noRedeclare` should not report redeclarations for `infer` type in conditional types by [@​taga3s](https://redirect.github.com/taga3s) in [#​8417](https://redirect.github.com/biomejs/biome/pull/8417) - fix(noLeakedRender): eslint rule name fix by [@​vsn4ik](https://redirect.github.com/vsn4ik) in [#​8420](https://redirect.github.com/biomejs/biome/pull/8420) - chore: add kraken as bronze sponsor by [@​dyc3](https://redirect.github.com/dyc3) in [#​8486](https://redirect.github.com/biomejs/biome/pull/8486) - fix(linter): improve Vue defineProps handling in noVueReservedKeys by [@​mdevils](https://redirect.github.com/mdevils) in [#​8448](https://redirect.github.com/biomejs/biome/pull/8448) - fix(cli): colors with multi-codepoints characters by [@​ematipico](https://redirect.github.com/ematipico) in [#​8410](https://redirect.github.com/biomejs/biome/pull/8410) - feat(lint): implement noAmbiguousAnchorText by [@​Netail](https://redirect.github.com/Netail) in [#​8372](https://redirect.github.com/biomejs/biome/pull/8372) - ci: release by [@​github-actions](https://redirect.github.com/github-actions)\[bot] in [#​8474](https://redirect.github.com/biomejs/biome/pull/8474) - docs: fix typos for assist/actions/organize-imports by [@​sergioness](https://redirect.github.com/sergioness) in [#​8490](https://redirect.github.com/biomejs/biome/pull/8490) #### New Contributors - [@​taga3s](https://redirect.github.com/taga3s) made their first contribution in [#​8417](https://redirect.github.com/biomejs/biome/pull/8417) - [@​vsn4ik](https://redirect.github.com/vsn4ik) made their first contribution in [#​8420](https://redirect.github.com/biomejs/biome/pull/8420) - [@​sergioness](https://redirect.github.com/sergioness) made their first contribution in [#​8490](https://redirect.github.com/biomejs/biome/pull/8490) **Full Changelog**: <https://github.com/biomejs/biome/compare/@biomejs/biome@2.3.9...@​biomejs/biome@2.3.10> </details> <details> <summary>evanw/esbuild (esbuild)</summary> ### [`v0.27.2`](https://redirect.github.com/evanw/esbuild/blob/HEAD/CHANGELOG.md#0272) [Compare Source](https://redirect.github.com/evanw/esbuild/compare/v0.27.1...v0.27.2) - Allow import path specifiers starting with `#/` ([#​4361](https://redirect.github.com/evanw/esbuild/pull/4361)) Previously the specification for `package.json` disallowed import path specifiers starting with `#/`, but this restriction [has recently been relaxed](https://redirect.github.com/nodejs/node/pull/60864) and support for it is being added across the JavaScript ecosystem. One use case is using it for a wildcard pattern such as mapping `#/*` to `./src/*` (previously you had to use another character such as `#_*` instead, which was more confusing). There is some more context in [nodejs/node#49182](https://redirect.github.com/nodejs/node/issues/49182). This change was contributed by [@​hybrist](https://redirect.github.com/hybrist). - Automatically add the `-webkit-mask` prefix ([#​4357](https://redirect.github.com/evanw/esbuild/issues/4357), [#​4358](https://redirect.github.com/evanw/esbuild/issues/4358)) This release automatically adds the `-webkit-` vendor prefix for the [`mask`](https://developer.mozilla.org/en-US/docs/Web/CSS/Reference/Properties/mask) CSS shorthand property: ```css /* Original code */ main { mask: url(x.png) center/5rem no-repeat } /* Old output (with --target=chrome110) */ main { mask: url(x.png) center/5rem no-repeat; } /* New output (with --target=chrome110) */ main { -webkit-mask: url(x.png) center/5rem no-repeat; mask: url(x.png) center/5rem no-repeat; } ``` This change was contributed by [@​BPJEnnova](https://redirect.github.com/BPJEnnova). - Additional minification of `switch` statements ([#​4176](https://redirect.github.com/evanw/esbuild/issues/4176), [#​4359](https://redirect.github.com/evanw/esbuild/issues/4359)) This release contains additional minification patterns for reducing `switch` statements. Here is an example: ```js // Original code switch (x) { case 0: foo() break case 1: default: bar() } // Old output (with --minify) switch(x){case 0:foo();break;case 1:default:bar()} // New output (with --minify) x===0?foo():bar(); ``` - Forbid `using` declarations inside `switch` clauses ([#​4323](https://redirect.github.com/evanw/esbuild/issues/4323)) This is a rare change to remove something that was previously possible. The [Explicit Resource Management](https://redirect.github.com/tc39/proposal-explicit-resource-management) proposal introduced `using` declarations. These were previously allowed inside `case` and `default` clauses in `switch` statements. This had well-defined semantics and was already widely implemented (by V8, SpiderMonkey, TypeScript, esbuild, and others). However, it was considered to be too confusing because of how scope works in switch statements, so it has been removed from the specification. This edge case will now be a syntax error. See [tc39/proposal-explicit-resource-management#215](https://redirect.github.com/tc39/proposal-explicit-resource-management/issues/215) and [rbuckton/ecma262#14](https://redirect.github.com/rbuckton/ecma262/pull/14) for details. Here is an example of code that is no longer allowed: ```js switch (mode) { case 'read': using readLock = db.read() return readAll(readLock) case 'write': using writeLock = db.write() return writeAll(writeLock) } ``` That code will now have to be modified to look like this instead (note the additional `{` and `}` block statements around each case body): ```js switch (mode) { case 'read': { using readLock = db.read() return readAll(readLock) } case 'write': { using writeLock = db.write() return writeAll(writeLock) } } ``` This is not being released in one of esbuild's breaking change releases since this feature hasn't been finalized yet, and esbuild always tracks the current state of the specification (so esbuild's previous behavior was arguably incorrect). </details> <details> <summary>alecthomas/chroma (github.com/alecthomas/chroma/v2)</summary> ### [`v2.21.1`](https://redirect.github.com/alecthomas/chroma/releases/tag/v2.21.1) [Compare Source](https://redirect.github.com/alecthomas/chroma/compare/v2.21.0...v2.21.1) #### Changelog - [`0fe6941`](https://redirect.github.com/alecthomas/chroma/commit/0fe6941) fix(styles): use kebab-case for style name in Aura Theme variants ([#​1183](https://redirect.github.com/alecthomas/chroma/issues/1183)) - [`2408917`](https://redirect.github.com/alecthomas/chroma/commit/2408917) chore(deps): update all non-major dependencies ([#​1178](https://redirect.github.com/alecthomas/chroma/issues/1178)) - [`b527a28`](https://redirect.github.com/alecthomas/chroma/commit/b527a28) Update lexer lox ([#​1175](https://redirect.github.com/alecthomas/chroma/issues/1175)) ### [`v2.21.0`](https://redirect.github.com/alecthomas/chroma/releases/tag/v2.21.0) [Compare Source](https://redirect.github.com/alecthomas/chroma/compare/v2.20.0...v2.21.0) #### Changelog - [`26a0cc1`](https://redirect.github.com/alecthomas/chroma/commit/26a0cc1) feat(styles): add Aura Theme primary variants ([#​1177](https://redirect.github.com/alecthomas/chroma/issues/1177)) - [`fc10487`](https://redirect.github.com/alecthomas/chroma/commit/fc10487) Fix (D): multiline comments ([#​1173](https://redirect.github.com/alecthomas/chroma/issues/1173)) - [`aec4bfc`](https://redirect.github.com/alecthomas/chroma/commit/aec4bfc) Add support for Device tree ([#​1172](https://redirect.github.com/alecthomas/chroma/issues/1172)) - [`8ea696b`](https://redirect.github.com/alecthomas/chroma/commit/8ea696b) chore(deps): update actions/checkout action to v6 ([#​1167](https://redirect.github.com/alecthomas/chroma/issues/1167)) - [`a40a9d3`](https://redirect.github.com/alecthomas/chroma/commit/a40a9d3) chore(deps): update dependency binaryen to v125 ([#​1168](https://redirect.github.com/alecthomas/chroma/issues/1168)) - [`5486d21`](https://redirect.github.com/alecthomas/chroma/commit/5486d21) chore(deps): update all non-major dependencies ([#​1164](https://redirect.github.com/alecthomas/chroma/issues/1164)) - [`42c2aa1`](https://redirect.github.com/alecthomas/chroma/commit/42c2aa1) Add helper script to generate supported langs markdown table ([#​1170](https://redirect.github.com/alecthomas/chroma/issues/1170)) - [`e799618`](https://redirect.github.com/alecthomas/chroma/commit/e799618) chore(deps): update actions/checkout digest to [`93cb6ef`](https://redirect.github.com/alecthomas/chroma/commit/93cb6ef) ([#​1163](https://redirect.github.com/alecthomas/chroma/issues/1163)) - [`6b58845`](https://redirect.github.com/alecthomas/chroma/commit/6b58845) Add Ashen style ([#​1169](https://redirect.github.com/alecthomas/chroma/issues/1169)) - [`8b8574c`](https://redirect.github.com/alecthomas/chroma/commit/8b8574c) Add Protocol Buffer Text Format Language (txtpb) ([#​1165](https://redirect.github.com/alecthomas/chroma/issues/1165)) - [`c07ef4b`](https://redirect.github.com/alecthomas/chroma/commit/c07ef4b) chore(deps): update all non-major dependencies ([#​1160](https://redirect.github.com/alecthomas/chroma/issues/1160)) - [`3b5a164`](https://redirect.github.com/alecthomas/chroma/commit/3b5a164) Add lexer for WebAssembly Text Format ([#​1161](https://redirect.github.com/alecthomas/chroma/issues/1161)) - [`84d187e`](https://redirect.github.com/alecthomas/chroma/commit/84d187e) github style: background should be grey ([#​1159](https://redirect.github.com/alecthomas/chroma/issues/1159)) - [`60e616c`](https://redirect.github.com/alecthomas/chroma/commit/60e616c) Add an alias for Starlark and match \*.star files ([#​1158](https://redirect.github.com/alecthomas/chroma/issues/1158)) - [`6e68adb`](https://redirect.github.com/alecthomas/chroma/commit/6e68adb) chore(deps): update all non-major dependencies ([#​1157](https://redirect.github.com/alecthomas/chroma/issues/1157)) - [`9297a7c`](https://redirect.github.com/alecthomas/chroma/commit/9297a7c) chore(deps): update all non-major dependencies ([#​1155](https://redirect.github.com/alecthomas/chroma/issues/1155)) - [`1074a2a`](https://redirect.github.com/alecthomas/chroma/commit/1074a2a) fix(Kotlin): Number literals ([#​1139](https://redirect.github.com/alecthomas/chroma/issues/1139)) - [`9c8da0f`](https://redirect.github.com/alecthomas/chroma/commit/9c8da0f) chore(deps): update all non-major dependencies ([#​1153](https://redirect.github.com/alecthomas/chroma/issues/1153)) - [`fa92e28`](https://redirect.github.com/alecthomas/chroma/commit/fa92e28) Add file extensions for systemd units using Podman Quadlet ([#​1151](https://redirect.github.com/alecthomas/chroma/issues/1151)) - [`57823f0`](https://redirect.github.com/alecthomas/chroma/commit/57823f0) Add Kakoune lexer ([#​1150](https://redirect.github.com/alecthomas/chroma/issues/1150)) - [`1c5b8cb`](https://redirect.github.com/alecthomas/chroma/commit/1c5b8cb) chore(deps): update all non-major dependencies ([#​1149](https://redirect.github.com/alecthomas/chroma/issues/1149)) - [`c688d92`](https://redirect.github.com/alecthomas/chroma/commit/c688d92) feat: add support for C3 ([#​1148](https://redirect.github.com/alecthomas/chroma/issues/1148)) - [`ba111b7`](https://redirect.github.com/alecthomas/chroma/commit/ba111b7) chore(deps): update all non-major dependencies ([#​1147](https://redirect.github.com/alecthomas/chroma/issues/1147)) - [`b05fcfb`](https://redirect.github.com/alecthomas/chroma/commit/b05fcfb) tango: Don't underline whitespace ([#​1146](https://redirect.github.com/alecthomas/chroma/issues/1146)) - [`daa879b`](https://redirect.github.com/alecthomas/chroma/commit/daa879b) chore(deps): update all non-major dependencies ([#​1141](https://redirect.github.com/alecthomas/chroma/issues/1141)) - [`a5dc086`](https://redirect.github.com/alecthomas/chroma/commit/a5dc086) Add argparse to pygemnts2chroma\_xml.py script ([#​1140](https://redirect.github.com/alecthomas/chroma/issues/1140)) - [`3f991b1`](https://redirect.github.com/alecthomas/chroma/commit/3f991b1) chore(deps): update dependency binaryen to v124 ([#​1138](https://redirect.github.com/alecthomas/chroma/issues/1138)) - [`0ae5ef0`](https://redirect.github.com/alecthomas/chroma/commit/0ae5ef0) chore(deps): update all non-major dependencies ([#​1137](https://redirect.github.com/alecthomas/chroma/issues/1137)) - [`8f9e82f`](https://redirect.github.com/alecthomas/chroma/commit/8f9e82f) Update Core lexer to adjust for removed keyword `enum` ([#​1136](https://redirect.github.com/alecthomas/chroma/issues/1136)) - [`685ad2c`](https://redirect.github.com/alecthomas/chroma/commit/685ad2c) Update Core lexer to adjust for removed keyword `const` ([#​1134](https://redirect.github.com/alecthomas/chroma/issues/1134)) - [`e9ffd5a`](https://redirect.github.com/alecthomas/chroma/commit/e9ffd5a) fix: don't emit empty tail tokens ([#​1121](https://redirect.github.com/alecthomas/chroma/issues/1121)) - [`4e1403e`](https://redirect.github.com/alecthomas/chroma/commit/4e1403e) Add lexer for Ring Language ([#​1133](https://redirect.github.com/alecthomas/chroma/issues/1133)) - [`66a939a`](https://redirect.github.com/alecthomas/chroma/commit/66a939a) Add lexer for Game Boy Development System ASM. ([#​1117](https://redirect.github.com/alecthomas/chroma/issues/1117)) - [`2984b60`](https://redirect.github.com/alecthomas/chroma/commit/2984b60) chore(deps): update all non-major dependencies ([#​1132](https://redirect.github.com/alecthomas/chroma/issues/1132)) - [`260fa90`](https://redirect.github.com/alecthomas/chroma/commit/260fa90) update css.xml with current properties ([#​1130](https://redirect.github.com/alecthomas/chroma/issues/1130)) - [`70521cf`](https://redirect.github.com/alecthomas/chroma/commit/70521cf) Modelica language support [#​1122](https://redirect.github.com/alecthomas/chroma/issues/1122) ([#​1129](https://redirect.github.com/alecthomas/chroma/issues/1129)) - [`09cd573`](https://redirect.github.com/alecthomas/chroma/commit/09cd573) update css.xml for current grid gap properties ([#​1128](https://redirect.github.com/alecthomas/chroma/issues/1128)) - [`339bd37`](https://redirect.github.com/alecthomas/chroma/commit/339bd37) Fixed \*\*free analysis in RPGLE ([#​1116](https://redirect.github.com/alecthomas/chroma/issues/1116)) - [`ff52be8`](https://redirect.github.com/alecthomas/chroma/commit/ff52be8) chore(deps): update actions/checkout action to v5 ([#​1127](https://redirect.github.com/alecthomas/chroma/issues/1127)) - [`254ca83`](https://redirect.github.com/alecthomas/chroma/commit/254ca83) Update Core lexer to incorporate change of keyword from `use` to `import` ([#​1124](https://redirect.github.com/alecthomas/chroma/issues/1124)) - [`2d9c0d1`](https://redirect.github.com/alecthomas/chroma/commit/2d9c0d1) chore(deps): update all non-major dependencies ([#​1123](https://redirect.github.com/alecthomas/chroma/issues/1123)) - [`bd10a05`](https://redirect.github.com/alecthomas/chroma/commit/bd10a05) `moar` has been renamed to `moor` ([#​1125](https://redirect.github.com/alecthomas/chroma/issues/1125)) - [`db626fd`](https://redirect.github.com/alecthomas/chroma/commit/db626fd) Analyse() now cares about case-insensitivity ([#​1120](https://redirect.github.com/alecthomas/chroma/issues/1120)) </details> <details> <summary>tinygo-org/tinygo (tinygo)</summary> ### [`v0.40.1`](https://redirect.github.com/tinygo-org/tinygo/blob/HEAD/CHANGELOG.md#0401) - **machine** - nrf: fix flash writes when SoftDevice is enabled - **runtime** - runtime: avoid fixed math/rand sequence on RP2040/RP2350 ([#​5124](https://redirect.github.com/tinygo-org/tinygo/issues/5124)) - runtime: add calls to initRand() during run() for all schedulers - runtime: call initRand() before initHeap() during initialization - runtime: use rand\_hwrng hardwareRand for RP2040/RP2350 ([#​5135](https://redirect.github.com/tinygo-org/tinygo/issues/5135)) - **libs** - picolibc: use updated location for git repo </details> <details> <summary>astral-sh/uv (uv)</summary> ### [`v0.9.18`](https://redirect.github.com/astral-sh/uv/blob/HEAD/CHANGELOG.md#0918) [Compare Source](https://redirect.github.com/astral-sh/uv/compare/0.9.17...0.9.18) Released on 2025-12-16. ##### Enhancements - Add value hints to command line arguments to improve shell completion accuracy ([#​17080](https://redirect.github.com/astral-sh/uv/pull/17080)) - Improve error handling in `uv publish` ([#​17096](https://redirect.github.com/astral-sh/uv/pull/17096)) - Improve rendering of multiline error messages ([#​17132](https://redirect.github.com/astral-sh/uv/pull/17132)) - Support redirects in `uv publish` ([#​17130](https://redirect.github.com/astral-sh/uv/pull/17130)) - Include Docker images with the alpine version, e.g., `python3.x-alpine3.23` ([#​17100](https://redirect.github.com/astral-sh/uv/pull/17100)) ##### Configuration - Accept `--torch-backend` in `[tool.uv]` ([#​17116](https://redirect.github.com/astral-sh/uv/pull/17116)) ##### Performance - Speed up `uv cache size` ([#​17015](https://redirect.github.com/astral-sh/uv/pull/17015)) - Initialize S3 signer once ([#​17092](https://redirect.github.com/astral-sh/uv/pull/17092)) ##### Bug fixes - Avoid panics due to reads on failed requests ([#​17098](https://redirect.github.com/astral-sh/uv/pull/17098)) - Enforce latest-version in `@latest` requests ([#​17114](https://redirect.github.com/astral-sh/uv/pull/17114)) - Explicitly set `EntryType` for file entries in tar ([#​17043](https://redirect.github.com/astral-sh/uv/pull/17043)) - Ignore `pyproject.toml` index username in lockfile comparison ([#​16995](https://redirect.github.com/astral-sh/uv/pull/16995)) - Relax error when using `uv add` with `UV_GIT_LFS` set ([#​17127](https://redirect.github.com/astral-sh/uv/pull/17127)) - Support file locks on ExFAT on macOS ([#​17115](https://redirect.github.com/astral-sh/uv/pull/17115)) - Change schema for `exclude-newer` into optional string ([#​17121](https://redirect.github.com/astral-sh/uv/pull/17121)) ##### Documentation - Drop arm musl caveat from Docker documentation ([#​17111](https://redirect.github.com/astral-sh/uv/pull/17111)) - Fix version reference in resolver example ([#​17085](https://redirect.github.com/astral-sh/uv/pull/17085)) - Better documentation for `exclude-newer*` ([#​17079](https://redirect.github.com/astral-sh/uv/pull/17079)) </details> --- ### Configuration 📅 **Schedule**: Branch creation - Between 12:00 AM and 03:59 AM, only on Monday ( * 0-3 * * 1 ) (UTC), Automerge - At any time (no schedule defined). 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 👻 **Immortal**: This PR will be recreated if closed unmerged. Get [config help](https://redirect.github.com/renovatebot/renovate/discussions) if that's undesired. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box --- This PR was generated by [Mend Renovate](https://mend.io/renovate/). View the [repository job log](https://developer.mend.io/github/alecthomas/chroma). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0Mi41OS4wIiwidXBkYXRlZEluVmVyIjoiNDIuNTkuMCIsInRhcmdldEJyYW5jaCI6Im1hc3RlciIsImxhYmVscyI6W119--> Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
A general purpose syntax highlighter in pure Go
Chroma takes source code and other structured text and converts it into syntax highlighted HTML, ANSI-coloured text, etc.
Chroma is based heavily on Pygments, and includes translators for Pygments lexers and styles.
Table of Contents
- Supported languages
- Try it
- Using the library
- More detail
- Command-line interface
- Testing lexers
- What's missing compared to Pygments?
Supported languages
| Prefix | Language |
|---|---|
| A | ABAP, ABNF, ActionScript, ActionScript 3, Ada, Agda, AL, Alloy, Angular2, ANTLR, ApacheConf, APL, AppleScript, ArangoDB AQL, Arduino, ArmAsm, ATL, AutoHotkey, AutoIt, Awk |
| B | Ballerina, Bash, Bash Session, Batchfile, Beef, BibTeX, Bicep, BlitzBasic, BNF, BQN, Brainfuck |
| C | C, C#, C++, C3, Caddyfile, Caddyfile Directives, Cap'n Proto, Cassandra CQL, Ceylon, CFEngine3, cfstatement, ChaiScript, Chapel, Cheetah, Clojure, CMake, COBOL, CoffeeScript, Common Lisp, Coq, Core, Crystal, CSS, CSV, CUE, Cython |
| D | D, Dart, Dax, Desktop file, Diff, Django/Jinja, dns, Docker, DTD, Dylan |
| E | EBNF, Elixir, Elm, EmacsLisp, Erlang |
| F | Factor, Fennel, Fish, Forth, Fortran, FortranFixed, FSharp |
| G | GAS, GDScript, GDScript3, Gemtext, Genshi, Genshi HTML, Genshi Text, Gherkin, Gleam, GLSL, Gnuplot, Go, Go HTML Template, Go Template, Go Text Template, GraphQL, Groff, Groovy |
| H | Handlebars, Hare, Haskell, Haxe, HCL, Hexdump, HLB, HLSL, HolyC, HTML, HTTP, Hy |
| I | Idris, Igor, INI, Io, ISCdhcpd |
| J | J, Janet, Java, JavaScript, JSON, JSONata, Jsonnet, Julia, Jungle |
| K | Kakoune, Kotlin |
| L | Lean4, Lighttpd configuration file, LLVM, lox, Lua |
| M | Makefile, Mako, markdown, Mason, Materialize SQL dialect, Mathematica, Matlab, MCFunction, Meson, Metal, MiniZinc, MLIR, Modelica, Modula-2, Mojo, MonkeyC, MoonScript, MorrowindScript, Myghty, MySQL |
| N | NASM, Natural, NDISASM, Newspeak, Nginx configuration file, Nim, Nix, NSIS, Nu |
| O | Objective-C, ObjectPascal, OCaml, Octave, Odin, OnesEnterprise, OpenEdge ABL, OpenSCAD, Org Mode |
| P | PacmanConf, Perl, PHP, PHTML, Pig, PkgConfig, PL/pgSQL, plaintext, Plutus Core, Pony, PostgreSQL SQL dialect, PostScript, POVRay, PowerQuery, PowerShell, Prolog, Promela, PromQL, properties, Protocol Buffer, Protocol Buffer Text Format, PRQL, PSL, Puppet, Python, Python 2 |
| Q | QBasic, QML |
| R | R, Racket, Ragel, Raku, react, ReasonML, reg, Rego, reStructuredText, Rexx, RGBDS Assembly, Ring, RPGLE, RPMSpec, Ruby, Rust |
| S | SAS, Sass, Scala, Scheme, Scilab, SCSS, Sed, Sieve, Smali, Smalltalk, Smarty, SNBT, Snobol, Solidity, SourcePawn, SPARQL, SQL, SquidConf, Standard ML, stas, Stylus, Svelte, Swift, SYSTEMD, systemverilog |
| T | TableGen, Tal, TASM, Tcl, Tcsh, Termcap, Terminfo, Terraform, TeX, Thrift, TOML, TradingView, Transact-SQL, Turing, Turtle, Twig, TypeScript, TypoScript, TypoScriptCssData, TypoScriptHtmlData, Typst |
| U | ucode |
| V | V, V shell, Vala, VB.net, verilog, VHDL, VHS, VimL, vue |
| W | WDTE, WebAssembly Text Format, WebGPU Shading Language, WebVTT, Whiley |
| X | XML, Xorg |
| Y | YAML, YANG |
| Z | Z80 Assembly, Zed, Zig |
I will attempt to keep this section up to date, but an authoritative list can be
displayed with chroma --list.
Try it
Try out various languages and styles on the Chroma Playground.
Using the library
This is version 2 of Chroma, use the import path:
import "github.com/alecthomas/chroma/v2"
Chroma, like Pygments, has the concepts of lexers, formatters and styles.
Lexers convert source text into a stream of tokens, styles specify how token types are mapped to colours, and formatters convert tokens and styles into formatted output.
A package exists for each of these, containing a global Registry variable
with all of the registered implementations. There are also helper functions
for using the registry in each package, such as looking up lexers by name or
matching filenames, etc.
In all cases, if a lexer, formatter or style can not be determined, nil will
be returned. In this situation you may want to default to the Fallback
value in each respective package, which provides sane defaults.
Quick start
A convenience function exists that can be used to simply format some source text, without any effort:
err := quick.Highlight(os.Stdout, someSourceCode, "go", "html", "monokai")
Identifying the language
To highlight code, you'll first have to identify what language the code is written in. There are three primary ways to do that:
-
Detect the language from its filename.
lexer := lexers.Match("foo.go") -
Explicitly specify the language by its Chroma syntax ID (a full list is available from
lexers.Names()).lexer := lexers.Get("go") -
Detect the language from its content.
lexer := lexers.Analyse("package main\n\nfunc main()\n{\n}\n")
In all cases, nil will be returned if the language can not be identified.
if lexer == nil {
lexer = lexers.Fallback
}
At this point, it should be noted that some lexers can be extremely chatty. To mitigate this, you can use the coalescing lexer to coalesce runs of identical token types into a single token:
lexer = chroma.Coalesce(lexer)
Formatting the output
Once a language is identified you will need to pick a formatter and a style (theme).
style := styles.Get("swapoff")
if style == nil {
style = styles.Fallback
}
formatter := formatters.Get("html")
if formatter == nil {
formatter = formatters.Fallback
}
Then obtain an iterator over the tokens:
contents, err := ioutil.ReadAll(r)
iterator, err := lexer.Tokenise(nil, string(contents))
And finally, format the tokens from the iterator:
err := formatter.Format(w, style, iterator)
The HTML formatter
By default the html registered formatter generates standalone HTML with
embedded CSS. More flexibility is available through the formatters/html package.
Firstly, the output generated by the formatter can be customised with the following constructor options:
Standalone()- generate standalone HTML with embedded CSS.WithClasses()- use classes rather than inlined style attributes.ClassPrefix(prefix)- prefix each generated CSS class.TabWidth(width)- Set the rendered tab width, in characters.WithLineNumbers()- Render line numbers (style withLineNumbers).WithLinkableLineNumbers()- Make the line numbers linkable and be a link to themselves.HighlightLines(ranges)- Highlight lines in these ranges (style withLineHighlight).LineNumbersInTable()- Use a table for formatting line numbers and code, rather than spans.
If WithClasses() is used, the corresponding CSS can be obtained from the formatter with:
formatter := html.New(html.WithClasses(true))
err := formatter.WriteCSS(w, style)
More detail
Lexers
See the Pygments documentation for details on implementing lexers. Most concepts apply directly to Chroma, but see existing lexer implementations for real examples.
In many cases lexers can be automatically converted directly from Pygments by
using the included Python 3 script pygments2chroma_xml.py. I use something like
the following:
uv run --script _tools/pygments2chroma_xml.py \
pygments.lexers.jvm.KotlinLexer \
> lexers/embedded/kotlin.xml
A list of all lexers available in Pygments can be found in pygments-lexers.txt.
Formatters
Chroma supports HTML output, as well as terminal output in 8 colour, 256 colour, and true-colour.
A noop formatter is included that outputs the token text only, and a tokens
formatter outputs raw tokens. The latter is useful for debugging lexers.
Styles
Chroma styles are defined in XML. The style entries use the same syntax as Pygments.
All Pygments styles have been converted to Chroma using the _tools/style.py
script.
When you work with one of Chroma's styles,
know that the Background token type provides the default style for tokens. It does so
by defining a foreground color and background color.
For example, this gives each token name not defined in the style a default color
of #f8f8f8 and uses #000000 for the highlighted code block's background:
<entry type="Background" style="#f8f8f2 bg:#000000"/>
Also, token types in a style file are hierarchical. For instance, when CommentSpecial is not defined, Chroma uses the token style from Comment. So when several comment tokens use the same color, you'll only need to define Comment and override the one that has a different color.
For a quick overview of the available styles and how they look, check out the Chroma Style Gallery.
Command-line interface
A command-line interface to Chroma is included.
Binaries are available to install from the releases page.
The CLI can be used as a preprocessor to colorise output of less(1),
see documentation for the LESSOPEN environment variable.
The --fail flag can be used to suppress output and return with exit status
1 to facilitate falling back to some other preprocessor in case chroma
does not resolve a specific lexer to use for the given file. For example:
export LESSOPEN='| p() { chroma --fail "$1" || cat "$1"; }; p "%s"'
Replace cat with your favourite fallback preprocessor.
When invoked as .lessfilter, the --fail flag is automatically turned
on under the hood for easy integration with lesspipe shipping with
Debian and derivatives;
for that setup the chroma executable can be just symlinked to ~/.lessfilter.
Projects using Chroma
mooris a full-blown pager that colorizes its input using Chroma- Hugo is a static site generator that uses Chroma for syntax highlighting code examples
Testing lexers
If you edit some lexers and want to try it, open a shell in cmd/chromad and run:
go run . --csrf-key=securekey
A Link will be printed. Open it in your Browser. Now you can test on the Playground with your local changes.
If you want to run the tests and the lexers, open a shell in the root directory and run:
go test ./lexers
When updating or adding a lexer, please add tests. See lexers/README.md for more.
What's missing compared to Pygments?
- Quite a few lexers, for various reasons (pull-requests welcome):
- Pygments lexers for complex languages often include custom code to handle certain aspects, such as Raku's ability to nest code inside regular expressions. These require time and effort to convert.
- I mostly only converted languages I had heard of, to reduce the porting cost.
- Some more esoteric features of Pygments are omitted for simplicity.
- Though the Chroma API supports content detection, very few languages support them. I have plans to implement a statistical analyser at some point, but not enough time.
