Repository navigation
Releases
v0.7.2
Notes
Fixed: inputs that took far too long. In 14 languages, some inputs made highlighting take time that grows with the square of their size: in Python, 64 KB of lines with only whitespace took about 6 seconds. The others were PowerShell, R, PHP, YAML, Kotlin, C#, XML, HTML, C, C++, Java, JSON and Markdown, mostly with an opening delimiter that is never closed (/*, <?, [, a quote). They now take time proportional to their size. The colors are unchanged. This matters most if you highlight text from other people on a server; the fhl command gets the fix too.
About fhl v0.6.5 and earlier: they were built with Go 1.25.0. govulncheck reports GO-2026-4602 (in Go's os package, fixed in Go 1.25.8) as reachable from those fhl binaries. v0.7.0 and later are built with Go 1.27.4, where govulncheck finds no reachable vulnerability. Releases are now checked with govulncheck before they are built, and the repository every week.
The Go library: the API and the minimum Go version (1.25) are unchanged.
What's Changed
- Tokenizers: remove quadratic rescans found by a search over all languages by @toshi-kuji in #66
- Release workflow: take release notes as an input by @toshi-kuji in #67
- govulncheck in CI and releases; size and speed numbers measured again by @toshi-kuji in #68
Full Changelog: v0.7.1...v0.7.2
v0.7.1
Notes
The fhl command:
--code-blocksis fast again: v0.7.0 was about 10% slower than v0.6.5 there, because of its new JSON writer. It is now as fast as v0.6.5 or slightly faster. The output is unchanged.
The Go library: no changes.
What's Changed
- fhl: faster JSON encoder for --code-blocks by @toshi-kuji in #65
Full Changelog: v0.7.0...v0.7.1
v0.7.0
Notes
The fhl command:
- Now built with Go 1.27.4 (was Go 1.25.0, which no longer gets security fixes).
- The binary is slightly smaller (Linux amd64: 4.30 MB → 4.21 MB).
--json,--code-blocks,--list-langs --jsonand--list-themes --jsonprint exactly the same output as before.
The Go library:
- SQL, PowerShell and PHP are faster on long runs of non-ASCII letters (about 4 times on 64 KB of "é" in SQL with fhl). The colors are unchanged.
- The minimum Go version stays 1.25. Nothing changes in how you import or call the library.
What's Changed
- Build with Go 1.27.4; fhl writes JSON without encoding/json by @toshi-kuji in #64
Full Changelog: v0.6.5...v0.7.0
v0.6.5
Notes
If you use the fhl command, nothing changes for you. The notes below are for programs that import the Go library.
- New:
markdown/v2for goldmark v2 (github.com/yuin/goldmark/v2). It has the same API asmarkdownand writes the same HTML. Import only the one that matches your goldmark; the other goldmark is not downloaded or built into your program.markdown(goldmark v1) is unchanged, andfhlstill uses goldmark v1. - The library now needs Go 1.25 or later (it was 1.24), because goldmark v2 needs it. With Go 1.21 or later and the default
GOTOOLCHAIN=auto,go getswitches to a newer Go toolchain and updates thegoline in your go.mod. WithGOTOOLCHAIN=localand an older Go, it stops with "requires go >= 1.25". - Fix:
markdown.LanguageNamenow reads character references in a code block's language name as CommonMark does. Before,ccandAwere read wrongly. Ordinary names likegoorc\+\+are not affected.
What's Changed
- README, site: speed numbers measured again with v0.6.4 by @toshi-kuji in #60
- Speed docs: say which languages the benchmark documents cover by @toshi-kuji in #61
- Add markdown/v2: the goldmark extension for goldmark v2 by @toshi-kuji in #62
Full Changelog: v0.6.4...v0.6.5
v0.6.4
What's Changed
- Swift: standard library names of current Swift are built-ins by @toshi-kuji in #57
- JavaScript: look keywords up in a map; FoldEq: ASCII fast path by @toshi-kuji in #58
- Bash, Ruby, GraphQL, JSON: skip comparisons that cannot match by @toshi-kuji in #59
Full Changelog: v0.6.3...v0.6.4
v0.6.3
What's Changed
- Publish the site with each release instead of on every push by @toshi-kuji in #53
- Demo: link the version to its release page by @toshi-kuji in #54
- TypeScript: color names in type arguments and return types as types by @toshi-kuji in #55
- Color user-defined types in type positions (Java, C#, Kotlin, Rust, Swift, Python, PHP) by @toshi-kuji in #56
Full Changelog: v0.6.2...v0.6.3
v0.6.2
What's Changed
- Remove the update notice and retract v0.6.1; Pages: fetch release tags for the demo version by @toshi-kuji in #52
v0.6.1 is retracted: use v0.6.2. go install …@latest now picks v0.6.2.
Full Changelog: v0.6.0...v0.6.2
v0.6.0
What's Changed
- website: add a demo page that runs fasthighlight as WebAssembly by @toshi-kuji in #40
- Demo: keep Feeling lucky and Highlight near the other controls by @toshi-kuji in #41
- CI: fuzz for a number of runs; build bench/ only when it changes by @toshi-kuji in #42
- Demo: say where Share works instead of "mobile only" by @toshi-kuji in #43
- Demo: choose light or dark before the page is drawn by @toshi-kuji in #44
- fhl: skip front matter only when it starts with a YAML key by @toshi-kuji in #45
- Tokenizers: no quadratic time on long runs (Java, C/C++, word lookups) by @toshi-kuji in #46
- Tokenizers: no quadratic time on more long runs by @toshi-kuji in #47
- Read code block languages as CommonMark does; rewrite only links to site pages by @toshi-kuji in #48
- Reject a second - in --code-blocks; keep the lookup cache bounded; guard build.sh's rm -rf by @toshi-kuji in #49
Full Changelog: v0.5.2...v0.6.0
v0.5.2
What's Changed
- Docs: add --code-blocks to the use cases; drop the default theme's color story by @toshi-kuji in #38
- Default theme: bold navy keywords in light, bold text color in dark (no pink) by @toshi-kuji in #39
Full Changelog: v0.5.1...v0.5.2
v0.5.1
What's Changed
- fhl: keep letters of other scripts in heading ids by @toshi-kuji in #37
Full Changelog: v0.5.0...v0.5.1