package html
import "github.com/alecthomas/chroma/formatters/html"
Index ¶
- func StyleEntryToCSS(e chroma.StyleEntry) string
- type Formatter
- func New(options ...Option) *Formatter
- func (f *Formatter) Format(w io.Writer, style *chroma.Style, iterator chroma.Iterator) (err error)
- func (f *Formatter) WriteCSS(w io.Writer, style *chroma.Style) error
- type Option
Functions ¶
func StyleEntryToCSS ¶
func StyleEntryToCSS(e chroma.StyleEntry) string
StyleEntryToCSS converts a chroma.StyleEntry to CSS attributes.
Types ¶
type Formatter ¶
type Formatter struct { Classes bool // Exported field to detect when classes are being used // contains filtered or unexported fields }
Formatter that generates HTML.
func New ¶
New HTML formatter.
func (*Formatter) Format ¶
func (*Formatter) WriteCSS ¶
WriteCSS writes CSS style definitions (without any surrounding HTML).
type Option ¶
type Option func(f *Formatter)
Option sets an option of the HTML formatter.
func BaseLineNumber ¶
BaseLineNumber sets the initial number to start line numbering at. Defaults to 1.
func ClassPrefix ¶
ClassPrefix sets the CSS class prefix.
func HighlightLines ¶
HighlightLines higlights the given line ranges with the Highlight style.
A range is the beginning and ending of a range as 1-based line numbers, inclusive.
func LineNumbersInTable ¶
func LineNumbersInTable() Option
LineNumbersInTable will, when combined with WithLineNumbers, separate the line numbers and code in table td's, which make them copy-and-paste friendly.
func Standalone ¶
func Standalone() Option
Standalone configures the HTML formatter for generating a standalone HTML document.
func TabWidth ¶
TabWidth sets the number of characters for a tab. Defaults to 8.
func WithClasses ¶
func WithClasses() Option
WithClasses emits HTML using CSS classes, rather than inline styles.
func WithLineNumbers ¶
func WithLineNumbers() Option
WithLineNumbers formats output with line numbers.
Source Files ¶
- Version
- v0.5.0
- Published
- Aug 2, 2018
- Platform
- js/wasm
- Imports
- 6 packages
- Last checked
- 53 minutes ago –
Tools for package owners.