carbonize

package
v1.0.0-beta1 Latest Latest
Warning

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

Go to latest
Published: Sep 11, 2022 License: BSD-3-Clause Imports: 5 Imported by: 0

Documentation

Overview

Package carbonize implements utilities to deal with Carbon configurations and ease interactions with its website.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	BackgroundColor      string     `json:"backgroundColor" url:"bg"`
	Theme                string     `json:"theme" url:"t"`
	WindowTheme          string     `json:"windowTheme" url:"wt"`
	Language             string     `json:"language" url:"l"`
	Width                int        `json:"width" url:"width"`
	DropShadow           bool       `json:"dropShadow" url:"ds"`
	DropShadowOffsetY    string     `json:"dropShadowOffsetY" url:"dsyoff"`
	DropShadowBlurRadius string     `json:"dropShadowBlurRadius" url:"dsblur"`
	WindowControls       bool       `json:"windowControls" url:"wc"`
	WidthAdjustment      bool       `json:"widthAdjustment" url:"wa"`
	PaddingVertical      string     `json:"paddingVertical" url:"pv"`
	PaddingHorizontal    string     `json:"paddingHorizontal" url:"ph"`
	LineNumbers          bool       `json:"lineNumbers" url:"ln"`
	FirstLineNumber      int        `json:"firstLineNumber" url:"fl"`
	FontFamily           string     `json:"fontFamily" url:"fm"`
	FontSize             string     `json:"fontSize" url:"fs"`
	LineHeight           string     `json:"lineHeight" url:"lh"`
	SquaredImage         bool       `json:"squaredImage" url:"si"`
	ExportSize           string     `json:"exportSize" url:"es"`
	Watermark            bool       `json:"watermark" url:"wm"`
	Highlights           Highlights `json:"highlights" url:"highlights"`
}

A Config is a configuration for Carbon.

func ParseConfig

func ParseConfig(f io.Reader) (Config, error)

ParseConfig parses a file with a JSON configuration for Carbon.

Ideally, the configuration file should contain a configuration exported directly from the Carbon website.

func (*Config) QueryString

func (c *Config) QueryString() (string, error)

QueryString builds a URL-encoded query string corresponding to the Config held by c.

type Highlights

type Highlights struct {
	Background string `json:"background" url:"background"`
	Text       string `json:"text" url:"text"`
	Attribute  string `json:"attribute" url:"attribute"`
	Keyword    string `json:"keyword" url:"keyword"`
	Variable   string `json:"variable" url:"variable"`
	Definition string `json:"definition" url:"definition"`
	Property   string `json:"property" url:"property"`
	String     string `json:"string" url:"string"`
	Meta       string `json:"meta" url:"meta"`
	Comment    string `json:"comment" url:"comment"`
	Number     string `json:"number" url:"number"`
	Operator   string `json:"operator" url:"operator"`
}

A Highlights is encapsulated inside a Config. It contains information about the syntax highlighting that Carbon should use for each different token.

Jump to

Keyboard shortcuts

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