MCPcopy Create free account

hub / github.com/charmbracelet/glamour / functions

Functions282 in github.com/charmbracelet/glamour

↓ 16 callersFunctionNewTermRenderer
NewTermRenderer returns a new TermRenderer the given options.
glamour.go:69
↓ 15 callersMethodCurrent
Current returns the current BlockElement.
ansi/blockstack.go:80
↓ 15 callersFunctionrenderImage
renderImage renders in as markdown with the given options and returns the rendered document and its renderer.
ansi/image_test.go:429
↓ 13 callersMethodClose
Close closes the [MarginWriter].
ansi/margin.go:62
↓ 13 callersMethodRender
Render returns the markdown rendered into a string.
glamour.go:345
↓ 12 callersFunctionrenderText
(w io.Writer, rules StylePrimitive, s string)
ansi/baseelement.go:39
↓ 11 callersMethodParent
Parent returns the current BlockElement's parent.
ansi/blockstack.go:69
↓ 8 callersMethodRender
Render renders a BaseElement.
ansi/baseelement.go:111
↓ 8 callersMethodWidth
Width returns the available rendering width.
ansi/blockstack.go:61
↓ 7 callersFunctionNewRenderer
NewRenderer returns a new ANSIRenderer with style and options set.
ansi/renderer.go:99
↓ 7 callersFunctionrasterizeSVGReader
rasterizeSVGReader parses and rasterizes the SVG document, see [rasterizeSVG].
ansi/svg.go:149
↓ 6 callersFunctionNewRenderContext
NewRenderContext returns a new RenderContext.
ansi/context.go:33
↓ 6 callersMethodRender
(w io.Writer, ctx RenderContext)
ansi/elements.go:18
↓ 6 callersMethodRenderBytes
RenderBytes returns the markdown rendered into a byte slice.
glamour.go:351
↓ 6 callersFunctionWithStandardStyle
WithStandardStyle sets a TermRenderer's styles with a standard (builtin) style.
glamour.go:111
↓ 5 callersFunctioncascadeStyle
(parent StyleBlock, child StyleBlock, toBlock bool)
ansi/style.go:238
↓ 5 callersMethodimageCachesOf
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 callersFunctionvisibleText
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 callersMethodGraphicsCommands
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 callersFunctionNewIndentWriter
NewIndentWriter returns a new IndentWriter.
ansi/margin.go:154
↓ 4 callersMethodWith
With returns a StylePrimitive that inherits the current BlockElement's style.
ansi/blockstack.go:91
↓ 4 callersMethodWrite
Write writes to the margin writer and implements [io.Writer].
ansi/margin.go:53
↓ 4 callersFunctionclassifyImageURL
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 callersFunctionloadImageConfig
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 callersFunctionlocalImagePath
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 callersFunctionsvgTextRuns
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 callersFunctionwriteKittyImage
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 callersMethodClose
Close must be called after writing to TermRenderer. You can then retrieve the rendered markdown by calling Read.
glamour.go:334
↓ 3 callersMethodClose
Close closes the [IndentWriter].
ansi/margin.go:227
↓ 3 callersFunctionDetect
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 callersMethodLen
Len returns the length of the stack.
ansi/blockstack.go:12
↓ 3 callersFunctionNewMarginWriter
NewMarginWriter returns a new MarginWriter.
ansi/margin.go:21
↓ 3 callersMethodPop
Pop removes the last item on the stack.
ansi/blockstack.go:22
↓ 3 callersMethodPush
Push appends an item to the stack.
ansi/blockstack.go:17
↓ 3 callersFunctionRenderBytes
RenderBytes initializes a new TermRenderer and renders a markdown with a specific style.
glamour.go:58
↓ 3 callersMethodStyleOverrideRender
(w io.Writer, ctx RenderContext, style StylePrimitive)
ansi/elements.go:23
↓ 3 callersFunctionWithHyperlinkMode
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 callersFunctionWithStylePath
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 callersFunctionWithStyles
WithStyles sets a TermRenderer's styles.
glamour.go:148
↓ 3 callersFunctionWithWordWrap
WithWordWrap sets a TermRenderer's word wrap.
glamour.go:175
↓ 3 callersFunctionboolPtr
(b bool)
styles/styles.go:689
↓ 3 callersFunctiondownscaleImage
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 callersFunctionimageDisplaySize
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 callersFunctionimageID
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 callersFunctionmakeHyperlink
makeHyperlink takes a URL and returns an OSC 8 hyperlink token.
ansi/link.go:107
↓ 3 callersMethodremoteData
(url string)
ansi/image.go:154
↓ 3 callersFunctionresolveRelativeURL
(baseURL string, rel string)
ansi/renderer.go:233
↓ 3 callersMethodsetRemoteData
(url string, data []byte)
ansi/image.go:164
↓ 3 callersFunctionstringPtr
(s string)
styles/styles.go:690
↓ 3 callersFunctionuintPtr
(u uint)
styles/styles.go:691
↓ 3 callersFunctionwritePNG
(t *testing.T, path string, img image.Image)
ansi/image_test.go:818
↓ 2 callersMethodMargin
Margin returns the current margin level of all elements in the stack.
ansi/blockstack.go:47
↓ 2 callersFunctionWithEnvironmentConfig
WithEnvironmentConfig sets a TermRenderer's styles based on the GLAMOUR_STYLE environment variable.
glamour.go:124
↓ 2 callersFunctionbenchRender
(b *testing.B, doc string)
render_bench_test.go:25
↓ 2 callersFunctioncascadeStylePrimitive
(parent, child StylePrimitive, toBlock bool)
ansi/style.go:156
↓ 2 callersFunctioncascadeStylePrimitives
(s ...StylePrimitive)
ansi/style.go:148
↓ 2 callersFunctioncheckImageSize
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 callersFunctionchromaTestStyle
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 callersMethodconfig
(url string)
ansi/image.go:116
↓ 2 callersFunctiondecodeDataURL
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 callersMethoddoRender
(w io.Writer, ctx RenderContext, style StylePrimitive)
ansi/emphasis.go:33
↓ 2 callersMethoddoRender
(w io.Writer, st1, st2 StylePrimitive)
ansi/baseelement.go:118
↓ 2 callersMethodencodeGraphics
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 callersFunctionfetchRemoteImage
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 callersMethodflushPendingImages
flushPendingImages writes any pending graphics protocol sequences to w.
ansi/context.go:68
↓ 2 callersFunctiongetDefaultStyle
(style string)
glamour.go:383
↓ 2 callersFunctiongetEnvironmentStyle
()
glamour.go:374
↓ 2 callersMethodimage
(url string)
ansi/image.go:135
↓ 2 callersFunctionimageData
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 callersFunctionisSVG
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 callersFunctionisSVGData
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 callersFunctionlinkDomain
(href string)
ansi/table_links.go:222
↓ 2 callersFunctionloadImage
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 callersFunctionmaxSourcePixels
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 callersFunctionnodeContent
(node ast.Node, source []byte)
ansi/table_links.go:196
↓ 2 callersFunctionnormalizeSVG
normalizeSVG prepares an SVG document for the parser: path data and colors are rewritten into forms it reads reliably.
ansi/svg.go:614
↓ 2 callersFunctionnormalizeSVGColors
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 callersFunctionnormalizeSVGPath
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 callersFunctionnormalizeSVGPaths
normalizeSVGPaths rewrites the path data of an SVG document, see [normalizeSVGPath].
ansi/svg.go:806
↓ 2 callersFunctionparseSVG
parseSVG parses an SVG document and returns it with its intrinsic size.
ansi/svg.go:89
↓ 2 callersFunctionparseSVGColor
parseSVGColor parses an SVG color: a #rgb or #rrggbb hex value, an rgb()/rgba() function, or a named color.
ansi/svg.go:391
↓ 2 callersFunctionreadSVGConfig
readSVGConfig parses the SVG document and returns its intrinsic size as the image config.
ansi/svg.go:102
↓ 2 callersFunctionrenderCodeBlock
(s StyleConfig)
ansi/codeblock_test.go:23
↓ 2 callersFunctionscaleToCells
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 callersMethodsequence
(key sequenceCacheKey)
ansi/image.go:173
↓ 2 callersMethodsetConfig
(url string, config imageConfig)
ansi/image.go:126
↓ 2 callersMethodsetImage
(url string, img image.Image)
ansi/image.go:145
↓ 2 callersMethodsetSequence
(key sequenceCacheKey, seqs graphicsSequences)
ansi/image.go:183
↓ 2 callersFunctionsniffHead
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 callersFunctionstyleText
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 callersFunctionsvgAttrSpan
svgAttrSpan returns the position of the value of a start tag's attribute.
ansi/svg.go:711
↓ 2 callersFunctionsvgDeclSpan
svgDeclSpan returns the position of the value of a style declaration.
ansi/svg.go:743
↓ 2 callersFunctionsvgDisplaySize
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 callersFunctionsvgFace
svgFace returns a font face of the given size in pixels.
ansi/svg.go:539
↓ 2 callersFunctionsvgIdentity
()
ansi/svg.go:433
↓ 2 callersMethodtimes
times returns m applied after o.
ansi/svg.go:440
↓ 1 callersMethodFinish
(w io.Writer, ctx RenderContext)
ansi/elements.go:28
↓ 1 callersMethodIndent
Indent returns the current indentation level of all elements in the stack.
ansi/blockstack.go:33
↓ 1 callersMethodNewElement
NewElement returns the appropriate render Element for a given node.
ansi/elements.go:41
↓ 1 callersFunctionNewPaddingWriter
NewPaddingWriter returns a new PaddingWriter.
ansi/margin.go:79
next →1–100 of 282, ranked by callers