Documentation
¶
Overview ¶
Package code registers the source-code renderer with the stripes registry. Import for side effects to enable text/x-source-code support and chroma's filename-based language detection in stripes.Detect:
import _ "github.com/firetiger-oss/stripes/code"
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func New ¶
New returns a stripes.Renderer that highlights source code using the chroma lexer named lang. When lang is empty the renderer falls back to chroma's content-based language detection; if no lexer can be resolved the input is written verbatim.
func RenderWasm ¶
RenderWasm writes a styled rendering of the binary WebAssembly module (application/wasm) read from r to w. It disassembles the input by invoking an external tool and highlights the resulting WAT text with chroma's wat lexer.
The preferred backend is "wasm-tools print" from the bytecodealliance (https://github.com/bytecodealliance/wasm-tools), which tracks the current WebAssembly specification including the component model. When wasm-tools is not on $PATH, RenderWasm falls back to "wasm2wat" from WABT (https://github.com/WebAssembly/wabt). When neither is available, RenderWasm writes a single-line diagnostic instead of failing silently. Install via "cargo install wasm-tools" or "brew install wasm-tools"; install WABT via "brew install wabt" or "apt install wabt".
Types ¶
This section is empty.