fasthighlight

package module
v0.2.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 8, 2026 License: MIT Imports: 9 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

fasthighlight

fasthighlight

fasthighlight is fast syntax highlighting written in Go, without regular expressions: each supported language has its own hand-written tokenizer. The highlighting follows the language definitions of Chroma 2.27.0, with a few deliberate fixes. Add it to goldmark to highlight the code blocks in Markdown, or use the command fhl from a terminal, a script or a program in another language to turn Markdown into HTML, up to a basic static site.

  • Fast. In our measurements (before v0.1.0), converting a Markdown document was about 4.4 to 4.6 times as fast as Node with markdown-it and highlight.js, and about 7 to 20 times as fast as Chroma with all its languages (numbers).
  • Two ways in. Go packages for Go programs (markdown adds highlighting to goldmark; fasthighlight highlights code on its own), and the fhl command for everything else (static site builds in other languages, CI, AI agents).
  • Small dependency footprint. The highlighting package has no dependencies outside the standard library. The markdown package depends only on goldmark.
  • Plain HTML and CSS. Code blocks become <pre class="highlight"> with short, widely used token classes (k, s, nf, … as in Pygments, Chroma and Rouge). The output is the same for the same input, byte for byte.

Supported languages

fasthighlight supports 34 languages: Bash, Bash Session (console), C, C#, C++, CSS, Diff, Docker, Go, GraphQL, HTML, HTTP, INI, Java, JavaScript, JSON, Kotlin, Makefile, Markdown, PHP, PowerShell, Protocol Buffer, Python, R, React (JSX), Ruby, Rust, SCSS, SQL, Swift, TOML, TypeScript, XML, YAML.

The names, aliases and file name patterns are the same as Chroma's (fhl --list-langs prints them). Code blocks in other languages, or without a language name, are escaped but not colored. Code blocks marked as plain text (text, plaintext, plain or no-highlight, the names of Chroma's plain text lexer) are escaped too, and are not reported as uncolored, since that is what they ask for. Write ```text for output, logs and anything else that should stay plain.

The command: fhl

Install
  • Download an archive for your system (Linux, macOS or Windows; amd64 or arm64) from the releases page, and put fhl on your PATH. It is a single binary with no dependencies.
  • Or, with Go: go install github.com/toshi-kuji/fasthighlight/cmd/fhl@latest
Use
fhl README.md                      # README.html and highlight.css next to README.md
fhl docs/                          # an .html next to each .md in docs/, and a highlight.css per folder
fhl -o dist/ docs/                 # write into dist/, keeping the folder layout
fhl --single-html README.md        # one standalone HTML file: the CSS in <head>, heading ids
fhl --static-site -o dist/ docs/   # a static site: full pages, heading ids, other files copied
fhl -o - README.md                 # body-only HTML to standard output
cat note.md | fhl -o note.html -   # read standard input
fhl main.go                        # a code file becomes one highlighted code block
fhl --theme dark:github docs/      # choose the colors (light, dark or both, and a theme)
fhl --check --strict docs/         # fail (exit status 2) if a code block is not colored
fhl -o dist/ docs/ --json          # machine-readable result, for scripts and AI agents
fhl --help                         # all flags, with examples

By default fhl writes the HTML of the document body only (no <html> or <head>), plus highlight.css with the code colors, so that you or an AI agent can put it into your own page and style it. --single-html makes a page that opens as it is, with ids on headings so that links within the page work, and --static-site turns a folder into a basic static site: pages that open as they are, with ids on headings, links to .md files rewritten to .html, the other files copied, and one highlight.css at the top that every page links to. It has no styles beyond the code colors; add your own styles (by hand or with an AI agent) to that highlight.css.

Other behavior worth knowing:

  • Existing files are overwritten only after asking [y/N/a] on a terminal. Without a terminal (CI, scripts, AI agents), fhl stops with an error unless --force is given. Files whose content would not change are left alone.
  • Raw HTML in Markdown is escaped by default, so it shows up as text. --raw-html omit drops it, and --raw-html unsafe passes it through (only for Markdown you trust).
  • Front matter (--- … --- at the top) is skipped.
  • Code blocks that are not colored are listed on standard error as file:line:, up to three for each reason (no language name, unsupported language), followed by a count of the rest. --check lists them all.
  • Exit status: 0 for success, 1 for errors, 2 for uncolored code blocks with --strict.
Themes

--theme MODE:THEME chooses the colors of highlight.css (and of the CSS in --single-html). Every theme has light and dark colors, and MODE chooses which to write:

MODE Writes
light the light colors only
dark the dark colors only
both the light colors, switched to the dark ones when the viewer's device prefers dark (prefers-color-scheme)
THEME Light Dark
default fhl's own colors fhl's own colors
github GitHub Light Default GitHub Dark Default
vscode VS Code Light+ VS Code Dark+
solarized Solarized Light Solarized Dark
one One Light One Dark
catppuccin Catppuccin Latte Catppuccin Mocha
tokyo-night Tokyo Night Light Tokyo Night

THEME can be left out for default (--theme light); without --theme, it is both:default. Every color of default has a contrast ratio of at least 4.5 against its background (WCAG AA).

The colors are CSS variables (--highlight-keyword, --highlight-string, …) on :root, and every token class has a comment that says what it is. Change a variable to change a color. The themes other than default copy the colors of the original themes as they are, so some colors in them have a lower contrast.

The library

go get github.com/toshi-kuji/fasthighlight

It needs Go 1.24 or later. The module has two kinds of packages:

  • github.com/toshi-kuji/fasthighlight highlights code. It has no dependencies outside the standard library.
  • github.com/toshi-kuji/fasthighlight/markdown turns Markdown into HTML with highlighted code blocks, using goldmark.

Both are in the same module, so one go get covers them.

Convert Markdown
import (
	"github.com/toshi-kuji/fasthighlight/markdown"

	_ "github.com/toshi-kuji/fasthighlight/lang/golang" // register the languages you use (here, Go)
	// _ "github.com/toshi-kuji/fasthighlight/lang/all"  // or all the languages at once
)

err := markdown.NewConverter().Convert(src, w) // GFM to HTML
Add to your own goldmark
md := goldmark.New(goldmark.WithExtensions(extension.GFM, &markdown.Extension{}))
err := md.Convert(src, w)

A goldmark.Markdown with the extension can be used from several goroutines at the same time.

Highlight one piece of code
import (
	"github.com/toshi-kuji/fasthighlight"
	_ "github.com/toshi-kuji/fasthighlight/lang/golang"
)

err := fasthighlight.Highlight(w, "go", code)

A program that only highlights code does not import the markdown package, so goldmark is not compiled into it.

Choose the languages

Languages are registered by importing their packages, as with database/sql drivers. Import only the ones you need to keep your binary small:

import (
	_ "github.com/toshi-kuji/fasthighlight/lang/golang"
	_ "github.com/toshi-kuji/fasthighlight/lang/python"
)

As of v0.2.0, in a small program on Linux amd64 built with Go 1.25.0 and -ldflags "-s -w", calling only Highlight took about 1.63 MB; importing the Go language added about 0.07 MB, and importing all the languages (lang/all) about 0.77 MB. Using markdown.Converter (with goldmark) added about 1.04 MB more. Only what you import is compiled into your program; the fhl command is not.

To list the code blocks that will not be colored before converting (for example, to warn about a language you did not import), parse the documents with markdown.Converter.Parse, call markdown.Scan, and then markdown.Converter.Render. To check a single language name, fasthighlight.LookupSupported tells whether fasthighlight supports it and which package to import.

Output
```go
fmt.Println("hi")
```

becomes

<pre class="highlight" data-lang="go"><code class="language-go"><span class="line"><span class="cl"><span class="nx">fmt</span><span class="p">.</span><span class="nf">Println</span><span class="p">(</span><span class="s">&#34;hi&#34;</span><span class="p">)</span><span class="w">
</span></span></span></code></pre>

data-lang and the language- class (the one CommonMark recommends, which other tools read) hold the language name as written in the Markdown. The library writes no CSS; use the highlight.css that fhl writes, or your own. Apart from the outer class name (highlight, where Chroma uses chroma), data-lang and the language- class, the HTML for a given token sequence is the same as Chroma's HTML formatter with WithClasses(true).

Parallel highlighting

By default (markdown.ParallelAuto), the code blocks of one document are highlighted in parallel only when it pays off: when the code to color is more than 32 KB in total, and there are at least as many blocks as the languages call for (3 for a language whose Language.ParallelHint is HintHeavy, which the programming languages including CSS are; 4 otherwise, such as JSON, YAML, HTML and Markdown). Below that, starting goroutines costs more than it saves. ParallelNever and ParallelAlways override this.

If you register a language of your own, set ParallelHint with the same rule: HintHeavy if highlighting it takes much work (a programming language), HintLight otherwise. When unsure, leave it unspecified (HintDefault, treated like HintLight) or use HintLight; it rarely makes things slower.

Compatibility with Chroma

Chroma 2.27.0 is the reference, and the intended changes to its results are listed. For the supported languages, the tokens are checked by fuzz tests to match Chroma everywhere except at those changes.

The changes fix Chroma bugs and behavior that gets in the way of readers, such as a } inside a template literal ending the ${ … } too early, generic type arguments in TypeScript (Map<string, number>) being colored as JSX tags, and everything after ?> in PHP becoming an error. The full list is on the compatibility page of the documentation site.

Speed

Warm conversion of a whole Markdown document (median time per conversion, after initialization), measured on Nov 1, 2026, before v0.1.0, on a 4-core cloud machine with Go 1.25.0 and Node 22.23.4:

Implementation input.md (30 KB, 6 code blocks) multilang.md (25 KB, 25 code blocks: one in each of the 24 languages supported then, and one plain text)
fasthighlight 0.61–0.72 ms 2.1–2.2 ms
Chroma (all languages) 4.8–4.9 ms 41.6–44.5 ms
Node: markdown-it + highlight.js 2.8–2.9 ms 9.8–10.0 ms
Node: markdown-it + Shiki 8.7–9.7 ms 68.4–71.9 ms

Both documents are in testdata/. The implementations color code at different levels of detail, so the numbers compare whole conversions, not identical output. To measure them yourself, including cold starts and a 270 KB document, see docs/benchmark.md.

Documentation

  • The documentation site, toshi-kuji.github.io/fasthighlight, explains the command, the library, use cases, themes and compatibility with Chroma. Its source is in website/.
  • fhl --help lists every flag of fhl, with examples.
  • The Go documentation is on pkg.go.dev: fasthighlight (highlighting) and markdown (Markdown with goldmark).

License

MIT. See LICENSE. The highlighting reproduces Chroma's lexing rules, token types and HTML output, the markdown package and fhl use goldmark, and the color themes of fhl are copied from other projects; their licenses are in THIRD_PARTY_NOTICES.md.

Documentation

Overview

Package fasthighlight highlights code into HTML with language-specific tokenizers that do not use regular expressions. The highlighting follows the Chroma 2.27.0 language definitions as a reference, and fixes Chroma's mistakes.

This package does the highlighting only and has no dependencies outside the standard library. To turn Markdown into HTML with highlighted code blocks, use the markdown package (github.com/toshi-kuji/fasthighlight/markdown), which adds this package to goldmark.

The HTML it writes has the form <pre class="highlight"><code>…</code></pre>, and tokens are wrapped in <span>s with short class names such as k (keyword), s (string), and nf (function name) (the naming shared by Pygments, Chroma, and Rouge). Colors are applied with CSS. If a language name is given, <pre> gets data-lang="language name" and <code> gets class="language-language name", as written in the code block (even for a language that is not registered).

Usage

Register the languages to highlight by importing the language packages. Use lang/all for all languages; import only the ones you need to keep your program small.

import _ "github.com/toshi-kuji/fasthighlight/lang/all"

Highlight one piece of code:

err := fasthighlight.Highlight(w, "go", code)

Code of a language that is not registered is only escaped, without highlighting.

Languages

LookupRegistered finds a language among the registered ones (those that can be used for highlighting now, including languages registered directly with Register). LookupSupported finds a language among the languages fasthighlight provides, whether their packages are imported or not, and tells which package to import.

When you register a language yourself, set Language.ParallelHint by the same criterion as the languages fasthighlight provides: HintHeavy for languages whose highlighting takes much work (the programming languages, including CSS), and HintLight or nothing otherwise. The markdown package uses it to decide when to highlight a document's code blocks in parallel.

Index

Constants

View Source
const CoalesceLimit = 8192

CoalesceLimit is the upper limit (in bytes) on the length to which tokens of the same type are merged into one. As in Chroma's Coalesce, once a merged token reaches this length, following tokens of the same type are not merged (they become a separate token). In HTML, that makes a separate <span>.

Variables

This section is empty.

Functions

func Highlight

func Highlight(w io.Writer, lang, code string) error

Highlight turns one code block into HTML. lang is the code block's language name; if it is not empty, it is put in the <pre> data-lang and the <code> class (language-lang). A language that is not registered is written as Text without highlighting (only escaped).

func IsPlainText

func IsPlainText(name string) bool

IsPlainText reports whether a code block's language name marks it as plain text on purpose: the name or an alias of Chroma's plaintext lexer (plaintext, text, plain, no-highlight), in any case. Such a block is not highlighted, like any language that is not registered, but it is not missing a language, so markdown.Scan and fhl do not report it.

func NormalizeNewlines

func NormalizeNewlines(s string) string

NormalizeNewlines turns \r\n and \r into \n (the same as Chroma's EnsureLF). If there is no \r, it returns s as is.

func Register

func Register(l *Language)

Register registers a language. It panics if a name or alias collides with a registered language (the registered languages are not changed). It is normally called from the init of a language package.

func WriteHTML

func WriteHTML(w io.Writer, toks []Token) error

WriteHTML turns tokens into HTML and writes it to w.

Types

type Language

type Language struct {
	// Name is the name of the language. It is the same as name in the Chroma language definition (e.g. "TypeScript").
	Name string
	// Aliases are the names accepted as a code block's language name. They are the same as Chroma's alias.
	// The lower-cased Name is also accepted automatically.
	Aliases []string
	// Filenames are file name patterns (e.g. "*.ts"). They are the same as Chroma's filename.
	// When a language name is in neither the names nor the aliases, it is matched as an extension (e.g. "mts")
	// or as a file name, as in Chroma.
	Filenames []string
	// EnsureNewline is Chroma's ensure_nl. If true, input that does not end with a newline gets one appended
	// before it is split. As in Chroma, the appended newline stays in the output only when it is included
	// in a token that started before it (e.g. "// c" becomes "// c\n", but no newline follows "x = 1").
	EnsureNewline bool
	// Package is the import path of the package that registers this language. Only languages provided by
	// fasthighlight have it.
	Package string
	// ParallelHint tells how much work highlighting this language takes, which decides how few code blocks
	// are enough to highlight a document in parallel (see the markdown package). It is HintHeavy,
	// HintLight, or HintDefault (not specified).
	//
	// A language you register yourself should be chosen by the same criterion as the languages
	// fasthighlight provides. Among those, the heavy ones are the programming languages (Bash, C, C#, C++,
	// CSS, Go, Java, JavaScript, Kotlin, PHP, PowerShell, Python, R, react, Ruby, Rust, SCSS, Swift and
	// TypeScript) and the languages mostly read as Bash (Bash Session, Docker and Makefile); the others are
	// not specified, which is
	// treated like HintLight. When in doubt, leave it unspecified or use HintLight (going parallel is less
	// likely to make things slower).
	ParallelHint ParallelHint

	// Lex splits text into tokens. It is called from Tokenise.
	// text is the input with a newline appended if EnsureNewline is set. end is the length before the
	// append, and Lex must not start a new token (one match of a Chroma rule) at or after end. A match that
	// started before end may include the appended newline past end (as in Chroma). The concatenated
	// tokens are the part of text from its start (of length end or len(text)).
	Lex func(text string, end int) []Token
	// Prepare builds things such as keyword tables (optional). It is called once, before the first
	// Tokenise. So that only the languages in use are prepared, the tables are built here, not at import time.
	Prepare func()
	// contains filtered or unexported fields
}

Language is the tokenizer for one language.

A language is registered with Register when its package is imported (the same mechanism as database/sql drivers in Go). To use all languages, import github.com/toshi-kuji/fasthighlight/lang/all.

The information about the languages fasthighlight provides (names and so on) is in the built-in catalog (Builtins). A language package receives its information with Builtin, adds Lex and Prepare, and registers it.

func Builtin

func Builtin(name string) *Language

Builtin returns the information of a language fasthighlight provides. A language package uses it to Register with Lex and Prepare added. It panics if the name is not in the list.

func Builtins

func Builtins() []*Language

Builtins returns the information of all the languages fasthighlight provides, in name order. It includes languages that are not imported.

func Languages

func Languages() []*Language

Languages returns the registered languages in name order.

func LookupRegistered

func LookupRegistered(name string) *Language

LookupRegistered looks up a code block's language name among the languages that can be used for highlighting now: the registered ones, that is, those of the imported language packages and those registered directly with Register. It searches in the same order as Chroma's lexers.Get (names and aliases, extension, file name). It returns nil if not found.

func LookupSupported

func LookupSupported(name string) *Language

LookupSupported looks up a code block's language name among the languages fasthighlight provides (the built-in catalog, see Builtins), whether their packages are imported or not. Languages registered directly with Register are not included. It searches the same way as LookupRegistered and returns nil if not found.

The returned language's Package is the package to import to highlight it. If that package is not imported, the language is not registered and cannot be used for highlighting (it has no Lex).

func (*Language) Tokenise

func (l *Language) Tokenise(code string) []Token

Tokenise splits code into tokens. As in Chroma, it first normalizes newlines to \n (\r\n and \r become \n). If EnsureNewline is true, a newline is appended before splitting. The concatenated tokens are the newline-normalized code, or that with a newline added.

type ParallelHint

type ParallelHint int

ParallelHint tells how much work highlighting a language takes. It decides how few code blocks are enough to highlight a document in parallel.

const (
	// HintDefault means the hint is not specified (the zero value). Parallel highlighting treats it like
	// HintLight. It is kept apart from HintLight so that an unspecified hint can be told apart from a
	// chosen one.
	HintDefault ParallelHint = iota
	// HintHeavy means highlighting takes much work, so going parallel pays off with fewer code blocks.
	HintHeavy
	// HintLight means highlighting takes little work, so going parallel pays off only with more code blocks.
	HintLight
)

type Token

type Token struct {
	Type  TokenType
	Value string
}

Token is a part of the input and its type. Value is a substring of the input and is not copied.

type TokenType

type TokenType int

TokenType is the type of a token.

Types form major categories in steps of 1000 and subcategories in steps of 100. For example, strings (LiteralString) are 3100 to 3199, which belong to the major category Literal (3000 to 3999).

const (
	Background TokenType = -1 - iota
	PreWrapper
	Line
	LineNumbers
	LineNumbersTable
	LineHighlight
	LineTable
	LineTableTD
	LineLink
	CodeLine
	Error // input that could not be made into a token
	Other
	None
	Ignore
	EOFType TokenType = 0
)

Types of output parts (negative values).

const (
	Keyword TokenType = 1000 + iota
	KeywordConstant
	KeywordDeclaration
	KeywordNamespace
	KeywordPseudo
	KeywordReserved
	KeywordType
)

Keywords.

const (
	Name TokenType = 2000 + iota
	NameAttribute
	NameClass
	NameConstant
	NameDecorator
	NameEntity
	NameException
	NameKeyword
	NameLabel
	NameNamespace
	NameOperator
	NameOther
	NamePseudo
	NameProperty
	NameTag
)

Names.

const (
	NameBuiltin TokenType = 2100 + iota
	NameBuiltinPseudo
)

Built-in names.

const (
	NameVariable TokenType = 2200 + iota
	NameVariableAnonymous
	NameVariableClass
	NameVariableGlobal
	NameVariableInstance
	NameVariableMagic
)

Variable names.

const (
	NameFunction TokenType = 2300 + iota
	NameFunctionMagic
)

Function names.

const (
	Literal TokenType = 3000 + iota
	LiteralDate
	LiteralOther
)

Literals.

const (
	LiteralString TokenType = 3100 + iota
	LiteralStringAffix
	LiteralStringAtom
	LiteralStringBacktick
	LiteralStringBoolean
	LiteralStringChar
	LiteralStringDelimiter
	LiteralStringDoc
	LiteralStringDouble
	LiteralStringEscape
	LiteralStringHeredoc
	LiteralStringInterpol
	LiteralStringName
	LiteralStringOther
	LiteralStringRegex
	LiteralStringSingle
	LiteralStringSymbol
)

Strings.

const (
	LiteralNumber TokenType = 3200 + iota
	LiteralNumberBin
	LiteralNumberFloat
	LiteralNumberHex
	LiteralNumberInteger
	LiteralNumberIntegerLong
	LiteralNumberOct
	LiteralNumberByte
)

Numbers.

const (
	Operator TokenType = 4000 + iota
	OperatorWord
	OperatorReserved
)

Operators.

const (
	Comment TokenType = 6000 + iota
	CommentHashbang
	CommentMultiline
	CommentSingle
	CommentSpecial
)

Comments.

const (
	CommentPreproc TokenType = 6100 + iota
	CommentPreprocFile
)

Preprocessor "comments".

const (
	Generic TokenType = 7000 + iota
	GenericDeleted
	GenericEmph
	GenericError
	GenericHeading
	GenericInserted
	GenericOutput
	GenericPrompt
	GenericStrong
	GenericSubheading
	GenericTraceback
	GenericUnderline
)

Generic (diffs, headings, and so on).

const (
	Text TokenType = 8000 + iota
	TextWhitespace
	TextSymbol
	TextPunctuation
)

Text.

const (
	Punctuation TokenType = 5000 + iota
)

Punctuation.

func (TokenType) Category

func (t TokenType) Category() TokenType

Category returns the start of the major category.

func (TokenType) Class

func (t TokenType) Class() (class string, ok bool)

Class returns the CSS class name of the type. For a type not in the table, ok is false.

func (TokenType) Parent

func (t TokenType) Parent() TokenType

Parent returns the next category up: for a subcategory member, the start of the subcategory; for the start of a subcategory, the start of the major category; for the start of a major category, 0.

func (TokenType) String

func (t TokenType) String() string

String returns the name of the type.

func (TokenType) SubCategory

func (t TokenType) SubCategory() TokenType

SubCategory returns the start of the subcategory.

Directories

Path Synopsis
cmd
bench command
fhl command
fhl is a command that turns Markdown files into HTML with highlighted code blocks.
fhl is a command that turns Markdown files into HTML with highlighted code blocks.
prof command
internal
bash
Package bash is the Bash tokenizer.
Package bash is the Bash tokenizer.
c
Package c is the tokenizer for C and C++.
Package c is the tokenizer for C and C++.
css
Package css is the CSS tokenizer.
Package css is the CSS tokenizer.
golang
Package golang is the Go tokenizer.
Package golang is the Go tokenizer.
html
Package html is the HTML tokenizer.
Package html is the HTML tokenizer.
http
Package http is the HTTP tokenizer.
Package http is the HTTP tokenizer.
ini
Package ini is the INI tokenizer.
Package ini is the INI tokenizer.
java
Package java is the Java tokenizer.
Package java is the Java tokenizer.
js
Package js is the JavaScript tokenizer.
Package js is the JavaScript tokenizer.
json
Package json is the JSON tokenizer.
Package json is the JSON tokenizer.
lexkit
Package lexkit provides the shared parts of tokenizers that reproduce Chroma's regular-expression rules by hand.
Package lexkit provides the shared parts of tokenizers that reproduce Chroma's regular-expression rules by hand.
markdown
Package markdown is the Markdown tokenizer.
Package markdown is the Markdown tokenizer.
php
Package php is the PHP tokenizer.
Package php is the PHP tokenizer.
python
Package python is the Python tokenizer.
Package python is the Python tokenizer.
r
Package r is the R tokenizer.
Package r is the R tokenizer.
ruby
Package ruby is the Ruby tokenizer.
Package ruby is the Ruby tokenizer.
swift
Package swift is the Swift tokenizer.
Package swift is the Swift tokenizer.
testcases
Package testcases holds the inputs shared by the tests of the main package and the comparison tests in compat/.
Package testcases holds the inputs shared by the tests of the main package and the comparison tests in compat/.
typescript
Package typescript is the TypeScript tokenizer.
Package typescript is the TypeScript tokenizer.
xml
Package xml is the XML tokenizer.
Package xml is the XML tokenizer.
lang
all
Package all registers every language that fasthighlight supports.
Package all registers every language that fasthighlight supports.
bash
Package bash registers Bash (sh, zsh, and other shells).
Package bash registers Bash (sh, zsh, and other shells).
bashsession
Package bashsession registers Bash Session (a shell session: prompts with commands, and their output).
Package bashsession registers Bash Session (a shell session: prompts with commands, and their output).
c
Package c registers C.
Package c registers C.
cpp
Package cpp registers C++.
Package cpp registers C++.
csharp
Package csharp registers C#.
Package csharp registers C#.
css
Package css registers CSS.
Package css registers CSS.
diff
Package diff registers diff.
Package diff registers diff.
docker
Package docker registers Docker (Dockerfile and Containerfile).
Package docker registers Docker (Dockerfile and Containerfile).
golang
Package golang registers Go.
Package golang registers Go.
graphql
Package graphql registers GraphQL.
Package graphql registers GraphQL.
html
Package html registers HTML.
Package html registers HTML.
http
Package http registers HTTP.
Package http registers HTTP.
ini
Package ini registers INI.
Package ini registers INI.
java
Package java registers Java.
Package java registers Java.
javascript
Package javascript registers JavaScript.
Package javascript registers JavaScript.
json
Package json registers JSON.
Package json registers JSON.
kotlin
Package kotlin registers Kotlin.
Package kotlin registers Kotlin.
makefile
Package makefile registers Makefile (make, BSD make, and justfiles).
Package makefile registers Makefile (make, BSD make, and justfiles).
markdown
Package markdown registers Markdown.
Package markdown registers Markdown.
php
Package php registers PHP.
Package php registers PHP.
powershell
Package powershell registers PowerShell.
Package powershell registers PowerShell.
protobuf
Package protobuf registers Protocol Buffer.
Package protobuf registers Protocol Buffer.
python
Package python registers Python.
Package python registers Python.
r
Package r registers R.
Package r registers R.
react
Package react registers react (JavaScript with JSX).
Package react registers react (JavaScript with JSX).
ruby
Package ruby registers Ruby.
Package ruby registers Ruby.
rust
Package rust registers Rust.
Package rust registers Rust.
scss
Package scss registers SCSS.
Package scss registers SCSS.
sql
Package sql registers SQL.
Package sql registers SQL.
swift
Package swift registers Swift.
Package swift registers Swift.
toml
Package toml registers TOML.
Package toml registers TOML.
typescript
Package typescript registers TypeScript.
Package typescript registers TypeScript.
xml
Package xml registers XML.
Package xml registers XML.
yaml
Package yaml registers YAML.
Package yaml registers YAML.
Package markdown turns Markdown into HTML with highlighted code blocks, by adding fasthighlight to goldmark (github.com/yuin/goldmark).
Package markdown turns Markdown into HTML with highlighted code blocks, by adding fasthighlight to goldmark (github.com/yuin/goldmark).

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL