Code
Hub
Workspaces
Following
Trending
Connect
MCP
copy
Create free account
hub
/
github.com/charmbracelet/glamour
/ functions
Functions
282 in github.com/charmbracelet/glamour
⨍
Functions
282
◇
Types & classes
53
↓ 16 callers
Function
NewTermRenderer
NewTermRenderer returns a new TermRenderer the given options.
glamour.go:69
↓ 15 callers
Method
Current
Current returns the current BlockElement.
ansi/blockstack.go:80
↓ 15 callers
Function
renderImage
renderImage renders in as markdown with the given options and returns the rendered document and its renderer.
ansi/image_test.go:429
↓ 13 callers
Method
Close
Close closes the [MarginWriter].
ansi/margin.go:62
↓ 13 callers
Method
Render
Render returns the markdown rendered into a string.
glamour.go:345
↓ 12 callers
Function
renderText
(w io.Writer, rules StylePrimitive, s string)
ansi/baseelement.go:39
↓ 11 callers
Method
Parent
Parent returns the current BlockElement's parent.
ansi/blockstack.go:69
↓ 8 callers
Method
Render
Render renders a BaseElement.
ansi/baseelement.go:111
↓ 8 callers
Method
Width
Width returns the available rendering width.
ansi/blockstack.go:61
↓ 7 callers
Function
NewRenderer
NewRenderer returns a new ANSIRenderer with style and options set.
ansi/renderer.go:99
↓ 7 callers
Function
rasterizeSVGReader
rasterizeSVGReader parses and rasterizes the SVG document, see [rasterizeSVG].
ansi/svg.go:149
↓ 6 callers
Function
NewRenderContext
NewRenderContext returns a new RenderContext.
ansi/context.go:33
↓ 6 callers
Method
Render
(w io.Writer, ctx RenderContext)
ansi/elements.go:18
↓ 6 callers
Method
RenderBytes
RenderBytes returns the markdown rendered into a byte slice.
glamour.go:351
↓ 6 callers
Function
WithStandardStyle
WithStandardStyle sets a TermRenderer's styles with a standard (builtin) style.
glamour.go:111
↓ 5 callers
Function
cascadeStyle
(parent StyleBlock, child StyleBlock, toBlock bool)
ansi/style.go:238
↓ 5 callers
Method
imageCachesOf
imageCachesOf returns the renderer's image caches. It is nil only when a RenderContext was constructed directly instead of via NewRenderContext; the c
ansi/context.go:53
↓ 5 callers
Function
visibleText
visibleText returns the text a terminal would display for the given rendered output, i.e. with all escape sequences removed.
ansi/image_test.go:41
↓ 4 callers
Method
GraphicsCommands
GraphicsCommands returns the out-of-band graphics protocol sequences (image transmission and placement commands) collected during the last render. Cal
ansi/renderer.go:110
↓ 4 callers
Function
NewIndentWriter
NewIndentWriter returns a new IndentWriter.
ansi/margin.go:154
↓ 4 callers
Method
With
With returns a StylePrimitive that inherits the current BlockElement's style.
ansi/blockstack.go:91
↓ 4 callers
Method
Write
Write writes to the margin writer and implements [io.Writer].
ansi/margin.go:53
↓ 4 callers
Function
classifyImageURL
classifyImageURL reports where the image at the given URL comes from. Anything that isn't a local path, an http(s) URL, or a data: URI is an error: UR
ansi/image.go:626
↓ 4 callers
Function
loadImageConfig
loadImageConfig reads an image's dimensions and format from its header, without decoding its pixels. Results are cached per URL.
ansi/image.go:748
↓ 4 callers
Function
localImagePath
localImagePath returns the local file path for the given URL, which can be a plain path or a file:// URL. Windows drive letters are handled, i.e. file
ansi/image.go:975
↓ 4 callers
Function
svgTextRuns
svgTextRuns extracts the SVG document's text runs. oksvg, which parses the shapes, doesn't render text, so it is parsed separately here. Malformed doc
ansi/svg.go:221
↓ 4 callers
Function
writeKittyImage
writeKittyImage writes the kitty graphics sequence transmitting the image at url with the given options, for display in a cols x rows cell box. It pic
ansi/image.go:525
↓ 3 callers
Method
Close
Close must be called after writing to TermRenderer. You can then retrieve the rendered markdown by calling Read.
glamour.go:334
↓ 3 callers
Method
Close
Close closes the [IndentWriter].
ansi/margin.go:227
↓ 3 callers
Function
Detect
Detect checks if the given URL matches any of the known patterns and returns a human-readable formatted string if a match is found.
internal/autolink/autolink.go:48
↓ 3 callers
Method
Len
Len returns the length of the stack.
ansi/blockstack.go:12
↓ 3 callers
Function
NewMarginWriter
NewMarginWriter returns a new MarginWriter.
ansi/margin.go:21
↓ 3 callers
Method
Pop
Pop removes the last item on the stack.
ansi/blockstack.go:22
↓ 3 callers
Method
Push
Push appends an item to the stack.
ansi/blockstack.go:17
↓ 3 callers
Function
RenderBytes
RenderBytes initializes a new TermRenderer and renders a markdown with a specific style.
glamour.go:58
↓ 3 callers
Method
StyleOverrideRender
(w io.Writer, ctx RenderContext, style StylePrimitive)
ansi/elements.go:23
↓ 3 callers
Function
WithHyperlinkMode
WithHyperlinkMode sets how hyperlinks are rendered. Use [ansi.HyperlinkModeInline] when the terminal supports OSC 8 hyperlinks: the link text will be
glamour.go:212
↓ 3 callers
Function
WithStylePath
WithStylePath sets a TermRenderer's style from stylePath. stylePath is first interpreted as a filename. If no such file exists, it is re-interpreted a
glamour.go:131
↓ 3 callers
Function
WithStyles
WithStyles sets a TermRenderer's styles.
glamour.go:148
↓ 3 callers
Function
WithWordWrap
WithWordWrap sets a TermRenderer's word wrap.
glamour.go:175
↓ 3 callers
Function
boolPtr
(b bool)
styles/styles.go:689
↓ 3 callers
Function
downscaleImage
downscaleImage scales img down to at most maxW x maxH pixels using nearest-neighbor sampling, preserving the aspect ratio. Images that already fit are
ansi/image.go:722
↓ 3 callers
Function
imageDisplaySize
imageDisplaySize calculates the display size of an image in terminal cells. It constrains the image to the width available in the block the image is r
ansi/image.go:679
↓ 3 callers
Function
imageID
imageID returns a stable, positive identifier for an image URL, fitting in 24 bits so it can be encoded in the foreground color of a Unicode placehold
ansi/image.go:663
↓ 3 callers
Function
makeHyperlink
makeHyperlink takes a URL and returns an OSC 8 hyperlink token.
ansi/link.go:107
↓ 3 callers
Method
remoteData
(url string)
ansi/image.go:154
↓ 3 callers
Function
resolveRelativeURL
(baseURL string, rel string)
ansi/renderer.go:233
↓ 3 callers
Method
setRemoteData
(url string, data []byte)
ansi/image.go:164
↓ 3 callers
Function
stringPtr
(s string)
styles/styles.go:690
↓ 3 callers
Function
uintPtr
(u uint)
styles/styles.go:691
↓ 3 callers
Function
writePNG
(t *testing.T, path string, img image.Image)
ansi/image_test.go:818
↓ 2 callers
Method
Margin
Margin returns the current margin level of all elements in the stack.
ansi/blockstack.go:47
↓ 2 callers
Function
WithEnvironmentConfig
WithEnvironmentConfig sets a TermRenderer's styles based on the GLAMOUR_STYLE environment variable.
glamour.go:124
↓ 2 callers
Function
benchRender
(b *testing.B, doc string)
render_bench_test.go:25
↓ 2 callers
Function
cascadeStylePrimitive
(parent, child StylePrimitive, toBlock bool)
ansi/style.go:156
↓ 2 callers
Function
cascadeStylePrimitives
(s ...StylePrimitive)
ansi/style.go:148
↓ 2 callers
Function
checkImageSize
checkImageSize reports whether an image with the given header dimensions may be decoded, under the given pixel limit. Zero applies [DefaultMaxImagePix
ansi/image.go:397
↓ 2 callers
Function
chromaTestStyle
chromaTestStyle returns a style whose code blocks differ only in the color given to every token, by way of the chroma text and name entries.
ansi/codeblock_test.go:15
↓ 2 callers
Method
config
(url string)
ansi/image.go:116
↓ 2 callers
Function
decodeDataURL
decodeDataURL decodes the payload of a data: URI. Both base64 payloads, e.g. data:image/png;base64,<base64 data>, and percent-encoded ones are support
ansi/image.go:906
↓ 2 callers
Method
doRender
(w io.Writer, ctx RenderContext, style StylePrimitive)
ansi/emphasis.go:33
↓ 2 callers
Method
doRender
(w io.Writer, st1, st2 StylePrimitive)
ansi/baseelement.go:118
↓ 2 callers
Method
encodeGraphics
encodeGraphics encodes the image at url into graphics protocol sequences sized to cols x rows terminal cells, along with the newlines needed to reserv
ansi/image.go:416
↓ 2 callers
Function
fetchRemoteImage
fetchRemoteImage fetches the bytes of a remote image, checking for unsupported content types and rejecting oversized downloads. Responses are cached i
ansi/image.go:936
↓ 2 callers
Method
flushPendingImages
flushPendingImages writes any pending graphics protocol sequences to w.
ansi/context.go:68
↓ 2 callers
Function
getDefaultStyle
(style string)
glamour.go:383
↓ 2 callers
Function
getEnvironmentStyle
()
glamour.go:374
↓ 2 callers
Method
image
(url string)
ansi/image.go:135
↓ 2 callers
Function
imageData
imageData returns the bytes of the image embedded in the given data: URI, e.g. data:image/png;base64,<base64 data>. Both base64 and percent-encoded pa
ansi/image.go:889
↓ 2 callers
Function
isSVG
isSVG reports whether the image at url, with the given data, is an SVG document. SVG isn't a raster image format, so it is parsed and rasterized separ
ansi/image.go:817
↓ 2 callers
Function
isSVGData
isSVGData reports whether the data is an SVG document, i.e. XML with an <svg> root element, skipping a BOM, the XML declaration, comments and a DOCTYP
ansi/svg.go:59
↓ 2 callers
Function
linkDomain
(href string)
ansi/table_links.go:222
↓ 2 callers
Function
loadImage
loadImage loads and decodes an image from a local file, a data: URI, or a remote URL. SVGs are rasterized to fit the maxW x maxH pixel box, keeping th
ansi/image.go:826
↓ 2 callers
Function
maxSourcePixels
maxSourcePixels returns the maximum number of source pixels an image displayed in cols x rows cells can use without visible loss of quality.
ansi/image.go:552
↓ 2 callers
Function
nodeContent
(node ast.Node, source []byte)
ansi/table_links.go:196
↓ 2 callers
Function
normalizeSVG
normalizeSVG prepares an SVG document for the parser: path data and colors are rewritten into forms it reads reliably.
ansi/svg.go:614
↓ 2 callers
Function
normalizeSVGColors
normalizeSVGColors rewrites fill and stroke colors that use rgba(), which the parser rejects (failing the whole document), into an rgb() color, and fo
ansi/svg.go:623
↓ 2 callers
Function
normalizeSVGPath
normalizeSVGPath rewrites SVG path data into a form that parsers read reliably: every command letter is followed by exactly one set of arguments, sepa
ansi/svg.go:834
↓ 2 callers
Function
normalizeSVGPaths
normalizeSVGPaths rewrites the path data of an SVG document, see [normalizeSVGPath].
ansi/svg.go:806
↓ 2 callers
Function
parseSVG
parseSVG parses an SVG document and returns it with its intrinsic size.
ansi/svg.go:89
↓ 2 callers
Function
parseSVGColor
parseSVGColor parses an SVG color: a #rgb or #rrggbb hex value, an rgb()/rgba() function, or a named color.
ansi/svg.go:391
↓ 2 callers
Function
readSVGConfig
readSVGConfig parses the SVG document and returns its intrinsic size as the image config.
ansi/svg.go:102
↓ 2 callers
Function
renderCodeBlock
(s StyleConfig)
ansi/codeblock_test.go:23
↓ 2 callers
Function
scaleToCells
scaleToCells scales img down to the pixel size of a cols x rows terminal cell box using nearest-neighbor sampling, preserving the aspect ratio. A cell
ansi/image.go:712
↓ 2 callers
Method
sequence
(key sequenceCacheKey)
ansi/image.go:173
↓ 2 callers
Method
setConfig
(url string, config imageConfig)
ansi/image.go:126
↓ 2 callers
Method
setImage
(url string, img image.Image)
ansi/image.go:145
↓ 2 callers
Method
setSequence
(key sequenceCacheKey, seqs graphicsSequences)
ansi/image.go:183
↓ 2 callers
Function
sniffHead
sniffHead returns the leading bytes of r without consuming them, for telling SVGs apart from raster images. Fewer bytes are returned for shorter input
ansi/svg.go:34
↓ 2 callers
Function
styleText
styleText applies rules to s and returns the styled string. Split out of renderText so callers that write the same styled text repeatedly (padding and
ansi/baseelement.go:55
↓ 2 callers
Function
svgAttrSpan
svgAttrSpan returns the position of the value of a start tag's attribute.
ansi/svg.go:711
↓ 2 callers
Function
svgDeclSpan
svgDeclSpan returns the position of the value of a style declaration.
ansi/svg.go:743
↓ 2 callers
Function
svgDisplaySize
svgDisplaySize computes the display size of an SVG image in terminal cells from its intrinsic size in CSS pixels. An SVG's declared size is the size i
ansi/svg.go:125
↓ 2 callers
Function
svgFace
svgFace returns a font face of the given size in pixels.
ansi/svg.go:539
↓ 2 callers
Function
svgIdentity
()
ansi/svg.go:433
↓ 2 callers
Method
times
times returns m applied after o.
ansi/svg.go:440
↓ 1 callers
Method
Finish
(w io.Writer, ctx RenderContext)
ansi/elements.go:28
↓ 1 callers
Method
Indent
Indent returns the current indentation level of all elements in the stack.
ansi/blockstack.go:33
↓ 1 callers
Method
NewElement
NewElement returns the appropriate render Element for a given node.
ansi/elements.go:41
↓ 1 callers
Function
NewPaddingWriter
NewPaddingWriter returns a new PaddingWriter.
ansi/margin.go:79
next →
1–100 of 282, ranked by callers