package highlight
import "github.com/gohugoio/hugo/markup/highlight"
Package highlight provides code highlighting.
Index ¶
- Variables
- func ApplyLegacyConfig(cfg config.Provider, conf *Config) error
- func GetCodeBlockOptions() func(ctx hl.CodeBlockContext) []html.Option
- func WriteCodeTag(w io.Writer, language string)
- type Config
- type Highlighter
Variables ¶
var DefaultConfig = Config{ Style: "monokai", LineNoStart: 1, CodeFences: true, NoClasses: true, LineNumbersInTable: true, TabWidth: 4, }
Functions ¶
func ApplyLegacyConfig ¶
ApplyLegacyConfig applies legacy config from back when we had Pygments.
func GetCodeBlockOptions ¶
func GetCodeBlockOptions() func(ctx hl.CodeBlockContext) []html.Option
func WriteCodeTag ¶
Types ¶
type Config ¶
type Config struct { Style string CodeFences bool // Use inline CSS styles. NoClasses bool // When set, line numbers will be printed. LineNos bool LineNumbersInTable bool // When set, add links to line numbers AnchorLineNos bool LineAnchors string // Start the line numbers from this value (default is 1). LineNoStart int // A space separated list of line numbers, e.g. “3-8 10-20”. Hl_Lines string // TabWidth sets the number of characters for a tab. Defaults to 4. TabWidth int GuessSyntax bool }
func (Config) ToHTMLOptions ¶
type Highlighter ¶
type Highlighter struct {
// contains filtered or unexported fields
}
func New ¶
func New(cfg Config) Highlighter
func (Highlighter) Highlight ¶
func (h Highlighter) Highlight(code, lang, optsStr string) (string, error)
Source Files ¶
- Version
- v0.84.2
- Published
- Jun 28, 2021
- Platform
- js/wasm
- Imports
- 12 packages
- Last checked
- 23 minutes ago –
Tools for package owners.