svg

package
v2.7.0 Latest Latest
Warning

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

Go to latest
Published: Mar 21, 2023 License: MIT Imports: 8 Imported by: 5

Documentation

Overview

Package svg contains an SVG formatter.

Index

Constants

This section is empty.

Variables

View Source
var FontLiberationMono = `` /* 233248-byte string literal not displayed */

Liberation Mono as base64 encoded woff (SIL Open Font License)[https://en.wikipedia.org/wiki/Liberation_fonts]

Functions

func StyleEntryToSVG

func StyleEntryToSVG(e chroma.StyleEntry) string

StyleEntryToSVG converts a chroma.StyleEntry to SVG attributes.

Types

type FontFormat

type FontFormat int
const (
	WOFF FontFormat = iota
	WOFF2
	TRUETYPE
)

https://transfonter.org/formats

type Formatter

type Formatter struct {
	// contains filtered or unexported fields
}

Formatter that generates SVG.

func New

func New(options ...Option) *Formatter

New SVG formatter.

func (*Formatter) Format

func (f *Formatter) Format(w io.Writer, style *chroma.Style, iterator chroma.Iterator) (err error)

type Option

type Option func(f *Formatter)

Option sets an option of the SVG formatter.

func EmbedFont

func EmbedFont(fontFamily string, font string, format FontFormat) Option

EmbedFont embeds given base64 encoded font

func EmbedFontFile

func EmbedFontFile(fontFamily string, fileName string) (option Option, err error)

EmbedFontFile embeds given font file

func FontFamily

func FontFamily(fontFamily string) Option

FontFamily sets the font-family.

Jump to

Keyboard shortcuts

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