pax_global_header00006660000000000000000000000064150000045450014503gustar00rootroot0000000000000052 comment=05ee9b5f4dcf3e4426c4ba41e1f9d7ea4f34d603 glamour-0.10.0/000077500000000000000000000000001500000454500132275ustar00rootroot00000000000000glamour-0.10.0/.editorconfig000066400000000000000000000004241500000454500157040ustar00rootroot00000000000000# https://editorconfig.org/ root = true [*] charset = utf-8 insert_final_newline = true trim_trailing_whitespace = true indent_style = space indent_size = 2 [*.go] indent_style = tab indent_size = 8 [*.golden] insert_final_newline = false trim_trailing_whitespace = false glamour-0.10.0/.gitattributes000066400000000000000000000001211500000454500161140ustar00rootroot00000000000000*.golden linguist-generated=true -text *.png filter=lfs diff=lfs merge=lfs -text glamour-0.10.0/.github/000077500000000000000000000000001500000454500145675ustar00rootroot00000000000000glamour-0.10.0/.github/CODEOWNERS000066400000000000000000000000331500000454500161560ustar00rootroot00000000000000* @caarlos0 @aymanbagabas glamour-0.10.0/.github/dependabot.yml000066400000000000000000000014701500000454500174210ustar00rootroot00000000000000version: 2 updates: - package-ecosystem: "gomod" directory: "/" schedule: interval: "weekly" day: "monday" time: "05:00" timezone: "America/New_York" labels: - "dependencies" commit-message: prefix: "chore" include: "scope" - package-ecosystem: "github-actions" directory: "/" schedule: interval: "weekly" day: "monday" time: "05:00" timezone: "America/New_York" labels: - "dependencies" commit-message: prefix: "chore" include: "scope" - package-ecosystem: "docker" directory: "/" schedule: interval: "weekly" day: "monday" time: "05:00" timezone: "America/New_York" labels: - "dependencies" commit-message: prefix: "feat" include: "scope" glamour-0.10.0/.github/workflows/000077500000000000000000000000001500000454500166245ustar00rootroot00000000000000glamour-0.10.0/.github/workflows/build.yml000066400000000000000000000005621500000454500204510ustar00rootroot00000000000000name: build on: [push, pull_request] jobs: build: uses: charmbracelet/meta/.github/workflows/build.yml@main secrets: gh_pat: ${{ secrets.PERSONAL_ACCESS_TOKEN }} semgrep: uses: charmbracelet/meta/.github/workflows/semgrep.yml@main ruleguard: uses: charmbracelet/meta/.github/workflows/ruleguard.yml@main with: go-version: stable glamour-0.10.0/.github/workflows/coverage.yml000066400000000000000000000011211500000454500211350ustar00rootroot00000000000000name: coverage on: [push, pull_request] jobs: coverage: runs-on: ubuntu-latest env: GO111MODULE: "on" steps: - name: Checkout code uses: actions/checkout@v4 - name: Install Go uses: actions/setup-go@v5 with: go-version: stable - name: Coverage env: COVERALLS_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: | go test -race -covermode atomic -coverprofile=profile.cov ./... go install github.com/mattn/goveralls@latest goveralls -coverprofile=profile.cov -service=github glamour-0.10.0/.github/workflows/dependabot-sync.yml000066400000000000000000000006431500000454500224310ustar00rootroot00000000000000name: dependabot-sync on: schedule: - cron: "0 0 * * 0" # every Sunday at midnight workflow_dispatch: # allows manual triggering permissions: contents: write pull-requests: write jobs: dependabot-sync: uses: charmbracelet/meta/.github/workflows/dependabot-sync.yml@main with: repo_name: ${{ github.event.repository.name }} secrets: gh_token: ${{ secrets.PERSONAL_ACCESS_TOKEN }} glamour-0.10.0/.github/workflows/lint-sync.yml000066400000000000000000000004171500000454500212710ustar00rootroot00000000000000name: lint-sync on: schedule: # every Sunday at midnight - cron: "0 0 * * 0" workflow_dispatch: # allows manual triggering permissions: contents: write pull-requests: write jobs: lint: uses: charmbracelet/meta/.github/workflows/lint-sync.yml@main glamour-0.10.0/.github/workflows/lint.yml000066400000000000000000000001631500000454500203150ustar00rootroot00000000000000name: lint on: push: pull_request: jobs: lint: uses: charmbracelet/meta/.github/workflows/lint.yml@main glamour-0.10.0/.github/workflows/release.yml000066400000000000000000000021221500000454500207640ustar00rootroot00000000000000name: goreleaser on: push: tags: - v*.*.* concurrency: group: goreleaser cancel-in-progress: true jobs: goreleaser: uses: charmbracelet/meta/.github/workflows/goreleaser.yml@main secrets: docker_username: ${{ secrets.DOCKERHUB_USERNAME }} docker_token: ${{ secrets.DOCKERHUB_TOKEN }} gh_pat: ${{ secrets.PERSONAL_ACCESS_TOKEN }} goreleaser_key: ${{ secrets.GORELEASER_KEY }} twitter_consumer_key: ${{ secrets.TWITTER_CONSUMER_KEY }} twitter_consumer_secret: ${{ secrets.TWITTER_CONSUMER_SECRET }} twitter_access_token: ${{ secrets.TWITTER_ACCESS_TOKEN }} twitter_access_token_secret: ${{ secrets.TWITTER_ACCESS_TOKEN_SECRET }} mastodon_client_id: ${{ secrets.MASTODON_CLIENT_ID }} mastodon_client_secret: ${{ secrets.MASTODON_CLIENT_SECRET }} mastodon_access_token: ${{ secrets.MASTODON_ACCESS_TOKEN }} discord_webhook_id: ${{ secrets.DISCORD_WEBHOOK_ID }} discord_webhook_token: ${{ secrets.DISCORD_WEBHOOK_TOKEN }} # yaml-language-server: $schema=https://json.schemastore.org/github-workflow.json glamour-0.10.0/.gitignore000066400000000000000000000000151500000454500152130ustar00rootroot00000000000000cmd/ !*.test glamour-0.10.0/.golangci.yml000066400000000000000000000013731500000454500156170ustar00rootroot00000000000000version: "2" run: tests: false linters: enable: - bodyclose - exhaustive - goconst - godot - godox - gomoddirectives - goprintffuncname - gosec - misspell - nakedret - nestif - nilerr - noctx - nolintlint - prealloc - revive - rowserrcheck - sqlclosecheck - tparallel - unconvert - unparam - whitespace - wrapcheck exclusions: generated: lax presets: - common-false-positives paths: - third_party$ - builtin$ - examples$ issues: max-issues-per-linter: 0 max-same-issues: 0 formatters: enable: - gofumpt - goimports exclusions: generated: lax paths: - third_party$ - builtin$ - examples$ glamour-0.10.0/.goreleaser.yml000066400000000000000000000002371500000454500161620ustar00rootroot00000000000000includes: - from_url: url: charmbracelet/meta/main/goreleaser-lib.yaml # yaml-language-server: $schema=https://goreleaser.com/static/schema-pro.json glamour-0.10.0/CONTRIBUTING.md000066400000000000000000000011621500000454500154600ustar00rootroot00000000000000# Contributing Contributions are welcome! Please submit a pull request for minor changes and submit issues for major changes for discussions. ## Testing When providing a new feature or bug fix, please provide tests that demonstrate the issue along with your fix. ### Golden Files If golden files need to be updated, you can do so with `-update`. Usage: `go test ./pkg/... -update`. ## Themes New styles need to be implemented in `styles/.go`, and then `go generate ./...` will create the JSON files from it. You can look up all references of another theme (e.g. Dracula), and add your theme accordingly. glamour-0.10.0/LICENSE000066400000000000000000000020701500000454500142330ustar00rootroot00000000000000MIT License Copyright (c) 2019-2023 Charmbracelet, Inc Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. glamour-0.10.0/README.md000066400000000000000000000074651500000454500145220ustar00rootroot00000000000000# Glamour

Glamour Title Treatment
Latest Release GoDoc Build Status Coverage Status Go ReportCard

Stylesheet-based markdown rendering for your CLI apps. Glamour example `glamour` lets you render [markdown](https://en.wikipedia.org/wiki/Markdown) documents & templates on [ANSI](https://en.wikipedia.org/wiki/ANSI_escape_code) compatible terminals. You can create your own stylesheet or simply use one of the stylish defaults. ## Usage ```go import "github.com/charmbracelet/glamour" in := `# Hello World This is a simple example of Markdown rendering with Glamour! Check out the [other examples](https://github.com/charmbracelet/glamour/tree/master/examples) too. Bye! ` out, err := glamour.Render(in, "dark") fmt.Print(out) ``` Hello World example ### Custom Renderer ```go import "github.com/charmbracelet/glamour" r, _ := glamour.NewTermRenderer( // detect background color and pick either the default dark or light theme glamour.WithAutoStyle(), // wrap output at specific width (default is 80) glamour.WithWordWrap(40), ) out, err := r.Render(in) fmt.Print(out) ``` ## Styles You can find all available default styles in our [gallery](https://github.com/charmbracelet/glamour/tree/master/styles/gallery). Want to create your own style? [Learn how!](https://github.com/charmbracelet/glamour/tree/master/styles) There are a few options for using a custom style: 1. Call `glamour.Render(inputText, "desiredStyle")` 1. Set the `GLAMOUR_STYLE` environment variable to your desired default style or a file location for a style and call `glamour.RenderWithEnvironmentConfig(inputText)` 1. Set the `GLAMOUR_STYLE` environment variable and pass `glamour.WithEnvironmentConfig()` to your custom renderer ## Glamourous Projects Check out these projects, which use `glamour`: - [Glow](https://github.com/charmbracelet/glow), a markdown renderer for the command-line. - [GitHub CLI](https://github.com/cli/cli), GitHub’s official command line tool. - [GitLab CLI](https://gitlab.com/gitlab-org/cli), GitLab's official command line tool. - [Gitea CLI](https://gitea.com/gitea/tea), Gitea's official command line tool. - [Meteor](https://github.com/odpf/meteor), an easy-to-use, plugin-driven metadata collection framework. ## Feedback We’d love to hear your thoughts on this project. Feel free to drop us a note! - [Twitter](https://twitter.com/charmcli) - [The Fediverse](https://mastodon.social/@charmcli) - [Discord](https://charm.sh/chat) ## License [MIT](https://github.com/charmbracelet/glamour/raw/master/LICENSE) --- Part of [Charm](https://charm.sh). The Charm logo Charm热爱开源 • Charm loves open source glamour-0.10.0/Taskfile.yml000066400000000000000000000006041500000454500155140ustar00rootroot00000000000000# https://taskfile.dev version: '3' tasks: lint:all: desc: Run all linters cmds: - task: lint - task: lint:soft lint: desc: Run base linters cmds: - golangci-lint run lint:soft: desc: Run soft linters cmds: - golangci-lint run --config=.golangci-soft.yml test: desc: Run tests cmds: - go test ./... {{.CLI_ARGS}} glamour-0.10.0/ansi/000077500000000000000000000000001500000454500141615ustar00rootroot00000000000000glamour-0.10.0/ansi/ansi.go000066400000000000000000000001451500000454500154420ustar00rootroot00000000000000// Package ansi handle conversion of markdown to pretty ANSI output on the // terminal. package ansi glamour-0.10.0/ansi/baseelement.go000066400000000000000000000066151500000454500170040ustar00rootroot00000000000000package ansi import ( "bytes" "fmt" "io" "strings" "text/template" "github.com/muesli/termenv" "golang.org/x/text/cases" "golang.org/x/text/language" ) // BaseElement renders a styled primitive element. type BaseElement struct { Token string Prefix string Suffix string Style StylePrimitive } func formatToken(format string, token string) (string, error) { var b bytes.Buffer v := make(map[string]interface{}) v["text"] = token tmpl, err := template.New(format).Funcs(TemplateFuncMap).Parse(format) if err != nil { return "", fmt.Errorf("glamour: error parsing template: %w", err) } err = tmpl.Execute(&b, v) return b.String(), err } func renderText(w io.Writer, p termenv.Profile, rules StylePrimitive, s string) { if len(s) == 0 { return } out := termenv.String(s) if rules.Upper != nil && *rules.Upper { out = termenv.String(cases.Upper(language.English).String(s)) } if rules.Lower != nil && *rules.Lower { out = termenv.String(cases.Lower(language.English).String(s)) } if rules.Title != nil && *rules.Title { out = termenv.String(cases.Title(language.English).String(s)) } if rules.Color != nil { out = out.Foreground(p.Color(*rules.Color)) } if rules.BackgroundColor != nil { out = out.Background(p.Color(*rules.BackgroundColor)) } if rules.Underline != nil && *rules.Underline { out = out.Underline() } if rules.Bold != nil && *rules.Bold { out = out.Bold() } if rules.Italic != nil && *rules.Italic { out = out.Italic() } if rules.CrossedOut != nil && *rules.CrossedOut { out = out.CrossOut() } if rules.Overlined != nil && *rules.Overlined { out = out.Overline() } if rules.Inverse != nil && *rules.Inverse { out = out.Reverse() } if rules.Blink != nil && *rules.Blink { out = out.Blink() } _, _ = io.WriteString(w, out.String()) } // StyleOverrideRender renders a BaseElement with an overridden style. func (e *BaseElement) StyleOverrideRender(w io.Writer, ctx RenderContext, style StylePrimitive) error { bs := ctx.blockStack st1 := cascadeStylePrimitives(bs.Current().Style.StylePrimitive, style) st2 := cascadeStylePrimitives(bs.With(e.Style), style) return e.doRender(w, ctx.options.ColorProfile, st1, st2) } // Render renders a BaseElement. func (e *BaseElement) Render(w io.Writer, ctx RenderContext) error { bs := ctx.blockStack st1 := bs.Current().Style.StylePrimitive st2 := bs.With(e.Style) return e.doRender(w, ctx.options.ColorProfile, st1, st2) } func (e *BaseElement) doRender(w io.Writer, p termenv.Profile, st1, st2 StylePrimitive) error { renderText(w, p, st1, e.Prefix) defer func() { renderText(w, p, st1, e.Suffix) }() // render unstyled prefix/suffix renderText(w, p, st1, st2.BlockPrefix) defer func() { renderText(w, p, st1, st2.BlockSuffix) }() // render styled prefix/suffix renderText(w, p, st2, st2.Prefix) defer func() { renderText(w, p, st2, st2.Suffix) }() s := e.Token if len(st2.Format) > 0 { var err error s, err = formatToken(st2.Format, s) if err != nil { return err } } renderText(w, p, st2, escapeReplacer.Replace(s)) return nil } // https://www.markdownguide.org/basic-syntax/#characters-you-can-escape var escapeReplacer = strings.NewReplacer( "\\\\", "\\", "\\`", "`", "\\*", "*", "\\_", "_", "\\{", "{", "\\}", "}", "\\[", "[", "\\]", "]", "\\<", "<", "\\>", ">", "\\(", "(", "\\)", ")", "\\#", "#", "\\+", "+", "\\-", "-", "\\.", ".", "\\!", "!", "\\|", "|", ) glamour-0.10.0/ansi/blockelement.go000066400000000000000000000033701500000454500171570ustar00rootroot00000000000000package ansi import ( "bytes" "fmt" "io" "github.com/charmbracelet/x/ansi" ) // BlockElement provides a render buffer for children of a block element. // After all children have been rendered into it, it applies indentation and // margins around them and writes everything to the parent rendering buffer. type BlockElement struct { Block *bytes.Buffer Style StyleBlock Margin bool Newline bool } // Render renders a BlockElement. func (e *BlockElement) Render(w io.Writer, ctx RenderContext) error { bs := ctx.blockStack bs.Push(*e) renderText(w, ctx.options.ColorProfile, bs.Parent().Style.StylePrimitive, e.Style.BlockPrefix) renderText(bs.Current().Block, ctx.options.ColorProfile, bs.Current().Style.StylePrimitive, e.Style.Prefix) return nil } // Finish finishes rendering a BlockElement. func (e *BlockElement) Finish(w io.Writer, ctx RenderContext) error { bs := ctx.blockStack if e.Margin { //nolint: nestif s := ansi.Wordwrap( bs.Current().Block.String(), int(bs.Width(ctx)), //nolint: gosec " ,.;-+|", ) mw := NewMarginWriter(ctx, w, bs.Current().Style) if _, err := io.WriteString(mw, s); err != nil { return fmt.Errorf("glamour: error writing to writer: %w", err) } if e.Newline { if _, err := io.WriteString(mw, "\n"); err != nil { return fmt.Errorf("glamour: error writing to writer: %w", err) } } } else { _, err := bs.Parent().Block.Write(bs.Current().Block.Bytes()) if err != nil { return fmt.Errorf("glamour: error writing to writer: %w", err) } } renderText(w, ctx.options.ColorProfile, bs.Current().Style.StylePrimitive, e.Style.Suffix) renderText(w, ctx.options.ColorProfile, bs.Parent().Style.StylePrimitive, e.Style.BlockSuffix) bs.Current().Block.Reset() bs.Pop() return nil } glamour-0.10.0/ansi/blockstack.go000066400000000000000000000036331500000454500166350ustar00rootroot00000000000000package ansi import ( "bytes" ) // BlockStack is a stack of block elements, used to calculate the current // indentation & margin level during the rendering process. type BlockStack []BlockElement // Len returns the length of the stack. func (s *BlockStack) Len() int { return len(*s) } // Push appends an item to the stack. func (s *BlockStack) Push(e BlockElement) { *s = append(*s, e) } // Pop removes the last item on the stack. func (s *BlockStack) Pop() { stack := *s if len(stack) == 0 { return } stack = stack[0 : len(stack)-1] *s = stack } // Indent returns the current indentation level of all elements in the stack. func (s BlockStack) Indent() uint { var i uint for _, v := range s { if v.Style.Indent == nil { continue } i += *v.Style.Indent } return i } // Margin returns the current margin level of all elements in the stack. func (s BlockStack) Margin() uint { var i uint for _, v := range s { if v.Style.Margin == nil { continue } i += *v.Style.Margin } return i } // Width returns the available rendering width. func (s BlockStack) Width(ctx RenderContext) uint { if s.Indent()+s.Margin()*2 > uint(ctx.options.WordWrap) { //nolint: gosec return 0 } return uint(ctx.options.WordWrap) - s.Indent() - s.Margin()*2 //nolint: gosec } // Parent returns the current BlockElement's parent. func (s BlockStack) Parent() BlockElement { if len(s) == 1 { return BlockElement{ Block: &bytes.Buffer{}, } } return s[len(s)-2] } // Current returns the current BlockElement. func (s BlockStack) Current() BlockElement { if len(s) == 0 { return BlockElement{ Block: &bytes.Buffer{}, } } return s[len(s)-1] } // With returns a StylePrimitive that inherits the current BlockElement's style. func (s BlockStack) With(child StylePrimitive) StylePrimitive { sb := StyleBlock{} sb.StylePrimitive = child return cascadeStyle(s.Current().Style, sb, false).StylePrimitive } glamour-0.10.0/ansi/codeblock.go000066400000000000000000000114171500000454500164410ustar00rootroot00000000000000package ansi import ( "fmt" "io" "sync" "github.com/alecthomas/chroma/v2" "github.com/alecthomas/chroma/v2/quick" "github.com/alecthomas/chroma/v2/styles" "github.com/muesli/reflow/indent" "github.com/muesli/termenv" ) const ( // The chroma style theme name used for rendering. chromaStyleTheme = "charm" // The chroma formatter name used for rendering. chromaFormatter = "terminal256" ) // mutex for synchronizing access to the chroma style registry. // Related https://github.com/alecthomas/chroma/pull/650 var mutex = sync.Mutex{} // A CodeBlockElement is used to render code blocks. type CodeBlockElement struct { Code string Language string } func chromaStyle(style StylePrimitive) string { var s string if style.Color != nil { s = *style.Color } if style.BackgroundColor != nil { if s != "" { s += " " } s += "bg:" + *style.BackgroundColor } if style.Italic != nil && *style.Italic { if s != "" { s += " " } s += "italic" } if style.Bold != nil && *style.Bold { if s != "" { s += " " } s += "bold" } if style.Underline != nil && *style.Underline { if s != "" { s += " " } s += "underline" } return s } // Render renders a CodeBlockElement. func (e *CodeBlockElement) Render(w io.Writer, ctx RenderContext) error { bs := ctx.blockStack var indentation uint var margin uint formatter := chromaFormatter rules := ctx.options.Styles.CodeBlock if rules.Indent != nil { indentation = *rules.Indent } if rules.Margin != nil { margin = *rules.Margin } if len(ctx.options.ChromaFormatter) > 0 { formatter = ctx.options.ChromaFormatter } theme := rules.Theme if rules.Chroma != nil && ctx.options.ColorProfile != termenv.Ascii { theme = chromaStyleTheme mutex.Lock() // Don't register the style if it's already registered. _, ok := styles.Registry[theme] if !ok { styles.Register(chroma.MustNewStyle(theme, chroma.StyleEntries{ chroma.Text: chromaStyle(rules.Chroma.Text), chroma.Error: chromaStyle(rules.Chroma.Error), chroma.Comment: chromaStyle(rules.Chroma.Comment), chroma.CommentPreproc: chromaStyle(rules.Chroma.CommentPreproc), chroma.Keyword: chromaStyle(rules.Chroma.Keyword), chroma.KeywordReserved: chromaStyle(rules.Chroma.KeywordReserved), chroma.KeywordNamespace: chromaStyle(rules.Chroma.KeywordNamespace), chroma.KeywordType: chromaStyle(rules.Chroma.KeywordType), chroma.Operator: chromaStyle(rules.Chroma.Operator), chroma.Punctuation: chromaStyle(rules.Chroma.Punctuation), chroma.Name: chromaStyle(rules.Chroma.Name), chroma.NameBuiltin: chromaStyle(rules.Chroma.NameBuiltin), chroma.NameTag: chromaStyle(rules.Chroma.NameTag), chroma.NameAttribute: chromaStyle(rules.Chroma.NameAttribute), chroma.NameClass: chromaStyle(rules.Chroma.NameClass), chroma.NameConstant: chromaStyle(rules.Chroma.NameConstant), chroma.NameDecorator: chromaStyle(rules.Chroma.NameDecorator), chroma.NameException: chromaStyle(rules.Chroma.NameException), chroma.NameFunction: chromaStyle(rules.Chroma.NameFunction), chroma.NameOther: chromaStyle(rules.Chroma.NameOther), chroma.Literal: chromaStyle(rules.Chroma.Literal), chroma.LiteralNumber: chromaStyle(rules.Chroma.LiteralNumber), chroma.LiteralDate: chromaStyle(rules.Chroma.LiteralDate), chroma.LiteralString: chromaStyle(rules.Chroma.LiteralString), chroma.LiteralStringEscape: chromaStyle(rules.Chroma.LiteralStringEscape), chroma.GenericDeleted: chromaStyle(rules.Chroma.GenericDeleted), chroma.GenericEmph: chromaStyle(rules.Chroma.GenericEmph), chroma.GenericInserted: chromaStyle(rules.Chroma.GenericInserted), chroma.GenericStrong: chromaStyle(rules.Chroma.GenericStrong), chroma.GenericSubheading: chromaStyle(rules.Chroma.GenericSubheading), chroma.Background: chromaStyle(rules.Chroma.Background), })) } mutex.Unlock() } iw := indent.NewWriterPipe(w, indentation+margin, func(_ io.Writer) { renderText(w, ctx.options.ColorProfile, bs.Current().Style.StylePrimitive, " ") }) if len(theme) > 0 { renderText(iw, ctx.options.ColorProfile, bs.Current().Style.StylePrimitive, rules.BlockPrefix) err := quick.Highlight(iw, e.Code, e.Language, formatter, theme) if err != nil { return fmt.Errorf("glamour: error highlighting code: %w", err) } renderText(iw, ctx.options.ColorProfile, bs.Current().Style.StylePrimitive, rules.BlockSuffix) return nil } // fallback rendering el := &BaseElement{ Token: e.Code, Style: rules.StylePrimitive, } return el.Render(iw, ctx) } glamour-0.10.0/ansi/codespan.go000066400000000000000000000005451500000454500163100ustar00rootroot00000000000000package ansi import "io" // A CodeSpanElement is used to render codespan. type CodeSpanElement struct { Text string Style StylePrimitive } // Render renders a CodeSpanElement. func (e *CodeSpanElement) Render(w io.Writer, ctx RenderContext) error { renderText(w, ctx.options.ColorProfile, e.Style, e.Style.Prefix+e.Text+e.Style.Suffix) return nil } glamour-0.10.0/ansi/context.go000066400000000000000000000013671500000454500162030ustar00rootroot00000000000000package ansi import ( "html" "strings" "github.com/microcosm-cc/bluemonday" ) // RenderContext holds the current rendering options and state. type RenderContext struct { options Options blockStack *BlockStack table *TableElement stripper *bluemonday.Policy } // NewRenderContext returns a new RenderContext. func NewRenderContext(options Options) RenderContext { return RenderContext{ options: options, blockStack: &BlockStack{}, table: &TableElement{}, stripper: bluemonday.StrictPolicy(), } } // SanitizeHTML sanitizes HTML content. func (ctx RenderContext) SanitizeHTML(s string, trimSpaces bool) string { s = ctx.stripper.Sanitize(s) if trimSpaces { s = strings.TrimSpace(s) } return html.UnescapeString(s) } glamour-0.10.0/ansi/elements.go000066400000000000000000000245671500000454500163420ustar00rootroot00000000000000package ansi import ( "bytes" "fmt" "html" "io" "strings" "github.com/charmbracelet/glamour/internal/autolink" east "github.com/yuin/goldmark-emoji/ast" "github.com/yuin/goldmark/ast" astext "github.com/yuin/goldmark/extension/ast" ) // ElementRenderer is called when entering a markdown node. type ElementRenderer interface { Render(w io.Writer, ctx RenderContext) error } // StyleOverriderElementRenderer is called when entering a markdown node with a specific style. type StyleOverriderElementRenderer interface { StyleOverrideRender(w io.Writer, ctx RenderContext, style StylePrimitive) error } // ElementFinisher is called when leaving a markdown node. type ElementFinisher interface { Finish(w io.Writer, ctx RenderContext) error } // An Element is used to instruct the renderer how to handle individual markdown // nodes. type Element struct { Entering string Exiting string Renderer ElementRenderer Finisher ElementFinisher } // NewElement returns the appropriate render Element for a given node. func (tr *ANSIRenderer) NewElement(node ast.Node, source []byte) Element { ctx := tr.context switch node.Kind() { // Document case ast.KindDocument: e := &BlockElement{ Block: &bytes.Buffer{}, Style: ctx.options.Styles.Document, Margin: true, } return Element{ Renderer: e, Finisher: e, } // Heading case ast.KindHeading: n := node.(*ast.Heading) he := &HeadingElement{ Level: n.Level, First: node.PreviousSibling() == nil, } return Element{ Exiting: "", Renderer: he, Finisher: he, } // Paragraph case ast.KindParagraph: if node.Parent() != nil { kind := node.Parent().Kind() if kind == ast.KindListItem { return Element{} } } return Element{ Renderer: &ParagraphElement{ First: node.PreviousSibling() == nil, }, Finisher: &ParagraphElement{}, } // Blockquote case ast.KindBlockquote: e := &BlockElement{ Block: &bytes.Buffer{}, Style: cascadeStyle(ctx.blockStack.Current().Style, ctx.options.Styles.BlockQuote, false), Margin: true, } return Element{ Entering: "\n", Renderer: e, Finisher: e, } // Lists case ast.KindList: s := ctx.options.Styles.List.StyleBlock if s.Indent == nil { var i uint s.Indent = &i } n := node.Parent() for n != nil { if n.Kind() == ast.KindList { i := ctx.options.Styles.List.LevelIndent s.Indent = &i break } n = n.Parent() } e := &BlockElement{ Block: &bytes.Buffer{}, Style: cascadeStyle(ctx.blockStack.Current().Style, s, false), Margin: true, Newline: true, } return Element{ Entering: "\n", Renderer: e, Finisher: e, } case ast.KindListItem: var l uint var e uint l = 1 n := node for n.PreviousSibling() != nil && (n.PreviousSibling().Kind() == ast.KindListItem) { l++ n = n.PreviousSibling() } if node.Parent().(*ast.List).IsOrdered() { e = l if node.Parent().(*ast.List).Start != 1 { e += uint(node.Parent().(*ast.List).Start) - 1 //nolint: gosec } } post := "\n" if (node.LastChild() != nil && node.LastChild().Kind() == ast.KindList) || node.NextSibling() == nil { post = "" } if node.FirstChild() != nil && node.FirstChild().FirstChild() != nil && node.FirstChild().FirstChild().Kind() == astext.KindTaskCheckBox { nc := node.FirstChild().FirstChild().(*astext.TaskCheckBox) return Element{ Exiting: post, Renderer: &TaskElement{ Checked: nc.IsChecked, }, } } return Element{ Exiting: post, Renderer: &ItemElement{ IsOrdered: node.Parent().(*ast.List).IsOrdered(), Enumeration: e, }, } // Text Elements case ast.KindText: n := node.(*ast.Text) s := string(n.Segment.Value(source)) if n.HardLineBreak() || (n.SoftLineBreak()) { s += "\n" } return Element{ Renderer: &BaseElement{ Token: html.UnescapeString(s), Style: ctx.options.Styles.Text, }, } case ast.KindEmphasis: n := node.(*ast.Emphasis) var children []ElementRenderer nn := n.FirstChild() for nn != nil { children = append(children, tr.NewElement(nn, source).Renderer) nn = nn.NextSibling() } return Element{ Renderer: &EmphasisElement{ Level: n.Level, Children: children, }, } case astext.KindStrikethrough: n := node.(*astext.Strikethrough) s := string(n.Text(source)) //nolint: staticcheck style := ctx.options.Styles.Strikethrough return Element{ Renderer: &BaseElement{ Token: html.UnescapeString(s), Style: style, }, } case ast.KindThematicBreak: return Element{ Entering: "", Exiting: "", Renderer: &BaseElement{ Style: ctx.options.Styles.HorizontalRule, }, } // Links case ast.KindLink: n := node.(*ast.Link) isFooterLinks := !ctx.options.InlineTableLinks && isInsideTable(node) var children []ElementRenderer content, err := nodeContent(node, source) if isFooterLinks && err == nil { text := string(content) tl := tableLink{ content: text, href: string(n.Destination), title: string(n.Title), linkType: linkTypeRegular, } text = linkWithSuffix(tl, ctx.table.tableLinks) children = []ElementRenderer{&BaseElement{Token: text}} } else { nn := n.FirstChild() for nn != nil { children = append(children, tr.NewElement(nn, source).Renderer) nn = nn.NextSibling() } } return Element{ Renderer: &LinkElement{ BaseURL: ctx.options.BaseURL, URL: string(n.Destination), Children: children, SkipHref: isFooterLinks, }, } case ast.KindAutoLink: n := node.(*ast.AutoLink) u := string(n.URL(source)) isFooterLinks := !ctx.options.InlineTableLinks && isInsideTable(node) var children []ElementRenderer nn := n.FirstChild() for nn != nil { children = append(children, tr.NewElement(nn, source).Renderer) nn = nn.NextSibling() } if len(children) == 0 { children = append(children, &BaseElement{Token: u}) } if n.AutoLinkType == ast.AutoLinkEmail && !strings.HasPrefix(strings.ToLower(u), "mailto:") { u = "mailto:" + u } var renderer ElementRenderer if isFooterLinks { domain := linkDomain(u) tl := tableLink{ content: domain, href: u, linkType: linkTypeAuto, } if shortned, ok := autolink.Detect(u); ok { tl.content = shortned } text := linkWithSuffix(tl, ctx.table.tableLinks) renderer = &LinkElement{ Children: []ElementRenderer{&BaseElement{Token: text}}, URL: u, SkipHref: true, } } else { renderer = &LinkElement{ Children: children, URL: u, SkipText: n.AutoLinkType != ast.AutoLinkEmail, } } return Element{Renderer: renderer} // Images case ast.KindImage: n := node.(*ast.Image) text := string(n.Text(source)) //nolint: staticcheck isFooterLinks := !ctx.options.InlineTableLinks && isInsideTable(node) if isFooterLinks { if text == "" { text = linkDomain(string(n.Destination)) } tl := tableLink{ title: string(n.Title), content: text, href: string(n.Destination), linkType: linkTypeImage, } text = linkWithSuffix(tl, ctx.table.tableImages) } return Element{ Renderer: &ImageElement{ Text: text, BaseURL: ctx.options.BaseURL, URL: string(n.Destination), TextOnly: isFooterLinks, }, } // Code case ast.KindFencedCodeBlock: n := node.(*ast.FencedCodeBlock) l := n.Lines().Len() s := "" for i := 0; i < l; i++ { line := n.Lines().At(i) s += string(line.Value(source)) } return Element{ Entering: "\n", Renderer: &CodeBlockElement{ Code: s, Language: string(n.Language(source)), }, } case ast.KindCodeBlock: n := node.(*ast.CodeBlock) l := n.Lines().Len() s := "" for i := 0; i < l; i++ { line := n.Lines().At(i) s += string(line.Value(source)) } return Element{ Entering: "\n", Renderer: &CodeBlockElement{ Code: s, }, } case ast.KindCodeSpan: n := node.(*ast.CodeSpan) s := string(n.Text(source)) //nolint: staticcheck return Element{ Renderer: &CodeSpanElement{ Text: html.UnescapeString(s), Style: cascadeStyle(ctx.blockStack.Current().Style, ctx.options.Styles.Code, false).StylePrimitive, }, } // Tables case astext.KindTable: table := node.(*astext.Table) te := &TableElement{ table: table, source: source, } return Element{ Entering: "\n", Exiting: "\n", Renderer: te, Finisher: te, } case astext.KindTableCell: n := node.(*astext.TableCell) var children []ElementRenderer nn := n.FirstChild() for nn != nil { children = append(children, tr.NewElement(nn, source).Renderer) nn = nn.NextSibling() } r := &TableCellElement{ Children: children, Head: node.Parent().Kind() == astext.KindTableHeader, } return Element{ Renderer: r, } case astext.KindTableHeader: return Element{ Finisher: &TableHeadElement{}, } case astext.KindTableRow: return Element{ Finisher: &TableRowElement{}, } // HTML Elements case ast.KindHTMLBlock: n := node.(*ast.HTMLBlock) return Element{ Renderer: &BaseElement{ Token: ctx.SanitizeHTML(string(n.Text(source)), true), //nolint: staticcheck Style: ctx.options.Styles.HTMLBlock.StylePrimitive, }, } case ast.KindRawHTML: n := node.(*ast.RawHTML) return Element{ Renderer: &BaseElement{ Token: ctx.SanitizeHTML(string(n.Text(source)), true), //nolint: staticcheck Style: ctx.options.Styles.HTMLSpan.StylePrimitive, }, } // Definition Lists case astext.KindDefinitionList: e := &BlockElement{ Block: &bytes.Buffer{}, Style: cascadeStyle(ctx.blockStack.Current().Style, ctx.options.Styles.DefinitionList, false), Margin: true, Newline: true, } return Element{ Renderer: e, Finisher: e, } case astext.KindDefinitionTerm: return Element{ Entering: "\n", Renderer: &BaseElement{ Style: ctx.options.Styles.DefinitionTerm, }, } case astext.KindDefinitionDescription: return Element{ Exiting: "\n", Renderer: &BaseElement{ Style: ctx.options.Styles.DefinitionDescription, }, } // Handled by parents case astext.KindTaskCheckBox: // handled by KindListItem return Element{} case ast.KindTextBlock: return Element{} case east.KindEmoji: n := node.(*east.Emoji) return Element{ Renderer: &BaseElement{ Token: string(n.Value.Unicode), }, } // Unknown case default: fmt.Println("Warning: unhandled element", node.Kind().String()) return Element{} } } glamour-0.10.0/ansi/emphasis.go000066400000000000000000000022721500000454500163240ustar00rootroot00000000000000package ansi import ( "fmt" "io" ) // A EmphasisElement is used to render emphasis. type EmphasisElement struct { Children []ElementRenderer Level int } // Render renders a EmphasisElement. func (e *EmphasisElement) Render(w io.Writer, ctx RenderContext) error { style := ctx.options.Styles.Emph if e.Level > 1 { style = ctx.options.Styles.Strong } return e.doRender(w, ctx, style) } // StyleOverrideRender renders a EmphasisElement with a given style. func (e *EmphasisElement) StyleOverrideRender(w io.Writer, ctx RenderContext, style StylePrimitive) error { base := ctx.options.Styles.Emph if e.Level > 1 { base = ctx.options.Styles.Strong } return e.doRender(w, ctx, cascadeStylePrimitives(base, style)) } func (e *EmphasisElement) doRender(w io.Writer, ctx RenderContext, style StylePrimitive) error { for _, child := range e.Children { if r, ok := child.(StyleOverriderElementRenderer); ok { if err := r.StyleOverrideRender(w, ctx, style); err != nil { return fmt.Errorf("glamour: error rendering with style: %w", err) } } else { if err := child.Render(w, ctx); err != nil { return fmt.Errorf("glamour: error rendering: %w", err) } } } return nil } glamour-0.10.0/ansi/heading.go000066400000000000000000000040121500000454500161040ustar00rootroot00000000000000package ansi import ( "bytes" "fmt" "io" "github.com/muesli/reflow/wordwrap" ) // A HeadingElement is used to render headings. type HeadingElement struct { Level int First bool } const ( h1 = iota + 1 h2 h3 h4 h5 h6 ) // Render renders a HeadingElement. func (e *HeadingElement) Render(w io.Writer, ctx RenderContext) error { bs := ctx.blockStack rules := ctx.options.Styles.Heading switch e.Level { case h1: rules = cascadeStyles(rules, ctx.options.Styles.H1) case h2: rules = cascadeStyles(rules, ctx.options.Styles.H2) case h3: rules = cascadeStyles(rules, ctx.options.Styles.H3) case h4: rules = cascadeStyles(rules, ctx.options.Styles.H4) case h5: rules = cascadeStyles(rules, ctx.options.Styles.H5) case h6: rules = cascadeStyles(rules, ctx.options.Styles.H6) } if !e.First { renderText(w, ctx.options.ColorProfile, bs.Current().Style.StylePrimitive, "\n") } be := BlockElement{ Block: &bytes.Buffer{}, Style: cascadeStyle(bs.Current().Style, rules, false), } bs.Push(be) renderText(w, ctx.options.ColorProfile, bs.Parent().Style.StylePrimitive, rules.BlockPrefix) renderText(bs.Current().Block, ctx.options.ColorProfile, bs.Current().Style.StylePrimitive, rules.Prefix) return nil } // Finish finishes rendering a HeadingElement. func (e *HeadingElement) Finish(w io.Writer, ctx RenderContext) error { bs := ctx.blockStack rules := bs.Current().Style mw := NewMarginWriter(ctx, w, rules) flow := wordwrap.NewWriter(int(bs.Width(ctx))) //nolint: gosec _, err := flow.Write(bs.Current().Block.Bytes()) if err != nil { return fmt.Errorf("glamour: error writing bytes: %w", err) } if err := flow.Close(); err != nil { return fmt.Errorf("glamour: error closing flow: %w", err) } _, err = mw.Write(flow.Bytes()) if err != nil { return err } renderText(w, ctx.options.ColorProfile, bs.Current().Style.StylePrimitive, rules.Suffix) renderText(w, ctx.options.ColorProfile, bs.Parent().Style.StylePrimitive, rules.BlockSuffix) bs.Current().Block.Reset() bs.Pop() return nil } glamour-0.10.0/ansi/image.go000066400000000000000000000015301500000454500155710ustar00rootroot00000000000000package ansi import ( "io" "strings" ) // An ImageElement is used to render images elements. type ImageElement struct { Text string BaseURL string URL string Child ElementRenderer TextOnly bool } // Render renders an ImageElement. func (e *ImageElement) Render(w io.Writer, ctx RenderContext) error { style := ctx.options.Styles.ImageText if e.TextOnly { style.Format = strings.TrimSuffix(style.Format, " →") } if len(e.Text) > 0 { el := &BaseElement{ Token: e.Text, Style: style, } err := el.Render(w, ctx) if err != nil { return err } } if e.TextOnly { return nil } if len(e.URL) > 0 { el := &BaseElement{ Token: resolveRelativeURL(e.BaseURL, e.URL), Prefix: " ", Style: ctx.options.Styles.Image, } err := el.Render(w, ctx) if err != nil { return err } } return nil } glamour-0.10.0/ansi/link.go000066400000000000000000000032411500000454500154450ustar00rootroot00000000000000package ansi import ( "bytes" "fmt" "io" "net/url" ) // A LinkElement is used to render hyperlinks. type LinkElement struct { BaseURL string URL string Children []ElementRenderer SkipText bool SkipHref bool } // Render renders a LinkElement. func (e *LinkElement) Render(w io.Writer, ctx RenderContext) error { if !e.SkipText { if err := e.renderTextPart(w, ctx); err != nil { return err } } if !e.SkipHref { if err := e.renderHrefPart(w, ctx); err != nil { return err } } return nil } func (e *LinkElement) renderTextPart(w io.Writer, ctx RenderContext) error { for _, child := range e.Children { if r, ok := child.(StyleOverriderElementRenderer); ok { st := ctx.options.Styles.LinkText if err := r.StyleOverrideRender(w, ctx, st); err != nil { return fmt.Errorf("glamour: error rendering with style: %w", err) } } else { var b bytes.Buffer if err := child.Render(&b, ctx); err != nil { return fmt.Errorf("glamour: error rendering: %w", err) } el := &BaseElement{ Token: b.String(), Style: ctx.options.Styles.LinkText, } if err := el.Render(w, ctx); err != nil { return fmt.Errorf("glamour: error rendering: %w", err) } } } return nil } func (e *LinkElement) renderHrefPart(w io.Writer, ctx RenderContext) error { prefix := "" if !e.SkipText { prefix = " " } u, err := url.Parse(e.URL) if err == nil && "#"+u.Fragment != e.URL { // if the URL only consists of an anchor, ignore it el := &BaseElement{ Token: resolveRelativeURL(e.BaseURL, e.URL), Prefix: prefix, Style: ctx.options.Styles.Link, } if err := el.Render(w, ctx); err != nil { return err } } return nil } glamour-0.10.0/ansi/listitem.go000066400000000000000000000010451500000454500163420ustar00rootroot00000000000000package ansi import ( "io" "strconv" ) // An ItemElement is used to render items inside a list. type ItemElement struct { IsOrdered bool Enumeration uint } // Render renders an ItemElement. func (e *ItemElement) Render(w io.Writer, ctx RenderContext) error { var el *BaseElement if e.IsOrdered { el = &BaseElement{ Style: ctx.options.Styles.Enumeration, Prefix: strconv.FormatInt(int64(e.Enumeration), 10), //nolint: gosec } } else { el = &BaseElement{ Style: ctx.options.Styles.Item, } } return el.Render(w, ctx) } glamour-0.10.0/ansi/margin.go000066400000000000000000000022741500000454500157720ustar00rootroot00000000000000package ansi import ( "fmt" "io" "github.com/muesli/reflow/indent" "github.com/muesli/reflow/padding" ) // MarginWriter is a Writer that applies indentation and padding around // whatever you write to it. type MarginWriter struct { w io.Writer pw *padding.Writer iw *indent.Writer } // NewMarginWriter returns a new MarginWriter. func NewMarginWriter(ctx RenderContext, w io.Writer, rules StyleBlock) *MarginWriter { bs := ctx.blockStack var indentation uint var margin uint if rules.Indent != nil { indentation = *rules.Indent } if rules.Margin != nil { margin = *rules.Margin } pw := padding.NewWriterPipe(w, bs.Width(ctx), func(_ io.Writer) { renderText(w, ctx.options.ColorProfile, rules.StylePrimitive, " ") }) ic := " " if rules.IndentToken != nil { ic = *rules.IndentToken } iw := indent.NewWriterPipe(pw, indentation+margin, func(_ io.Writer) { renderText(w, ctx.options.ColorProfile, bs.Parent().Style.StylePrimitive, ic) }) return &MarginWriter{ w: w, pw: pw, iw: iw, } } func (w *MarginWriter) Write(b []byte) (int, error) { n, err := w.iw.Write(b) if err != nil { return 0, fmt.Errorf("glamour: error writing bytes: %w", err) } return n, nil } glamour-0.10.0/ansi/paragraph.go000066400000000000000000000031721500000454500164600ustar00rootroot00000000000000package ansi import ( "bytes" "fmt" "io" "strings" "github.com/muesli/reflow/wordwrap" ) // A ParagraphElement is used to render individual paragraphs. type ParagraphElement struct { First bool } // Render renders a ParagraphElement. func (e *ParagraphElement) Render(w io.Writer, ctx RenderContext) error { bs := ctx.blockStack rules := ctx.options.Styles.Paragraph if !e.First { _, _ = io.WriteString(w, "\n") } be := BlockElement{ Block: &bytes.Buffer{}, Style: cascadeStyle(bs.Current().Style, rules, false), } bs.Push(be) renderText(w, ctx.options.ColorProfile, bs.Parent().Style.StylePrimitive, rules.BlockPrefix) renderText(bs.Current().Block, ctx.options.ColorProfile, bs.Current().Style.StylePrimitive, rules.Prefix) return nil } // Finish finishes rendering a ParagraphElement. func (e *ParagraphElement) Finish(w io.Writer, ctx RenderContext) error { bs := ctx.blockStack rules := bs.Current().Style mw := NewMarginWriter(ctx, w, rules) if len(strings.TrimSpace(bs.Current().Block.String())) > 0 { flow := wordwrap.NewWriter(int(bs.Width(ctx))) //nolint: gosec flow.KeepNewlines = ctx.options.PreserveNewLines _, _ = flow.Write(bs.Current().Block.Bytes()) if err := flow.Close(); err != nil { return fmt.Errorf("glamour: error closing flow: %w", err) } _, err := mw.Write(flow.Bytes()) if err != nil { return err } _, _ = io.WriteString(mw, "\n") } renderText(w, ctx.options.ColorProfile, bs.Current().Style.StylePrimitive, rules.Suffix) renderText(w, ctx.options.ColorProfile, bs.Parent().Style.StylePrimitive, rules.BlockSuffix) bs.Current().Block.Reset() bs.Pop() return nil } glamour-0.10.0/ansi/renderer.go000066400000000000000000000110721500000454500163170ustar00rootroot00000000000000package ansi import ( "fmt" "io" "net/url" "strings" "github.com/muesli/termenv" east "github.com/yuin/goldmark-emoji/ast" "github.com/yuin/goldmark/ast" astext "github.com/yuin/goldmark/extension/ast" "github.com/yuin/goldmark/renderer" "github.com/yuin/goldmark/util" ) // Options is used to configure an ANSIRenderer. type Options struct { BaseURL string WordWrap int TableWrap *bool InlineTableLinks bool PreserveNewLines bool ColorProfile termenv.Profile Styles StyleConfig ChromaFormatter string } // ANSIRenderer renders markdown content as ANSI escaped sequences. type ANSIRenderer struct { //nolint: revive context RenderContext } // NewRenderer returns a new ANSIRenderer with style and options set. func NewRenderer(options Options) *ANSIRenderer { return &ANSIRenderer{ context: NewRenderContext(options), } } // RegisterFuncs implements NodeRenderer.RegisterFuncs. func (r *ANSIRenderer) RegisterFuncs(reg renderer.NodeRendererFuncRegisterer) { // blocks reg.Register(ast.KindDocument, r.renderNode) reg.Register(ast.KindHeading, r.renderNode) reg.Register(ast.KindBlockquote, r.renderNode) reg.Register(ast.KindCodeBlock, r.renderNode) reg.Register(ast.KindFencedCodeBlock, r.renderNode) reg.Register(ast.KindHTMLBlock, r.renderNode) reg.Register(ast.KindList, r.renderNode) reg.Register(ast.KindListItem, r.renderNode) reg.Register(ast.KindParagraph, r.renderNode) reg.Register(ast.KindTextBlock, r.renderNode) reg.Register(ast.KindThematicBreak, r.renderNode) // inlines reg.Register(ast.KindAutoLink, r.renderNode) reg.Register(ast.KindCodeSpan, r.renderNode) reg.Register(ast.KindEmphasis, r.renderNode) reg.Register(ast.KindImage, r.renderNode) reg.Register(ast.KindLink, r.renderNode) reg.Register(ast.KindRawHTML, r.renderNode) reg.Register(ast.KindText, r.renderNode) reg.Register(ast.KindString, r.renderNode) // tables reg.Register(astext.KindTable, r.renderNode) reg.Register(astext.KindTableHeader, r.renderNode) reg.Register(astext.KindTableRow, r.renderNode) reg.Register(astext.KindTableCell, r.renderNode) // definitions reg.Register(astext.KindDefinitionList, r.renderNode) reg.Register(astext.KindDefinitionTerm, r.renderNode) reg.Register(astext.KindDefinitionDescription, r.renderNode) // footnotes reg.Register(astext.KindFootnote, r.renderNode) reg.Register(astext.KindFootnoteList, r.renderNode) reg.Register(astext.KindFootnoteLink, r.renderNode) reg.Register(astext.KindFootnoteBacklink, r.renderNode) // checkboxes reg.Register(astext.KindTaskCheckBox, r.renderNode) // strikethrough reg.Register(astext.KindStrikethrough, r.renderNode) // emoji reg.Register(east.KindEmoji, r.renderNode) } func (r *ANSIRenderer) renderNode(w util.BufWriter, source []byte, node ast.Node, entering bool) (ast.WalkStatus, error) { writeTo := io.Writer(w) bs := r.context.blockStack // children get rendered by their parent if isChild(node) { return ast.WalkContinue, nil } e := r.NewElement(node, source) if entering { //nolint: nestif // everything below the Document element gets rendered into a block buffer if bs.Len() > 0 { writeTo = io.Writer(bs.Current().Block) } _, _ = io.WriteString(writeTo, e.Entering) if e.Renderer != nil { err := e.Renderer.Render(writeTo, r.context) if err != nil { return ast.WalkStop, fmt.Errorf("glamour: error rendering: %w", err) } } } else { // everything below the Document element gets rendered into a block buffer if bs.Len() > 0 { writeTo = io.Writer(bs.Parent().Block) } // if we're finished rendering the entire document, // flush to the real writer if node.Type() == ast.TypeDocument { writeTo = w } if e.Finisher != nil { err := e.Finisher.Finish(writeTo, r.context) if err != nil { return ast.WalkStop, fmt.Errorf("glamour: error finishing render: %w", err) } } _, _ = io.WriteString(bs.Current().Block, e.Exiting) } return ast.WalkContinue, nil } func isChild(node ast.Node) bool { for n := node.Parent(); n != nil; n = n.Parent() { // These types are already rendered by their parent switch n.Kind() { case ast.KindCodeSpan, ast.KindAutoLink, ast.KindLink, ast.KindImage, ast.KindEmphasis, astext.KindStrikethrough, astext.KindTableCell: return true } } return false } func resolveRelativeURL(baseURL string, rel string) string { u, err := url.Parse(rel) if err != nil { return rel } if u.IsAbs() { return rel } u.Path = strings.TrimPrefix(u.Path, "/") base, err := url.Parse(baseURL) if err != nil { return rel } return base.ResolveReference(u).String() } glamour-0.10.0/ansi/renderer_test.go000066400000000000000000000057561500000454500173720ustar00rootroot00000000000000package ansi import ( "bytes" "encoding/json" "os" "path/filepath" "strings" "testing" "github.com/charmbracelet/x/exp/golden" "github.com/muesli/termenv" "github.com/yuin/goldmark" emoji "github.com/yuin/goldmark-emoji" "github.com/yuin/goldmark/extension" "github.com/yuin/goldmark/parser" "github.com/yuin/goldmark/renderer" "github.com/yuin/goldmark/util" ) const ( examplesDir = "../styles/examples/" issuesDir = "../testdata/issues/" ) func TestRenderer(t *testing.T) { files, err := filepath.Glob(examplesDir + "*.md") if err != nil { t.Fatal(err) } for _, f := range files { bn := strings.TrimSuffix(filepath.Base(f), ".md") t.Run(bn, func(t *testing.T) { sn := filepath.Join(examplesDir, bn+".style") in, err := os.ReadFile(f) if err != nil { t.Fatal(err) } b, err := os.ReadFile(sn) if err != nil { t.Fatal(err) } options := Options{ WordWrap: 80, ColorProfile: termenv.TrueColor, } err = json.Unmarshal(b, &options.Styles) if err != nil { t.Fatal(err) } switch bn { case "table_wrap": tableWrap := true options.TableWrap = &tableWrap case "table_truncate": tableWrap := false options.TableWrap = &tableWrap case "table_with_inline_links": options.InlineTableLinks = true case "table_with_footer_links", "table_with_footer_links_no_color": options.InlineTableLinks = false } md := goldmark.New( goldmark.WithExtensions( extension.GFM, extension.DefinitionList, emoji.Emoji, ), goldmark.WithParserOptions( parser.WithAutoHeadingID(), ), ) ar := NewRenderer(options) md.SetRenderer( renderer.NewRenderer( renderer.WithNodeRenderers(util.Prioritized(ar, 1000)))) var buf bytes.Buffer if err := md.Convert(in, &buf); err != nil { t.Error(err) } golden.RequireEqual(t, buf.Bytes()) }) } } func TestRendererIssues(t *testing.T) { files, err := filepath.Glob(issuesDir + "*.md") if err != nil { t.Fatal(err) } for _, f := range files { bn := strings.TrimSuffix(filepath.Base(f), ".md") t.Run(bn, func(t *testing.T) { in, err := os.ReadFile(f) if err != nil { t.Fatal(err) } b, err := os.ReadFile("../styles/dark.json") if err != nil { t.Fatal(err) } options := Options{ WordWrap: 80, ColorProfile: termenv.TrueColor, } err = json.Unmarshal(b, &options.Styles) if err != nil { t.Fatal(err) } if bn == "493" { tableWrap := false options.TableWrap = &tableWrap } md := goldmark.New( goldmark.WithExtensions( extension.GFM, extension.DefinitionList, emoji.Emoji, ), goldmark.WithParserOptions( parser.WithAutoHeadingID(), ), ) ar := NewRenderer(options) md.SetRenderer( renderer.NewRenderer( renderer.WithNodeRenderers(util.Prioritized(ar, 1000)))) var buf bytes.Buffer if err := md.Convert(in, &buf); err != nil { t.Error(err) } golden.RequireEqual(t, buf.Bytes()) }) } } glamour-0.10.0/ansi/style.go000066400000000000000000000204061500000454500156520ustar00rootroot00000000000000package ansi // Chroma holds all the chroma settings. type Chroma struct { Text StylePrimitive `json:"text,omitempty"` Error StylePrimitive `json:"error,omitempty"` Comment StylePrimitive `json:"comment,omitempty"` CommentPreproc StylePrimitive `json:"comment_preproc,omitempty"` Keyword StylePrimitive `json:"keyword,omitempty"` KeywordReserved StylePrimitive `json:"keyword_reserved,omitempty"` KeywordNamespace StylePrimitive `json:"keyword_namespace,omitempty"` KeywordType StylePrimitive `json:"keyword_type,omitempty"` Operator StylePrimitive `json:"operator,omitempty"` Punctuation StylePrimitive `json:"punctuation,omitempty"` Name StylePrimitive `json:"name,omitempty"` NameBuiltin StylePrimitive `json:"name_builtin,omitempty"` NameTag StylePrimitive `json:"name_tag,omitempty"` NameAttribute StylePrimitive `json:"name_attribute,omitempty"` NameClass StylePrimitive `json:"name_class,omitempty"` NameConstant StylePrimitive `json:"name_constant,omitempty"` NameDecorator StylePrimitive `json:"name_decorator,omitempty"` NameException StylePrimitive `json:"name_exception,omitempty"` NameFunction StylePrimitive `json:"name_function,omitempty"` NameOther StylePrimitive `json:"name_other,omitempty"` Literal StylePrimitive `json:"literal,omitempty"` LiteralNumber StylePrimitive `json:"literal_number,omitempty"` LiteralDate StylePrimitive `json:"literal_date,omitempty"` LiteralString StylePrimitive `json:"literal_string,omitempty"` LiteralStringEscape StylePrimitive `json:"literal_string_escape,omitempty"` GenericDeleted StylePrimitive `json:"generic_deleted,omitempty"` GenericEmph StylePrimitive `json:"generic_emph,omitempty"` GenericInserted StylePrimitive `json:"generic_inserted,omitempty"` GenericStrong StylePrimitive `json:"generic_strong,omitempty"` GenericSubheading StylePrimitive `json:"generic_subheading,omitempty"` Background StylePrimitive `json:"background,omitempty"` } // StylePrimitive holds all the basic style settings. type StylePrimitive struct { BlockPrefix string `json:"block_prefix,omitempty"` BlockSuffix string `json:"block_suffix,omitempty"` Prefix string `json:"prefix,omitempty"` Suffix string `json:"suffix,omitempty"` Color *string `json:"color,omitempty"` BackgroundColor *string `json:"background_color,omitempty"` Underline *bool `json:"underline,omitempty"` Bold *bool `json:"bold,omitempty"` Upper *bool `json:"upper,omitempty"` Lower *bool `json:"lower,omitempty"` Title *bool `json:"title,omitempty"` Italic *bool `json:"italic,omitempty"` CrossedOut *bool `json:"crossed_out,omitempty"` Faint *bool `json:"faint,omitempty"` Conceal *bool `json:"conceal,omitempty"` Overlined *bool `json:"overlined,omitempty"` Inverse *bool `json:"inverse,omitempty"` Blink *bool `json:"blink,omitempty"` Format string `json:"format,omitempty"` } // StyleTask holds the style settings for a task item. type StyleTask struct { StylePrimitive Ticked string `json:"ticked,omitempty"` Unticked string `json:"unticked,omitempty"` } // StyleBlock holds the basic style settings for block elements. type StyleBlock struct { StylePrimitive Indent *uint `json:"indent,omitempty"` IndentToken *string `json:"indent_token,omitempty"` Margin *uint `json:"margin,omitempty"` } // StyleCodeBlock holds the style settings for a code block. type StyleCodeBlock struct { StyleBlock Theme string `json:"theme,omitempty"` Chroma *Chroma `json:"chroma,omitempty"` } // StyleList holds the style settings for a list. type StyleList struct { StyleBlock LevelIndent uint `json:"level_indent,omitempty"` } // StyleTable holds the style settings for a table. type StyleTable struct { StyleBlock CenterSeparator *string `json:"center_separator,omitempty"` ColumnSeparator *string `json:"column_separator,omitempty"` RowSeparator *string `json:"row_separator,omitempty"` } // StyleConfig is used to configure the styling behavior of an ANSIRenderer. type StyleConfig struct { Document StyleBlock `json:"document,omitempty"` BlockQuote StyleBlock `json:"block_quote,omitempty"` Paragraph StyleBlock `json:"paragraph,omitempty"` List StyleList `json:"list,omitempty"` Heading StyleBlock `json:"heading,omitempty"` H1 StyleBlock `json:"h1,omitempty"` H2 StyleBlock `json:"h2,omitempty"` H3 StyleBlock `json:"h3,omitempty"` H4 StyleBlock `json:"h4,omitempty"` H5 StyleBlock `json:"h5,omitempty"` H6 StyleBlock `json:"h6,omitempty"` Text StylePrimitive `json:"text,omitempty"` Strikethrough StylePrimitive `json:"strikethrough,omitempty"` Emph StylePrimitive `json:"emph,omitempty"` Strong StylePrimitive `json:"strong,omitempty"` HorizontalRule StylePrimitive `json:"hr,omitempty"` Item StylePrimitive `json:"item,omitempty"` Enumeration StylePrimitive `json:"enumeration,omitempty"` Task StyleTask `json:"task,omitempty"` Link StylePrimitive `json:"link,omitempty"` LinkText StylePrimitive `json:"link_text,omitempty"` Image StylePrimitive `json:"image,omitempty"` ImageText StylePrimitive `json:"image_text,omitempty"` Code StyleBlock `json:"code,omitempty"` CodeBlock StyleCodeBlock `json:"code_block,omitempty"` Table StyleTable `json:"table,omitempty"` DefinitionList StyleBlock `json:"definition_list,omitempty"` DefinitionTerm StylePrimitive `json:"definition_term,omitempty"` DefinitionDescription StylePrimitive `json:"definition_description,omitempty"` HTMLBlock StyleBlock `json:"html_block,omitempty"` HTMLSpan StyleBlock `json:"html_span,omitempty"` } func cascadeStyles(s ...StyleBlock) StyleBlock { var r StyleBlock for _, v := range s { r = cascadeStyle(r, v, true) } return r } func cascadeStylePrimitives(s ...StylePrimitive) StylePrimitive { var r StylePrimitive for _, v := range s { r = cascadeStylePrimitive(r, v, true) } return r } func cascadeStylePrimitive(parent, child StylePrimitive, toBlock bool) StylePrimitive { s := child s.Color = parent.Color s.BackgroundColor = parent.BackgroundColor s.Underline = parent.Underline s.Bold = parent.Bold s.Upper = parent.Upper s.Title = parent.Title s.Lower = parent.Lower s.Italic = parent.Italic s.CrossedOut = parent.CrossedOut s.Faint = parent.Faint s.Conceal = parent.Conceal s.Overlined = parent.Overlined s.Inverse = parent.Inverse s.Blink = parent.Blink if toBlock { s.BlockPrefix = parent.BlockPrefix s.BlockSuffix = parent.BlockSuffix s.Prefix = parent.Prefix s.Suffix = parent.Suffix } if child.Color != nil { s.Color = child.Color } if child.BackgroundColor != nil { s.BackgroundColor = child.BackgroundColor } if child.Underline != nil { s.Underline = child.Underline } if child.Bold != nil { s.Bold = child.Bold } if child.Upper != nil { s.Upper = child.Upper } if child.Lower != nil { s.Lower = child.Lower } if child.Title != nil { s.Title = child.Title } if child.Italic != nil { s.Italic = child.Italic } if child.CrossedOut != nil { s.CrossedOut = child.CrossedOut } if child.Faint != nil { s.Faint = child.Faint } if child.Conceal != nil { s.Conceal = child.Conceal } if child.Overlined != nil { s.Overlined = child.Overlined } if child.Inverse != nil { s.Inverse = child.Inverse } if child.Blink != nil { s.Blink = child.Blink } if child.BlockPrefix != "" { s.BlockPrefix = child.BlockPrefix } if child.BlockSuffix != "" { s.BlockSuffix = child.BlockSuffix } if child.Prefix != "" { s.Prefix = child.Prefix } if child.Suffix != "" { s.Suffix = child.Suffix } if child.Format != "" { s.Format = child.Format } return s } func cascadeStyle(parent StyleBlock, child StyleBlock, toBlock bool) StyleBlock { s := child s.StylePrimitive = cascadeStylePrimitive(parent.StylePrimitive, child.StylePrimitive, toBlock) if toBlock { s.Indent = parent.Indent s.Margin = parent.Margin } if child.Indent != nil { s.Indent = child.Indent } return s } glamour-0.10.0/ansi/table.go000066400000000000000000000117471500000454500156110ustar00rootroot00000000000000package ansi import ( "bytes" "fmt" "io" "github.com/charmbracelet/lipgloss" "github.com/charmbracelet/lipgloss/table" "github.com/muesli/reflow/indent" astext "github.com/yuin/goldmark/extension/ast" ) // A TableElement is used to render tables. type TableElement struct { lipgloss *table.Table table *astext.Table header []string row []string source []byte tableImages []tableLink tableLinks []tableLink } // A TableRowElement is used to render a single row in a table. type TableRowElement struct{} // A TableHeadElement is used to render a table's head element. type TableHeadElement struct{} // A TableCellElement is used to render a single cell in a row. type TableCellElement struct { Children []ElementRenderer Head bool } // Render renders a TableElement. func (e *TableElement) Render(w io.Writer, ctx RenderContext) error { bs := ctx.blockStack var indentation uint var margin uint rules := ctx.options.Styles.Table if rules.Indent != nil { indentation = *rules.Indent } if rules.Margin != nil { margin = *rules.Margin } iw := indent.NewWriterPipe(w, indentation+margin, func(_ io.Writer) { renderText(w, ctx.options.ColorProfile, bs.Current().Style.StylePrimitive, " ") }) style := bs.With(rules.StylePrimitive) renderText(iw, ctx.options.ColorProfile, bs.Current().Style.StylePrimitive, rules.BlockPrefix) renderText(iw, ctx.options.ColorProfile, style, rules.Prefix) width := int(ctx.blockStack.Width(ctx)) //nolint: gosec wrap := true if ctx.options.TableWrap != nil { wrap = *ctx.options.TableWrap } ctx.table.lipgloss = table.New().Width(width).Wrap(wrap) if err := e.collectLinksAndImages(ctx); err != nil { return err } return nil } func (e *TableElement) setStyles(ctx RenderContext) { ctx.table.lipgloss = ctx.table.lipgloss.StyleFunc(func(_, col int) lipgloss.Style { st := lipgloss.NewStyle().Inline(false) // Default Styles st = st.Margin(0, 1) // Override with custom styles if m := ctx.options.Styles.Table.Margin; m != nil { st = st.Padding(0, int(*m)) //nolint: gosec } switch e.table.Alignments[col] { case astext.AlignLeft: st = st.Align(lipgloss.Left).PaddingRight(0) case astext.AlignCenter: st = st.Align(lipgloss.Center) case astext.AlignRight: st = st.Align(lipgloss.Right).PaddingLeft(0) case astext.AlignNone: // do nothing } return st }) } func (e *TableElement) setBorders(ctx RenderContext) { rules := ctx.options.Styles.Table border := lipgloss.NormalBorder() if rules.RowSeparator != nil && rules.ColumnSeparator != nil { border = lipgloss.Border{ Top: *rules.RowSeparator, Bottom: *rules.RowSeparator, Left: *rules.ColumnSeparator, Right: *rules.ColumnSeparator, Middle: *rules.CenterSeparator, } } ctx.table.lipgloss.Border(border) ctx.table.lipgloss.BorderTop(false) ctx.table.lipgloss.BorderLeft(false) ctx.table.lipgloss.BorderRight(false) ctx.table.lipgloss.BorderBottom(false) } // Finish finishes rendering a TableElement. func (e *TableElement) Finish(_ io.Writer, ctx RenderContext) error { defer func() { ctx.table.lipgloss = nil ctx.table.tableImages = nil ctx.table.tableLinks = nil }() rules := ctx.options.Styles.Table e.setStyles(ctx) e.setBorders(ctx) ow := ctx.blockStack.Current().Block if _, err := ow.WriteString(ctx.table.lipgloss.String()); err != nil { return fmt.Errorf("glamour: error writing to buffer: %w", err) } renderText(ow, ctx.options.ColorProfile, ctx.blockStack.With(rules.StylePrimitive), rules.Suffix) renderText(ow, ctx.options.ColorProfile, ctx.blockStack.Current().Style.StylePrimitive, rules.BlockSuffix) e.printTableLinks(ctx) return nil } // Finish finishes rendering a TableRowElement. func (e *TableRowElement) Finish(_ io.Writer, ctx RenderContext) error { if ctx.table.lipgloss == nil { return nil } ctx.table.lipgloss.Row(ctx.table.row...) ctx.table.row = []string{} return nil } // Finish finishes rendering a TableHeadElement. func (e *TableHeadElement) Finish(_ io.Writer, ctx RenderContext) error { if ctx.table.lipgloss == nil { return nil } ctx.table.lipgloss.Headers(ctx.table.header...) ctx.table.header = []string{} return nil } // Render renders a TableCellElement. func (e *TableCellElement) Render(_ io.Writer, ctx RenderContext) error { var b bytes.Buffer style := ctx.options.Styles.Table.StylePrimitive for _, child := range e.Children { if r, ok := child.(StyleOverriderElementRenderer); ok { if err := r.StyleOverrideRender(&b, ctx, style); err != nil { return fmt.Errorf("glamour: error rendering with style: %w", err) } } else { var bb bytes.Buffer if err := child.Render(&bb, ctx); err != nil { return fmt.Errorf("glamour: error rendering: %w", err) } el := &BaseElement{ Token: bb.String(), Style: style, } if err := el.Render(&b, ctx); err != nil { return err } } } if e.Head { ctx.table.header = append(ctx.table.header, b.String()) } else { ctx.table.row = append(ctx.table.row, b.String()) } return nil } glamour-0.10.0/ansi/table_links.go000066400000000000000000000126521500000454500170050ustar00rootroot00000000000000package ansi import ( "bytes" "fmt" "io" "net/url" "slices" "strconv" "strings" "github.com/charmbracelet/glamour/internal/autolink" xansi "github.com/charmbracelet/x/ansi" "github.com/charmbracelet/x/exp/slice" "github.com/yuin/goldmark/ast" astext "github.com/yuin/goldmark/extension/ast" ) type tableLink struct { href string title string content string linkType linkType } type linkType int const ( _ linkType = iota linkTypeAuto linkTypeImage linkTypeRegular ) func (e *TableElement) printTableLinks(ctx RenderContext) { if !e.shouldPrintTableLinks(ctx) { return } w := ctx.blockStack.Current().Block termWidth := int(ctx.blockStack.Width(ctx)) //nolint: gosec renderLinkText := func(link tableLink, position, padding int) string { token := strings.Repeat(" ", padding) style := ctx.options.Styles.LinkText switch link.linkType { case linkTypeAuto, linkTypeRegular: token += fmt.Sprintf("[%d]: %s", position, link.content) case linkTypeImage: token += link.content style = ctx.options.Styles.ImageText style.Prefix = fmt.Sprintf("[%d]: %s", position, style.Prefix) } var b bytes.Buffer el := &BaseElement{Token: token, Style: style} _ = el.Render(io.MultiWriter(w, &b), ctx) return b.String() } renderLinkHref := func(link tableLink, linkText string) { style := ctx.options.Styles.Link if link.linkType == linkTypeImage { style = ctx.options.Styles.Image } // XXX(@andreynering): Once #411 is merged, use the hyperlink // protocol to make the link work for the full URL even if we // show it truncated. linkMaxWidth := max(termWidth-xansi.StringWidth(linkText)-1, 0) token := xansi.Truncate(link.href, linkMaxWidth, "…") el := &BaseElement{Token: token, Style: style} _ = el.Render(w, ctx) } renderString := func(str string) { renderText(w, ctx.options.ColorProfile, ctx.blockStack.Current().Style.StylePrimitive, str) } paddingFor := func(total, position int) int { totalSize := len(strconv.Itoa(total)) positionSize := len(strconv.Itoa(position)) return max(totalSize-positionSize, 0) } renderList := func(list []tableLink) { for i, item := range list { position := i + 1 padding := paddingFor(len(list), position) renderString("\n") linkText := renderLinkText(item, position, padding) renderString(" ") renderLinkHref(item, linkText) } } if len(ctx.table.tableLinks) > 0 { renderString("\n") } renderList(ctx.table.tableLinks) if len(ctx.table.tableImages) > 0 { renderString("\n") } renderList(ctx.table.tableImages) } func (e *TableElement) shouldPrintTableLinks(ctx RenderContext) bool { if ctx.options.InlineTableLinks { return false } if len(ctx.table.tableLinks) == 0 && len(ctx.table.tableImages) == 0 { return false } return true } func (e *TableElement) collectLinksAndImages(ctx RenderContext) error { images := make([]tableLink, 0) links := make([]tableLink, 0) err := ast.Walk(e.table, func(node ast.Node, entering bool) (ast.WalkStatus, error) { if !entering { return ast.WalkContinue, nil } switch n := node.(type) { case *ast.AutoLink: uri := string(n.URL(e.source)) autoLink := tableLink{ href: uri, content: linkDomain(uri), linkType: linkTypeAuto, } if shortned, ok := autolink.Detect(uri); ok { autoLink.content = shortned } links = append(links, autoLink) case *ast.Image: content, err := nodeContent(node, e.source) if err != nil { return ast.WalkStop, err } image := tableLink{ href: string(n.Destination), title: string(n.Title), content: string(content), linkType: linkTypeImage, } if image.content == "" { image.content = linkDomain(image.href) } images = append(images, image) case *ast.Link: content, err := nodeContent(node, e.source) if err != nil { return ast.WalkStop, err } link := tableLink{ href: string(n.Destination), title: string(n.Title), content: string(content), linkType: linkTypeRegular, } links = append(links, link) } return ast.WalkContinue, nil }) if err != nil { return fmt.Errorf("glamour: error collecting links: %w", err) } ctx.table.tableImages = slice.Uniq(images) ctx.table.tableLinks = slice.Uniq(links) return nil } func isInsideTable(node ast.Node) bool { parent := node.Parent() for parent != nil { switch parent.Kind() { case astext.KindTable, astext.KindTableHeader, astext.KindTableRow, astext.KindTableCell: return true default: parent = parent.Parent() } } return false } func nodeContent(node ast.Node, source []byte) ([]byte, error) { var builder bytes.Buffer var traverse func(node ast.Node) error traverse = func(node ast.Node) error { for n := node.FirstChild(); n != nil; n = n.NextSibling() { switch nn := n.(type) { case *ast.Text: if _, err := builder.Write(nn.Segment.Value(source)); err != nil { return fmt.Errorf("glamour: error writing text node: %w", err) } default: if err := traverse(nn); err != nil { return err } } } return nil } if err := traverse(node); err != nil { return nil, err } return builder.Bytes(), nil } func linkDomain(href string) string { if uri, err := url.Parse(href); err == nil { return uri.Hostname() } return "link" } func linkWithSuffix(tl tableLink, list []tableLink) string { index := slices.Index(list, tl) if index == -1 { return tl.content } return fmt.Sprintf("%s[%d]", tl.content, index+1) } glamour-0.10.0/ansi/task.go000066400000000000000000000007351500000454500154570ustar00rootroot00000000000000package ansi import ( "io" ) // A TaskElement is used to render tasks inside a todo-list. type TaskElement struct { Checked bool } // Render renders a TaskElement. func (e *TaskElement) Render(w io.Writer, ctx RenderContext) error { var el *BaseElement pre := ctx.options.Styles.Task.Unticked if e.Checked { pre = ctx.options.Styles.Task.Ticked } el = &BaseElement{ Prefix: pre, Style: ctx.options.Styles.Task.StylePrimitive, } return el.Render(w, ctx) } glamour-0.10.0/ansi/templatehelper.go000066400000000000000000000042071500000454500175260ustar00rootroot00000000000000package ansi import ( "regexp" "strings" "text/template" "golang.org/x/text/cases" "golang.org/x/text/language" ) // TemplateFuncMap contains a few useful template helpers. var ( TemplateFuncMap = template.FuncMap{ "Left": func(values ...interface{}) string { s := values[0].(string) n := values[1].(int) if n > len(s) { n = len(s) } return s[:n] }, "Matches": func(values ...interface{}) bool { ok, _ := regexp.MatchString(values[1].(string), values[0].(string)) return ok }, "Mid": func(values ...interface{}) string { s := values[0].(string) l := values[1].(int) if l > len(s) { l = len(s) } if len(values) > 2 { //nolint:mnd r := values[2].(int) if r > len(s) { r = len(s) } return s[l:r] } return s[l:] }, "Right": func(values ...interface{}) string { s := values[0].(string) n := len(s) - values[1].(int) if n < 0 { n = 0 } return s[n:] }, "Last": func(values ...interface{}) string { return values[0].([]string)[len(values[0].([]string))-1] }, // strings functions "Compare": strings.Compare, // 1.5+ only "Contains": strings.Contains, "ContainsAny": strings.ContainsAny, "Count": strings.Count, "EqualFold": strings.EqualFold, "HasPrefix": strings.HasPrefix, "HasSuffix": strings.HasSuffix, "Index": strings.Index, "IndexAny": strings.IndexAny, "Join": strings.Join, "LastIndex": strings.LastIndex, "LastIndexAny": strings.LastIndexAny, "Repeat": strings.Repeat, "Replace": strings.Replace, "Split": strings.Split, "SplitAfter": strings.SplitAfter, "SplitAfterN": strings.SplitAfterN, "SplitN": strings.SplitN, "Title": cases.Title(language.English).String, "ToLower": cases.Lower(language.English).String, "ToTitle": cases.Upper(language.English).String, "ToUpper": strings.ToUpper, "Trim": strings.Trim, "TrimLeft": strings.TrimLeft, "TrimPrefix": strings.TrimPrefix, "TrimRight": strings.TrimRight, "TrimSpace": strings.TrimSpace, "TrimSuffix": strings.TrimSuffix, } ) glamour-0.10.0/ansi/testdata/000077500000000000000000000000001500000454500157725ustar00rootroot00000000000000glamour-0.10.0/ansi/testdata/TestRenderer/000077500000000000000000000000001500000454500204005ustar00rootroot00000000000000glamour-0.10.0/ansi/testdata/TestRenderer/block_quote.golden000066400000000000000000000017151500000454500241050ustar00rootroot00000000000000 => First line of quote Second line                                                glamour-0.10.0/ansi/testdata/TestRenderer/code.golden000066400000000000000000000001401500000454500224770ustar00rootroot00000000000000This is a code. glamour-0.10.0/ansi/testdata/TestRenderer/code_block.golden000066400000000000000000000003231500000454500236540ustar00rootroot00000000000000 This is a code block.  glamour-0.10.0/ansi/testdata/TestRenderer/emoji.golden000066400000000000000000000001321500000454500226710ustar00rootroot00000000000000🐙 ⚡ 🐱 = ❤️ glamour-0.10.0/ansi/testdata/TestRenderer/emph.golden000066400000000000000000000001311500000454500225160ustar00rootroot00000000000000This text is emphasized. glamour-0.10.0/ansi/testdata/TestRenderer/enumeration.golden000066400000000000000000000052241500000454500241230ustar00rootroot00000000000000 1. First Item                                                                    2. Second Item                                                                   glamour-0.10.0/ansi/testdata/TestRenderer/heading.golden000066400000000000000000000006171500000454500231750ustar00rootroot00000000000000=> h1 <= ## h2 ### h3glamour-0.10.0/ansi/testdata/TestRenderer/hr.golden000066400000000000000000000000031500000454500221740ustar00rootroot00000000000000---glamour-0.10.0/ansi/testdata/TestRenderer/image.golden000066400000000000000000000001731500000454500226550ustar00rootroot00000000000000Image [Image: https://charm.sh/logo.png]. glamour-0.10.0/ansi/testdata/TestRenderer/link.golden000066400000000000000000000001631500000454500225270ustar00rootroot00000000000000This is a link (https://charm.sh). glamour-0.10.0/ansi/testdata/TestRenderer/list.golden000066400000000000000000000075571500000454500225630ustar00rootroot00000000000000 • First Item                                                                         • Nested List Item                                                           • Second Item                                                                    glamour-0.10.0/ansi/testdata/TestRenderer/ordered_list.golden000066400000000000000000000005041500000454500242500ustar00rootroot00000000000000 3. 3 is first and numbered 3 4. 4 is second and numbered 4 5. ten is third and numbered 5 glamour-0.10.0/ansi/testdata/TestRenderer/strikethrough.golden000066400000000000000000000001511500000454500244710ustar00rootroot00000000000000Scratch this. glamour-0.10.0/ansi/testdata/TestRenderer/strong.golden000066400000000000000000000001311500000454500231010ustar00rootroot00000000000000This text is strong. glamour-0.10.0/ansi/testdata/TestRenderer/table.golden000066400000000000000000000013371500000454500226650ustar00rootroot00000000000000 Label │ Value │ URL ──────────────────────────┼─────────────────────────┼───────────────────────── First │ foo │ charm.sh[1] Second │ bar │ charm.sh[1] [1]: charm.sh https://charm.sh glamour-0.10.0/ansi/testdata/TestRenderer/table_align.golden000066400000000000000000000013371500000454500240370ustar00rootroot00000000000000 Label │ Value │ URL ──────────────────────────┼─────────────────────────┼───────────────────────── First │ foo │ charm.sh Second │ bar │ charm.sh[1] [1]: charm.sh https://charm.sh glamour-0.10.0/ansi/testdata/TestRenderer/table_truncate.golden000066400000000000000000000007621500000454500245730ustar00rootroot00000000000000 Name │ Description │ Type │ Required │ Default ─────────┼────────────────────────────────────────┼──────┼──────────┼───────── command │ A command to be executed inside the c… │ yes │ hello │ yep glamour-0.10.0/ansi/testdata/TestRenderer/table_with_footer_auto_links.golden000066400000000000000000000035101500000454500275210ustar00rootroot00000000000000 Name │ Role │ Handle ──────────────────────────┼─────────────────────────┼───────────────────────── Andrey │ Engineering │ github.com[1] Ayman │ Engineering │ github.com[2] Bash │ Engineering │ github.com[3] Carlos │ Engineering │ github.com[4] Christian │ Product │ github.com[5] Rapha │ Intern │ github.com[6] [1]: github.com https://github.com/andreynering [2]: github.com https://github.com/aymanbagabas [3]: github.com https://github.com/bashbunni [4]: github.com https://github.com/caarlos0 [5]: github.com https://github.com/meowgorithm [6]: github.com https://github.com/raphamorim glamour-0.10.0/ansi/testdata/TestRenderer/table_with_footer_auto_links_short.golden000066400000000000000000000117201500000454500307420ustar00rootroot00000000000000 Description │ Link ───────────────────────────────────────┼────────────────────────────────────── Issue │ owner/repo#123[1] Issue │ owner/repo#123[2] Issue Comment │ owner/repo#123 (comment)[3] Issue Comment │ owner/repo#123 (comment)[4] Pull Request │ owner/repo#123[5] Pull Request │ owner/repo#123[6] Pull Request Comment │ owner/repo#123 (comment)[7] Pull Request Comment │ owner/repo#123 (comment)[8] Pull Request Comment │ owner/repo#123 (comment)[9] Pull Request Comment │ owner/repo#123 (comment)[10] Pull Request Review │ owner/repo#123 (review)[11] Pull Request Review │ owner/repo#123 (review)[12] Discussion │ owner/repo#123[13] Discussion Comment │ owner/repo#123 (comment)[14] Commit │ owner/repo@abcdefg[15] Commit │ owner/repo@abcdefg[16] Pull Request Commit │ owner/repo@abcdefg[17] Pull Request Commit │ owner/repo@abcdefg[18] Pull Request Commit │ owner/repo@abcdefg[19] Pull Request Commit │ owner/repo@abcdefg[20]  [1]: owner/repo#123 https://github.com/owner/repo/issue/123  [2]: owner/repo#123 https://github.com/owner/repo/issues/123  [3]: owner/repo#123 (comment) https://github.com/owner/repo/issue/123#issuecom…  [4]: owner/repo#123 (comment) https://github.com/owner/repo/issues/123#issueco…  [5]: owner/repo#123 https://github.com/owner/repo/pull/123  [6]: owner/repo#123 https://github.com/owner/repo/pulls/123  [7]: owner/repo#123 (comment) https://github.com/owner/repo/pull/123#issuecomm…  [8]: owner/repo#123 (comment) https://github.com/owner/repo/pulls/123#issuecom…  [9]: owner/repo#123 (comment) https://github.com/owner/repo/pull/123#discussio… [10]: owner/repo#123 (comment) https://github.com/owner/repo/pulls/123#discussi… [11]: owner/repo#123 (review) https://github.com/owner/repo/pull/123#pullreques… [12]: owner/repo#123 (review) https://github.com/owner/repo/pulls/123#pullreque… [13]: owner/repo#123 https://github.com/owner/repo/discussions/123 [14]: owner/repo#123 (comment) https://github.com/owner/repo/discussions/123#di… [15]: owner/repo@abcdefg https://github.com/owner/repo/commit/abcdefghijklmnopq… [16]: owner/repo@abcdefg https://github.com/owner/repo/commit/abcdefghijklmnopq… [17]: owner/repo@abcdefg https://github.com/owner/repo/pull/123/commits/abcdefg… [18]: owner/repo@abcdefg https://github.com/owner/repo/pulls/123/commits/abcdef… [19]: owner/repo@abcdefg https://github.com/owner/repo/pull/123/commits/abcdefg… [20]: owner/repo@abcdefg https://github.com/owner/repo/pulls/123/commits/abcdef… glamour-0.10.0/ansi/testdata/TestRenderer/table_with_footer_images.golden000066400000000000000000000055511500000454500266250ustar00rootroot00000000000000 Name │ Role │ Handle │ Image ───────────┼─────────────┼──────────────────┼────────────────────────────────── Andrey │ Engineering │ @andreynering[1] │ Image: @andreynering's avatar[1] Ayman │ Engineering │ @aymanbagabas[2] │ Image: @aymanbagabas's avatar[2] Bash │ Engineering │ @bashbunni[3] │ Image: @bashbunni's avatar[3] Carlos │ Engineering │ @caarlos0[4] │ Image: @caarlos0's avatar[4] Christian │ Product │ @meowgorithm[5] │ Image: @meowgorithm's avatar[5] Rapha │ Intern │ @raphamorim[6] │ Image: @raphamorim's avatar[6] [1]: @andreynering https://github.com/andreynering [2]: @aymanbagabas https://github.com/aymanbagabas [3]: @bashbunni https://github.com/bashbunni [4]: @caarlos0 https://github.com/caarlos0 [5]: @meowgorithm https://github.com/meowgorithm [6]: @raphamorim https://github.com/raphamorim [1]: Image: @andreynering's avatar → https://github.com/andreynering.png [2]: Image: @aymanbagabas's avatar → https://github.com/aymanbagabas.png [3]: Image: @bashbunni's avatar → https://github.com/bashbunni.png [4]: Image: @caarlos0's avatar → https://github.com/caarlos0.png [5]: Image: @meowgorithm's avatar → https://github.com/meowgorithm.png [6]: Image: @raphamorim's avatar → https://github.com/raphamorim.png glamour-0.10.0/ansi/testdata/TestRenderer/table_with_footer_images_no_alt.golden000066400000000000000000000055471500000454500301660ustar00rootroot00000000000000 Name │ Role │ Handle │ Image ──────────────────┼─────────────────┼──────────────────┼────────────────────── Andrey │ Engineering │ @andreynering[1] │ Image: github.com[1] Ayman │ Engineering │ @aymanbagabas[2] │ Image: github.com[2] Bash │ Engineering │ @bashbunni[3] │ Image: github.com[3] Carlos │ Engineering │ @caarlos0[4] │ Image: github.com[4] Christian │ Product │ @meowgorithm[5] │ Image: github.com[5] Rapha │ Intern │ @raphamorim[6] │ Image: github.com[6] [1]: @andreynering https://github.com/andreynering [2]: @aymanbagabas https://github.com/aymanbagabas [3]: @bashbunni https://github.com/bashbunni [4]: @caarlos0 https://github.com/caarlos0 [5]: @meowgorithm https://github.com/meowgorithm [6]: @raphamorim https://github.com/raphamorim [1]: Image: github.com → https://github.com/andreynering.png [2]: Image: github.com → https://github.com/aymanbagabas.png [3]: Image: github.com → https://github.com/bashbunni.png [4]: Image: github.com → https://github.com/caarlos0.png [5]: Image: github.com → https://github.com/meowgorithm.png [6]: Image: github.com → https://github.com/raphamorim.png glamour-0.10.0/ansi/testdata/TestRenderer/table_with_footer_images_same_alt.golden000066400000000000000000000055471500000454500304770ustar00rootroot00000000000000 Name │ Role │ Handle │ Image ────────────────┼────────────────┼──────────────────┼───────────────────────── Andrey │ Engineering │ @andreynering[1] │ Image: GitHub avatar[1] Ayman │ Engineering │ @aymanbagabas[2] │ Image: GitHub avatar[2] Bash │ Engineering │ @bashbunni[3] │ Image: GitHub avatar[3] Carlos │ Engineering │ @caarlos0[4] │ Image: GitHub avatar[4] Christian │ Product │ @meowgorithm[5] │ Image: GitHub avatar[5] Rapha │ Intern │ @raphamorim[6] │ Image: GitHub avatar[6] [1]: @andreynering https://github.com/andreynering [2]: @aymanbagabas https://github.com/aymanbagabas [3]: @bashbunni https://github.com/bashbunni [4]: @caarlos0 https://github.com/caarlos0 [5]: @meowgorithm https://github.com/meowgorithm [6]: @raphamorim https://github.com/raphamorim [1]: Image: GitHub avatar → https://github.com/andreynering.png [2]: Image: GitHub avatar → https://github.com/aymanbagabas.png [3]: Image: GitHub avatar → https://github.com/bashbunni.png [4]: Image: GitHub avatar → https://github.com/caarlos0.png [5]: Image: GitHub avatar → https://github.com/meowgorithm.png [6]: Image: GitHub avatar → https://github.com/raphamorim.png glamour-0.10.0/ansi/testdata/TestRenderer/table_with_footer_links.golden000066400000000000000000000035101500000454500264710ustar00rootroot00000000000000 Name │ Role │ Handle ──────────────────────────┼─────────────────────────┼───────────────────────── Andrey │ Engineering │ @andreynering[1] Ayman │ Engineering │ @aymanbagabas[2] Bash │ Engineering │ @bashbunni[3] Carlos │ Engineering │ @caarlos0[4] Christian │ Product │ @meowgorithm[5] Rapha │ Intern │ @raphamorim[6] [1]: @andreynering https://github.com/andreynering [2]: @aymanbagabas https://github.com/aymanbagabas [3]: @bashbunni https://github.com/bashbunni [4]: @caarlos0 https://github.com/caarlos0 [5]: @meowgorithm https://github.com/meowgorithm [6]: @raphamorim https://github.com/raphamorim glamour-0.10.0/ansi/testdata/TestRenderer/table_with_footer_links_complex.golden000066400000000000000000000176731500000454500302370ustar00rootroot00000000000000 Handle │ Description │ Image ──────────────────┼────────────────────────────────────┼────────────────────── @andreynering[1] │ Passionate engineer pushing the │ Image: github.com[1] │ boundaries of technology. Check │ │ out Andrey's GitHub projects[2] │ │ and personal blog[3]. Connect on │ │ Twitter[4] for tech insights. │ @aymanbagabas[5] │ Open-source enthusiast and │ Image: github.com[2] │ innovative software engineer. │ │ Explore Ayman's GitHub │   │ contributions[6] and technical │   │ writings[7]. Follow on LinkedIn[8] │ │ for professional updates. │ @bashbunni[9] │ Creative developer with a passion │ Image: github.com[3] │ for cutting-edge technologies. │ │ Dive into Bash's GitHub │   │ repositories[10] and dev │   │ portfolio[11]. Engage on │ │ Twitter[12] for tech discussions. │ @caarlos0[13] │ Innovative engineering leader and │ Image: github.com[4] │ open-source contributor. Discover │ │ Carlos's GitHub projects[14] and │ │ technical blog[15]. Connect on │ │ LinkedIn[16] for professional │ │ networking. │ @meowgorithm[17] │ Product visionary bridging │ Image: github.com[5] │ technology and user experience. │ │ Explore Christian's GitHub │   │ profile[18] and personal │   │ website[19]. Follow on Twitter[20] │ │ for product insights. │ @raphamorim[21] │ Ambitious intern making waves in │ Image: github.com[6] │ the tech world. Check out Rapha's │ │ GitHub repositories[22] and │ │ growing portfolio[23]. Connect on │ │ LinkedIn[24] for emerging talent. │  [1]: @andreynering https://github.com/andreynering  [2]: GitHub projects https://github.com/andreynering  [3]: personal blog https://andreynering.dev  [4]: Twitter https://twitter.com/andreynering  [5]: @aymanbagabas https://github.com/aymanbagabas  [6]: GitHub contributions https://github.com/aymanbagabas  [7]: technical writings https://aymanbagabas.medium.com  [8]: LinkedIn https://www.linkedin.com/in/aymanbagabas  [9]: @bashbunni https://github.com/bashbunni [10]: GitHub repositories https://github.com/bashbunni [11]: dev portfolio https://bashbunni.dev [12]: Twitter https://twitter.com/bashbunni [13]: @caarlos0 https://github.com/caarlos0 [14]: GitHub projects https://github.com/caarlos0 [15]: technical blog https://caarlos0.dev [16]: LinkedIn https://www.linkedin.com/in/caarlos0 [17]: @meowgorithm https://github.com/meowgorithm [18]: GitHub profile https://github.com/meowgorithm [19]: personal website https://meowgorithm.com [20]: Twitter https://twitter.com/meowgorithm [21]: @raphamorim https://github.com/raphamorim [22]: GitHub repositories https://github.com/raphamorim [23]: growing portfolio https://raphamorim.dev [24]: LinkedIn https://www.linkedin.com/in/raphamorim [1]: Image: github.com → https://github.com/andreynering.png [2]: Image: github.com → https://github.com/aymanbagabas.png [3]: Image: github.com → https://github.com/bashbunni.png [4]: Image: github.com → https://github.com/caarlos0.png [5]: Image: github.com → https://github.com/meowgorithm.png [6]: Image: github.com → https://github.com/raphamorim.png glamour-0.10.0/ansi/testdata/TestRenderer/table_with_footer_links_huge.golden000066400000000000000000000022241500000454500275020ustar00rootroot00000000000000 Word │ Link ───────────────────────────────────────┼────────────────────────────────────── foo │ foo[1] bar │ bar[2] baz │ baz[3] [1]: foo https://www.pudim.com.br/huge-0/huge-1/huge-2/huge-3/huge-4/huge-5/hug… [2]: bar https://www.pudim.com.br/huge-0/huge-1/huge-2/huge-3/huge-4/huge-5/hug… [3]: baz https://www.pudim.com.br/huge-0/huge-1/huge-2/huge-3/huge-4/huge-5/hug… glamour-0.10.0/ansi/testdata/TestRenderer/table_with_footer_links_no_color.golden000066400000000000000000000027101500000454500303640ustar00rootroot00000000000000 Name │ Role │ Handle ──────────────────────────┼─────────────────────────┼───────────────────────── Andrey │ Engineering │ @andreynering[1] Ayman │ Engineering │ @aymanbagabas[2] Bash │ Engineering │ @bashbunni[3] Carlos │ Engineering │ @caarlos0[4] Christian │ Product │ @meowgorithm[5] Rapha │ Intern │ @raphamorim[6] [1]: @andreynering https://github.com/andreynering [2]: @aymanbagabas https://github.com/aymanbagabas [3]: @bashbunni https://github.com/bashbunni [4]: @caarlos0 https://github.com/caarlos0 [5]: @meowgorithm https://github.com/meowgorithm [6]: @raphamorim https://github.com/raphamorim glamour-0.10.0/ansi/testdata/TestRenderer/table_with_footer_links_repeated.golden000066400000000000000000000016141500000454500303450ustar00rootroot00000000000000 Word │ Link ───────────────────────────────────────┼────────────────────────────────────── foo │ link[1] bar │ link[1] baz │ link[1] [1]: link https://www.pudim.com.br glamour-0.10.0/ansi/testdata/TestRenderer/table_with_inline_links.golden000066400000000000000000000021211500000454500264460ustar00rootroot00000000000000 Name │ Role │ Handle ───────────────┼──────────────┼─────────────────────────────────────────────── Andrey │ Engineering │ @andreynering https://github.com/andreynering Ayman │ Engineering │ @aymanbagabas https://github.com/aymanbagabas Bash │ Engineering │ @bashbunni https://github.com/bashbunni Carlos │ Engineering │ @caarlos0 https://github.com/caarlos0 Christian │ Product │ @meowgorithm https://github.com/meowgorithm Rapha │ Intern │ @raphamorim https://github.com/raphamorim glamour-0.10.0/ansi/testdata/TestRenderer/table_wrap.golden000066400000000000000000000020061500000454500237100ustar00rootroot00000000000000 Name │ Description │ Type │ Required │ Default ─────────┼────────────────────────────────────────┼──────┼──────────┼───────── command │ A command to be executed inside the │ yes │ hello │ yep │ container to assess its health. Each │ │ │ │ space delimited token of the command │ │ │ │ is a separate array element. Commands │ │ │ │ exiting 0 are considered to be │ │ │ │ successful probes, whilst all other │ │ │ │ exit codes are considered failures. │ │ │ glamour-0.10.0/ansi/testdata/TestRenderer/task.golden000066400000000000000000000050201500000454500225310ustar00rootroot00000000000000 ✓ Finished Task                                                                  ✗ Outstanding Task                                                               glamour-0.10.0/ansi/testdata/TestRendererIssues/000077500000000000000000000000001500000454500215745ustar00rootroot00000000000000glamour-0.10.0/ansi/testdata/TestRendererIssues/106.golden000066400000000000000000000431561500000454500233050ustar00rootroot00000000000000                                                                               • `hi`                                                                        • \hi                                                                         • *hi                                                                         • _hi                                                                         • {hi}                                                                        • [hi]                                                                        •                                                                         • (hi)                                                                        • # hi                                                                        • + hi                                                                        • - hi                                                                        • . hi                                                                        • ! hi                                                                        • | hi                                                                       glamour-0.10.0/ansi/testdata/TestRendererIssues/107.golden000066400000000000000000000071031500000454500232760ustar00rootroot00000000000000                                                                                 [Mount]                                                                       Options=reconnect,ServerAliveInterval=15,ServerAliveCountMax=3,noauto,      _netdev,allow_other,uid=1000,gid=1000,IdentityFile=/PATH/TO/SSH-KEY/id_rsa,   StrictHostKeyChecking=no                                                      glamour-0.10.0/ansi/testdata/TestRendererIssues/117.golden000066400000000000000000000034071500000454500233020ustar00rootroot00000000000000                                                                              cmd │ descr    ─────────────────────────────────────┼────────────────────────────────────    glow config  │ open glow config    glamour-0.10.0/ansi/testdata/TestRendererIssues/149.golden000066400000000000000000000036351500000454500233120ustar00rootroot00000000000000  a http://example.com/with-a-big-path/likely-to-use-more-than-one-line?why-    not=after-all-                                                                why-not-use-queryparams-too&abc=123                                          glamour-0.10.0/ansi/testdata/TestRendererIssues/172.golden000066400000000000000000000070701500000454500233030ustar00rootroot00000000000000                                                                               │ The quick brown fox jumps over the lazy dog. The quick brown fox jumps      over                                                                          │ the lazy dog. The quick brown fox jumps over the lazy dog. The quick brown  │ fox jumps over the lazy dog.                                               glamour-0.10.0/ansi/testdata/TestRendererIssues/237.golden000066400000000000000000000132421500000454500233030ustar00rootroot00000000000000                                                                               │ Content Security Policy (CSP) is an added layer of security that helps to   │ detect and mitigate certain types of attacks, including Cross-Site          │ Scripting                                                                   │ (XSS) and data injection attacks. These attacks are used for everything     │ from data theft, to site defacement, to malware distribution.               │                                                                             │ from MDN                                                                   glamour-0.10.0/ansi/testdata/TestRendererIssues/239.golden000066400000000000000000000166641500000454500233200ustar00rootroot00000000000000                                                                                First term                                                                    🠶 Definition one of first term.                                                                                                                             Second term                                                                   🠶 Definition one of second term.                                                                                                                           glamour-0.10.0/ansi/testdata/TestRendererIssues/257.golden000066400000000000000000000040231500000454500233020ustar00rootroot00000000000000                                                                                 set runtimepath^=$XDG_CONFIG_HOME/vim                                       glamour-0.10.0/ansi/testdata/TestRendererIssues/290.golden000066400000000000000000000074341500000454500233100ustar00rootroot00000000000000                                                                               • test@example.com mailto:test@example.com                                    • https://google.com                                                          • https://google.com                                                         glamour-0.10.0/ansi/testdata/TestRendererIssues/312.golden000066400000000000000000000342671500000454500233070ustar00rootroot00000000000000   File                                                                                                                                                       bold text with URL https://www.example.com                                                                                                                 italic text with URL https://www.example.com                                                                                                               URL https://www.example.com                                                                                                                                url with bold within https://www.example.com                                                                                                               url with italic within https://www.example.com                                                                                                             entire url text is bold https://www.example.com                                                                                                            entire url text is italic https://www.example.com                            glamour-0.10.0/ansi/testdata/TestRendererIssues/313.golden000066400000000000000000000143211500000454500232750ustar00rootroot00000000000000                                                                               │ This is a block quote                                                       │                                                                             │ │ This is the nested quote                                                  │                                                                             │ This is part of the outer block quote.                                     glamour-0.10.0/ansi/testdata/TestRendererIssues/315.golden000066400000000000000000000034511500000454500233010ustar00rootroot00000000000000                                                                              Expression │ Value │ Type    ─────────────────────────────────┼────────────────────┼───────────────────    (1 >= 26) || (12 >= 6) {.java} │ s │ a    glamour-0.10.0/ansi/testdata/TestRendererIssues/316.golden000066400000000000000000000112571500000454500233050ustar00rootroot00000000000000                                                                              A │ B    ─────────────────────────────────────┼────────────────────────────────────   Here[1] │ hello    autolink.com[2] │ world                                                                                   [1]: Here https://example.com                                                 [2]: autolink.com https://autolink.com                                       glamour-0.10.0/ansi/testdata/TestRendererIssues/42.golden000066400000000000000000000045251500000454500232210ustar00rootroot00000000000000  If you want to make a more significant change, please first open an issue     https://github.com/twpayne/chezmoi/issues/new to discuss the change that you  want to make. Dave Cheney gives a good rationale                              https://dave.cheney.net/2019/02/18/talk-then-code as to why this is           important.                                                                   glamour-0.10.0/ansi/testdata/TestRendererIssues/43.golden000066400000000000000000000177711500000454500232310ustar00rootroot00000000000000                                                                               • Getting started                                                             • Developing locally                                                          • Documentation changes                                                       • Contributing changes                                                        • Managing releases                                                           • Packaging                                                                   • Updating the website                                                       glamour-0.10.0/ansi/testdata/TestRendererIssues/44.golden000066400000000000000000000137251500000454500232250ustar00rootroot00000000000000                                                                              Distribution │ Architectures │ Package    ──────────────┼─────────────────────────────────────────────────┼─────────   Debian │  amd64 ,  arm64 ,  armel ,  i386 ,  ppc64 , │ deb[1]    │  ppc64le  │    RedHat │  aarch64 ,  armhfp ,  i686 ,  ppc64 , │ rpm[2]    │  ppc64le ,  x86_64  │    OpenSUSE │  aarch64 ,  armhfp ,  i686 ,  ppc64 , │ rpm[2]    │  ppc64le ,  x86_64  │    Ubuntu │  amd64 ,  arm64 ,  armel ,  i386 ,  ppc64 , │ deb[1]    │  ppc64le  │                                                                                   [1]: deb https://github.com/twpayne/chezmoi/releases/latest                   [2]: rpm https://github.com/twpayne/chezmoi/releases/latest                  glamour-0.10.0/ansi/testdata/TestRendererIssues/46_1.golden000066400000000000000000000100441500000454500234360ustar00rootroot00000000000000                                                                               • Navigation                                                                    • Familiar shortcuts (arrows, ~, -, @), quick reference                                                                                                  glamour-0.10.0/ansi/testdata/TestRendererIssues/46_2.golden000066400000000000000000000161151500000454500234440ustar00rootroot00000000000000                                                                              Dependency │ Install… │ Operation    ─────────────────────────────────────┼──────────┼─────────────────────────   xdg-open (Linux), open(1) (macOS), │ base │ desktop opener    cygstart (Cygwin) │ │    file, coreutils (cp, mv, rm), xargs │ base │ file type, copy, move      │ │ and remove    tar, (un)zip [atool/bsdtar for more │ base │ create, list, extract      formats] │ │ tar, gzip, bzip2, zip    archivemount, fusermount(3) │ optional │ mount, unmount archives    sshfs, rclone[1], fusermount(3) │ optional │ mount, unmount remotes    trash-cli │ optional │ trash files (default      │ │ action: rm)    vlock (Linux), bashlock (macOS), │ optional │ terminal locker      lock(1) (BSD) │ │ (fallback: cmatrix[2])    advcpmv (Linux) (integration[3]) │ optional │ copy, move progress     $VISUAL  (else  $EDITOR ), │ optional │ fallback vi, less, sh     $PAGER ,  $SHELL  │ │                                                                                   [1]: rclone https://rclone.org/                                               [2]: cmatrix https://github.com/abishekvashok/cmatrix                         [3]: integration https://github.com/jarun/nnn/wiki/Advanced-use-cases#show-… glamour-0.10.0/ansi/testdata/TestRendererIssues/47.golden000066400000000000000000000015651500000454500232270ustar00rootroot00000000000000  Example:                                                    glamour-0.10.0/ansi/testdata/TestRendererIssues/48.golden000066400000000000000000000401751500000454500232300ustar00rootroot00000000000000  emoji in text                                                                                                                                              🐙 ⚡ 🐱 = ❤️                                                                                                                                              emoji in header                                                                                                                                             ## 🐙 ⚡ 🐱 = ❤️                                                                                                                                            no emoji in code blocks                                                                                                                                      :octopus: :zap: :cat: = :heart:                                                                                                                           no emoji in inline code                                                                                                                                     :octopus: :zap: :cat: = :heart:                                             glamour-0.10.0/ansi/testdata/TestRendererIssues/493.golden000066400000000000000000000235501500000454500233120ustar00rootroot00000000000000                                                                              Avatar │ Name │ Role │ Handle    ─────────────────────────┼──────────────┼──────────────┼──────────────────   Image: @andreynering[1] │ Andrey │ Engineering │ @andreynering[1]    Image: @aymanbagabas[2] │ Ayman │ Engineering │ @aymanbagabas[2]    Image: @bashbunni[3] │ Bash │ Engineering │ @bashbunni[3]    Image: @caarlos0[4] │ Carlos │ Engineering │ @caarlos0[4]    Image: @meowgorithm[5] │ Christian │ Engineering │ @meowgorithm[5]    Image: @raphamorim[6] │ Rapha │ Product │ @raphamorim[6]                                                                                   [1]: @andreynering https://github.com/andreynering                            [2]: @aymanbagabas https://github.com/aymanbagabas                            [3]: @bashbunni https://github.com/bashbunni                                  [4]: @caarlos0 https://github.com/caarlos0                                    [5]: @meowgorithm https://github.com/meowgorithm                              [6]: @raphamorim https://github.com/raphamorim                                                                                                              [1]: Image: @andreynering → https://avatars.githubusercontent.com/andreyner…  [2]: Image: @aymanbagabas → https://avatars.githubusercontent.com/aymanbaga…  [3]: Image: @bashbunni → https://avatars.githubusercontent.com/bashbunni?s=…  [4]: Image: @caarlos0 → https://avatars.githubusercontent.com/caarlos0?s=80   [5]: Image: @meowgorithm → https://avatars.githubusercontent.com/meowgorith…  [6]: Image: @raphamorim → https://avatars.githubusercontent.com/raphamorim?… glamour-0.10.0/ansi/testdata/TestRendererIssues/60.golden000066400000000000000000000465311500000454500232240ustar00rootroot00000000000000                                                                              Library │ Version    ─────────────────────────────────────┼────────────────────────────────────   ESMF[1] │ v8.6.1    FMS[2] │ 2024.01.02    netCDF[3] │ 4.9.2    netCDF Fortran[4] │ 4.6.1    netCDF C++[5] │ 4.3.1    HDF5[6] │ 1.10.11    HDF4[7] │ 4.2.16-2    GFE[8] │ v1.16.0    xgboost[9] │ v1.6.0    libyaml[10] │ 0.2.5    antlr2[11] │ 2.7.7    GSL[12] │ 2.7    jpeg[13] │ 9e    zlib[14] │ 1.3.1    szip[15] │ 2.1.1    cURL[16] │ 8.8.0    UDUNITS2[17] │ 2.2.28    NCO[18] │ 5.2.6    CDO[19] │ 2.3.0    nccmp[20] │ 1.9.1.0    HDF-EOS2[21] │ 3.0    HDF-EOS5[22] │ 2.0    SDP Toolkit[23] │ 5.2.20                                                                                    [1]: ESMF https://github.com/esmf-org/esmf                                    [2]: FMS https://github.com/NOAA-GFDL/FMS/                                    [3]: netCDF https://github.com/Unidata/netcdf-c                               [4]: netCDF Fortran https://github.com/Unidata/netcdf-fortran                 [5]: netCDF C++ https://github.com/Unidata/netcdf-cxx4                        [6]: HDF5 https://portal.hdfgroup.org/display/support                         [7]: HDF4 https://portal.hdfgroup.org/display/support                         [8]: GFE https://github.com/Goddard-Fortran-Ecosystem/GFE                     [9]: xgboost https://github.com/dmlc/xgboost                                 [10]: libyaml https://github.com/yaml/libyaml.git                             [11]: antlr2 https://www.antlr2.org/                                          [12]: GSL https://www.gnu.org/software/gsl/                                   [13]: jpeg http://www.ijg.org/                                                [14]: zlib http://www.zlib.net/                                               [15]: szip https://support.hdfgroup.org/doc_resource/SZIP/                    [16]: cURL https://curl.haxx.se/                                              [17]: UDUNITS2 https://github.com/GMAO-SI-Team/UDUNITS-2.git                  [18]: NCO http://nco.sourceforge.net/                                         [19]: CDO https://code.mpimet.mpg.de/projects/cdo                             [20]: nccmp https://gitlab.com/remikz/nccmp                                   [21]: HDF-EOS2 https://wiki.earthdata.nasa.gov/display/DAS                    [22]: HDF-EOS5 https://wiki.earthdata.nasa.gov/display/DAS                    [23]: SDP Toolkit https://wiki.earthdata.nasa.gov/display/DAS                glamour-0.10.0/ansi/testdata/TestRendererIssues/79.golden000066400000000000000000000164001500000454500232260ustar00rootroot00000000000000  Preceding blockquote paragraph                                                                                                                             │ 1st blockquote paragraph                                                    │                                                                             │   quoted code block                                                         │                                                                             │ 2nd blockquote paragraph                                                   glamour-0.10.0/examples.sh000077500000000000000000000010511500000454500154010ustar00rootroot00000000000000#!/bin/bash set -e for element in ./styles/examples/*.md; do echo "Generating screenshot for element ${element}" basename="`basename -s .md ${element}`" stylename="${basename}.style" filename="${basename}.png" # take screenshot ./termshot -o ./styles/examples/ -f "$filename" glow -s ./styles/examples/${stylename} ${element} # add border convert -bordercolor black -border 16x16 "./styles/examples/$filename" "./styles/examples/$filename" # optimize filesize pngcrush -ow "./styles/examples/$filename" done glamour-0.10.0/examples/000077500000000000000000000000001500000454500150455ustar00rootroot00000000000000glamour-0.10.0/examples/artichokes/000077500000000000000000000000001500000454500172015ustar00rootroot00000000000000glamour-0.10.0/examples/artichokes/artichokes.md000066400000000000000000000030441500000454500216600ustar00rootroot00000000000000Glamour ======= A casual introduction. 你好世界! ## Let’s talk about artichokes The _artichoke_ is mentioned as a garden plant in the 8th century BC by Homer **and** Hesiod. The naturally occurring variant of the artichoke, the cardoon, which is native to the Mediterranean area, also has records of use as a food among the ancient Greeks and Romans. Pliny the Elder mentioned growing of _carduus_ in Carthage and Cordoba. > He holds him with a skinny hand, > ‘There was a ship,’ quoth he. > ‘Hold off! unhand me, grey-beard loon!’ > An artichoke, dropt he. --Samuel Taylor Coleridge, [The Rime of the Ancient Mariner][rime] [rime]: https://poetryfoundation.org/poems/43997/ ## Other foods worth mentioning 1. Carrots 1. Celery 1. Tacos * Soft * Hard 1. Cucumber ## Things to eat today * [x] Carrots * [x] Ramen * [ ] Currywurst ### Power levels of the aforementioned foods | Name | Power | Comment | | --- | --- | --- | | Carrots | 9001 | It’s over 9000?! | | Ramen | 9002 | Also over 9000?! | | Currywurst | 10000 | What?! | ## Currying Artichokes Here’s a bit of code in [Haskell](https://haskell.org), because we are fancy. Remember that to compile Haskell you’ll need `ghc`. ```haskell module Main where import Data.List (intercalate) hello :: String -> String hello s = "Hello, " <> s <> "." main :: IO () main = putStrLn $ intercalate "\n" $ hello <$> [ "artichoke", "alcachofa" ] ``` *** _Alcachofa_, if you were wondering, is artichoke in Spanish. glamour-0.10.0/examples/artichokes/main.go000066400000000000000000000026631500000454500204630ustar00rootroot00000000000000package main // This example illustrates how to render markdown and downsample colors when // necessary per the detected color profile of the terminal. import ( "bytes" "embed" "fmt" "log" "os" "github.com/charmbracelet/colorprofile" "github.com/charmbracelet/glamour" ) //go:embed artichokes.md var f embed.FS func main() { // Open the file to learn a thing or two about artichokes. f, err := f.Open("artichokes.md") if err != nil { fmt.Fprintf(os.Stderr, "Error opening file: %s\n", err) os.Exit(1) } defer f.Close() // Read the data. var buf bytes.Buffer if _, readErr := buf.ReadFrom(f); readErr != nil { fmt.Fprintf(os.Stderr, "Error reading file: %s\n", readErr) os.Exit(1) } // Create a new colorprofile writer. We'll use it to detect the color // profile and downsample colors when necessary. w := colorprofile.NewWriter(os.Stdout, os.Environ()) // While we're at it, let's jot down the detected color profile in the // markdown output while we're at it. fmt.Fprintf(&buf, "\n\nBy the way, this was rendererd as _%s._\n", w.Profile) // Okay, now let's render some markdown. r, err := glamour.NewTermRenderer(glamour.WithEnvironmentConfig()) if err != nil { log.Fatal(err) } md, err := r.RenderBytes(buf.Bytes()) if err != nil { log.Fatal(err) } // And finally, write it to stdout using the colorprofile writer. This will // ensure colors are downsampled if necessary. fmt.Fprintf(w, "%s\n", md) } glamour-0.10.0/examples/custom_renderer/000077500000000000000000000000001500000454500202455ustar00rootroot00000000000000glamour-0.10.0/examples/custom_renderer/main.go000066400000000000000000000005121500000454500215160ustar00rootroot00000000000000package main import ( "fmt" "github.com/charmbracelet/glamour" ) func main() { in := `# Custom Renderer Word-wrapping will occur when lines exceed the limit of 40 characters. ` r, _ := glamour.NewTermRenderer( glamour.WithStandardStyle("dark"), glamour.WithWordWrap(40), ) out, _ := r.Render(in) fmt.Print(out) } glamour-0.10.0/examples/go.mod000066400000000000000000000023551500000454500161600ustar00rootroot00000000000000module examples go 1.24.0 require ( github.com/charmbracelet/colorprofile v0.2.1 github.com/charmbracelet/glamour v0.8.0 ) require ( github.com/alecthomas/chroma/v2 v2.14.0 // indirect github.com/aymanbagabas/go-osc52/v2 v2.0.1 // indirect github.com/aymerick/douceur v0.2.0 // indirect github.com/charmbracelet/lipgloss v1.0.0 // indirect github.com/charmbracelet/x/ansi v0.8.0 // indirect github.com/charmbracelet/x/term v0.2.1 // indirect github.com/dlclark/regexp2 v1.11.0 // indirect github.com/gorilla/css v1.0.1 // indirect github.com/lucasb-eyer/go-colorful v1.2.0 // indirect github.com/mattn/go-isatty v0.0.20 // indirect github.com/mattn/go-runewidth v0.0.16 // indirect github.com/microcosm-cc/bluemonday v1.0.27 // indirect github.com/muesli/reflow v0.3.0 // indirect github.com/muesli/termenv v0.16.0 // indirect github.com/rivo/uniseg v0.4.7 // indirect github.com/xo/terminfo v0.0.0-20220910002029-abceb7e1c41e // indirect github.com/yuin/goldmark v1.7.8 // indirect github.com/yuin/goldmark-emoji v1.0.5 // indirect golang.org/x/net v0.36.0 // indirect golang.org/x/sys v0.31.0 // indirect golang.org/x/term v0.30.0 // indirect golang.org/x/text v0.23.0 // indirect ) replace github.com/charmbracelet/glamour => ../ glamour-0.10.0/examples/go.sum000066400000000000000000000127721500000454500162110ustar00rootroot00000000000000github.com/alecthomas/assert/v2 v2.7.0 h1:QtqSACNS3tF7oasA8CU6A6sXZSBDqnm7RfpLl9bZqbE= github.com/alecthomas/assert/v2 v2.7.0/go.mod h1:Bze95FyfUr7x34QZrjL+XP+0qgp/zg8yS+TtBj1WA3k= github.com/alecthomas/chroma/v2 v2.14.0 h1:R3+wzpnUArGcQz7fCETQBzO5n9IMNi13iIs46aU4V9E= github.com/alecthomas/chroma/v2 v2.14.0/go.mod h1:QolEbTfmUHIMVpBqxeDnNBj2uoeI4EbYP4i6n68SG4I= github.com/alecthomas/repr v0.4.0 h1:GhI2A8MACjfegCPVq9f1FLvIBS+DrQ2KQBFZP1iFzXc= github.com/alecthomas/repr v0.4.0/go.mod h1:Fr0507jx4eOXV7AlPV6AVZLYrLIuIeSOWtW57eE/O/4= github.com/aymanbagabas/go-osc52/v2 v2.0.1 h1:HwpRHbFMcZLEVr42D4p7XBqjyuxQH5SMiErDT4WkJ2k= github.com/aymanbagabas/go-osc52/v2 v2.0.1/go.mod h1:uYgXzlJ7ZpABp8OJ+exZzJJhRNQ2ASbcXHWsFqH8hp8= github.com/aymanbagabas/go-udiff v0.2.0 h1:TK0fH4MteXUDspT88n8CKzvK0X9O2xu9yQjWpi6yML8= github.com/aymanbagabas/go-udiff v0.2.0/go.mod h1:RE4Ex0qsGkTAJoQdQQCA0uG+nAzJO/pI/QwceO5fgrA= github.com/aymerick/douceur v0.2.0 h1:Mv+mAeH1Q+n9Fr+oyamOlAkUNPWPlA8PPGR0QAaYuPk= github.com/aymerick/douceur v0.2.0/go.mod h1:wlT5vV2O3h55X9m7iVYN0TBM0NH/MmbLnd30/FjWUq4= github.com/charmbracelet/colorprofile v0.2.1 h1:McnsQTrDVGWyjar35VdXQtDWtx0aVDTMfRcospsvHrk= github.com/charmbracelet/colorprofile v0.2.1/go.mod h1:X4/0JoqgTIPSFcRA/P6INZzIuyqdFY5rm8tb41s9okk= github.com/charmbracelet/lipgloss v1.0.0 h1:O7VkGDvqEdGi93X+DeqsQ7PKHDgtQfF8j8/O2qFMQNg= github.com/charmbracelet/lipgloss v1.0.0/go.mod h1:U5fy9Z+C38obMs+T+tJqst9VGzlOYGj4ri9reL3qUlo= github.com/charmbracelet/x/ansi v0.8.0 h1:9GTq3xq9caJW8ZrBTe0LIe2fvfLR/bYXKTx2llXn7xE= github.com/charmbracelet/x/ansi v0.8.0/go.mod h1:wdYl/ONOLHLIVmQaxbIYEC/cRKOQyjTkowiI4blgS9Q= github.com/charmbracelet/x/exp/golden v0.0.0-20240806155701-69247e0abc2a h1:G99klV19u0QnhiizODirwVksQB91TJKV/UaTnACcG30= github.com/charmbracelet/x/exp/golden v0.0.0-20240806155701-69247e0abc2a/go.mod h1:wDlXFlCrmJ8J+swcL/MnGUuYnqgQdW9rhSD61oNMb6U= github.com/charmbracelet/x/term v0.2.1 h1:AQeHeLZ1OqSXhrAWpYUtZyX1T3zVxfpZuEQMIQaGIAQ= github.com/charmbracelet/x/term v0.2.1/go.mod h1:oQ4enTYFV7QN4m0i9mzHrViD7TQKvNEEkHUMCmsxdUg= github.com/dlclark/regexp2 v1.11.0 h1:G/nrcoOa7ZXlpoa/91N3X7mM3r8eIlMBBJZvsz/mxKI= github.com/dlclark/regexp2 v1.11.0/go.mod h1:DHkYz0B9wPfa6wondMfaivmHpzrQ3v9q8cnmRbL6yW8= github.com/gorilla/css v1.0.1 h1:ntNaBIghp6JmvWnxbZKANoLyuXTPZ4cAMlo6RyhlbO8= github.com/gorilla/css v1.0.1/go.mod h1:BvnYkspnSzMmwRK+b8/xgNPLiIuNZr6vbZBTPQ2A3b0= github.com/hexops/gotextdiff v1.0.3 h1:gitA9+qJrrTCsiCl7+kh75nPqQt1cx4ZkudSTLoUqJM= github.com/hexops/gotextdiff v1.0.3/go.mod h1:pSWU5MAI3yDq+fZBTazCSJysOMbxWL1BSow5/V2vxeg= github.com/lucasb-eyer/go-colorful v1.2.0 h1:1nnpGOrhyZZuNyfu1QjKiUICQ74+3FNCN69Aj6K7nkY= github.com/lucasb-eyer/go-colorful v1.2.0/go.mod h1:R4dSotOR9KMtayYi1e77YzuveK+i7ruzyGqttikkLy0= github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY= github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y= github.com/mattn/go-runewidth v0.0.12/go.mod h1:RAqKPSqVFrSLVXbA8x7dzmKdmGzieGRCM46jaSJTDAk= github.com/mattn/go-runewidth v0.0.16 h1:E5ScNMtiwvlvB5paMFdw9p4kSQzbXFikJ5SQO6TULQc= github.com/mattn/go-runewidth v0.0.16/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w= github.com/microcosm-cc/bluemonday v1.0.27 h1:MpEUotklkwCSLeH+Qdx1VJgNqLlpY2KXwXFM08ygZfk= github.com/microcosm-cc/bluemonday v1.0.27/go.mod h1:jFi9vgW+H7c3V0lb6nR74Ib/DIB5OBs92Dimizgw2cA= github.com/muesli/reflow v0.3.0 h1:IFsN6K9NfGtjeggFP+68I4chLZV2yIKsXJFNZ+eWh6s= github.com/muesli/reflow v0.3.0/go.mod h1:pbwTDkVPibjO2kyvBQRBxTWEEGDGq0FlB1BIKtnHY/8= github.com/muesli/termenv v0.16.0 h1:S5AlUN9dENB57rsbnkPyfdGuWIlkmzJjbFf0Tf5FWUc= github.com/muesli/termenv v0.16.0/go.mod h1:ZRfOIKPFDYQoDFF4Olj7/QJbW60Ol/kL1pU3VfY/Cnk= github.com/rivo/uniseg v0.1.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc= github.com/rivo/uniseg v0.2.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc= github.com/rivo/uniseg v0.4.7 h1:WUdvkW8uEhrYfLC4ZzdpI2ztxP1I582+49Oc5Mq64VQ= github.com/rivo/uniseg v0.4.7/go.mod h1:FN3SvrM+Zdj16jyLfmOkMNblXMcoc8DfTHruCPUcx88= github.com/xo/terminfo v0.0.0-20220910002029-abceb7e1c41e h1:JVG44RsyaB9T2KIHavMF/ppJZNG9ZpyihvCd0w101no= github.com/xo/terminfo v0.0.0-20220910002029-abceb7e1c41e/go.mod h1:RbqR21r5mrJuqunuUZ/Dhy/avygyECGrLceyNeo4LiM= github.com/yuin/goldmark v1.7.1/go.mod h1:uzxRWxtg69N339t3louHJ7+O03ezfj6PlliRlaOzY1E= github.com/yuin/goldmark v1.7.8 h1:iERMLn0/QJeHFhxSt3p6PeN9mGnvIKSpG9YYorDMnic= github.com/yuin/goldmark v1.7.8/go.mod h1:uzxRWxtg69N339t3louHJ7+O03ezfj6PlliRlaOzY1E= github.com/yuin/goldmark-emoji v1.0.5 h1:EMVWyCGPlXJfUXBXpuMu+ii3TIaxbVBnEX9uaDC4cIk= github.com/yuin/goldmark-emoji v1.0.5/go.mod h1:tTkZEbwu5wkPmgTcitqddVxY9osFZiavD+r4AzQrh1U= golang.org/x/exp v0.0.0-20220909182711-5c715a9e8561 h1:MDc5xs78ZrZr3HMQugiXOAkSZtfTpbJLDr/lwfgO53E= golang.org/x/exp v0.0.0-20220909182711-5c715a9e8561/go.mod h1:cyybsKvd6eL0RnXn6p/Grxp8F5bW7iYuBgsNCOHpMYE= golang.org/x/net v0.36.0 h1:vWF2fRbw4qslQsQzgFqZff+BItCvGFQqKzKIzx1rmoA= golang.org/x/net v0.36.0/go.mod h1:bFmbeoIPfrw4sMHNhb4J9f6+tPziuGjq7Jk/38fxi1I= golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.31.0 h1:ioabZlmFYtWhL+TRYpcnNlLwhyxaM9kWTDEmfnprqik= golang.org/x/sys v0.31.0/go.mod h1:BJP2sWEmIv4KK5OTEluFJCKSidICx8ciO85XgH3Ak8k= golang.org/x/term v0.30.0 h1:PQ39fJZ+mfadBm0y5WlL4vlM7Sx1Hgf13sMIY2+QS9Y= golang.org/x/term v0.30.0/go.mod h1:NYYFdzHoI5wRh/h5tDMdMqCqPJZEuNqVR5xJLd/n67g= golang.org/x/text v0.23.0 h1:D71I7dUrlY+VX0gQShAThNGHFxZ13dGLBHQLVl1mJlY= golang.org/x/text v0.23.0/go.mod h1:/BLNzu4aZCJ1+kcD0DNRotWKage4q2rGVAg4o22unh4= glamour-0.10.0/examples/helloworld/000077500000000000000000000000001500000454500172205ustar00rootroot00000000000000glamour-0.10.0/examples/helloworld/helloworld.png000066400000000000000000000002021500000454500220730ustar00rootroot00000000000000version https://git-lfs.github.com/spec/v1 oid sha256:f3cca796748c2afb8efda09946e14544f6a3f6ac424a502a905e51fc3849e750 size 28657 glamour-0.10.0/examples/helloworld/main.go000066400000000000000000000005141500000454500204730ustar00rootroot00000000000000package main import ( "fmt" "github.com/charmbracelet/glamour" ) func main() { in := `# Hello World This is a simple example of Markdown rendering with Glamour! Check out the [other examples](https://github.com/charmbracelet/glamour/tree/master/examples) too. Bye! ` out, _ := glamour.Render(in, "dark") fmt.Print(out) } glamour-0.10.0/examples/stdin-stdout-custom-styles/000077500000000000000000000000001500000454500223375ustar00rootroot00000000000000glamour-0.10.0/examples/stdin-stdout-custom-styles/main.go000066400000000000000000000015541500000454500236170ustar00rootroot00000000000000package main // A simple example that renders input through a pipe. // // Usage: // echo "# Hello, world!" | go run main.go // // cat README.md | go run main.go // // go run main.go < README.md import ( "fmt" "io" "os" "github.com/charmbracelet/glamour" ) const defaultWidth = 80 func main() { // Read from stdin. in, err := io.ReadAll(os.Stdin) if err != nil { fmt.Fprintf(os.Stderr, "Error reading stdin: %s\n", err) } // Create a new renderer. r, err := glamour.NewTermRenderer( glamour.WithEnvironmentConfig(), glamour.WithWordWrap(defaultWidth), ) if err != nil { fmt.Fprintf(os.Stderr, "Error creating renderer: %s\n", err) } // Render markdown. md, err := r.RenderBytes(in) if err != nil { fmt.Fprintf(os.Stderr, "Error rendering markdown: %s\n", err) } // Write markdown to stdout. fmt.Fprintf(os.Stdout, "%s\n", md) } glamour-0.10.0/examples/stdin-stdout/000077500000000000000000000000001500000454500175065ustar00rootroot00000000000000glamour-0.10.0/examples/stdin-stdout/main.go000066400000000000000000000015441500000454500207650ustar00rootroot00000000000000package main // A simple example that renders input through a pipe. // // Usage: // echo "# Hello, world!" | go run main.go // // cat README.md | go run main.go // // go run main.go < README.md import ( "fmt" "io" "os" "github.com/charmbracelet/glamour" ) const defaultWidth = 80 func main() { // Read from stdin. in, err := io.ReadAll(os.Stdin) if err != nil { fmt.Fprintf(os.Stderr, "Error reading stdin: %s\n", err) } // Create a new renderer. r, err := glamour.NewTermRenderer( glamour.WithAutoStyle(), glamour.WithWordWrap(defaultWidth), ) if err != nil { fmt.Fprintf(os.Stderr, "Error creating renderer: %s\n", err) } // Render markdown. md, err := r.RenderBytes(in) if err != nil { fmt.Fprintf(os.Stderr, "Error rendering markdown: %s\n", err) } // Write markdown to stdout. fmt.Fprintf(os.Stdout, "%s\n", md) } glamour-0.10.0/gallery.sh000077500000000000000000000013571500000454500152330ustar00rootroot00000000000000#!/bin/bash if ! command -v freeze &> /dev/null; then echo "freeze not found. Please install freeze to capture images." echo "https://github.com/charmbracelet/freeze/" exit 1 fi defaultStyles=("ascii" "auto" "dark" "dracula" "light" "notty" "pink") for style in "${defaultStyles[@]}"; do echo "Generating screenshot for ${style}" # take screenshot if [[ $style == *"light"* ]]; then # Provide a light background to images freeze -x "go run ./examples/artichokes ${style}" -b "#FAFAFA" -o "./styles/gallery/${style}.png" else freeze -x "go run ./examples/artichokes ${style}" -o "./styles/gallery/${style}.png" fi # optimize filesize pngcrush -ow "./styles/gallery/$style.png" done glamour-0.10.0/glamour.go000066400000000000000000000210341500000454500152240ustar00rootroot00000000000000// Package glamour lets you render markdown documents & templates on ANSI // compatible terminals. You can create your own stylesheet or simply use one of // the stylish defaults package glamour import ( "bytes" "encoding/json" "fmt" "io" "os" "github.com/muesli/termenv" "github.com/yuin/goldmark" emoji "github.com/yuin/goldmark-emoji" "github.com/yuin/goldmark/extension" "github.com/yuin/goldmark/parser" "github.com/yuin/goldmark/renderer" "github.com/yuin/goldmark/util" "golang.org/x/term" "github.com/charmbracelet/glamour/ansi" styles "github.com/charmbracelet/glamour/styles" ) const ( defaultWidth = 80 highPriority = 1000 ) // A TermRendererOption sets an option on a TermRenderer. type TermRendererOption func(*TermRenderer) error // TermRenderer can be used to render markdown content, posing a depth of // customization and styles to fit your needs. type TermRenderer struct { md goldmark.Markdown ansiOptions ansi.Options buf bytes.Buffer renderBuf bytes.Buffer } // Render initializes a new TermRenderer and renders a markdown with a specific // style. func Render(in string, stylePath string) (string, error) { b, err := RenderBytes([]byte(in), stylePath) return string(b), err } // RenderWithEnvironmentConfig initializes a new TermRenderer and renders a // markdown with a specific style defined by the GLAMOUR_STYLE environment variable. func RenderWithEnvironmentConfig(in string) (string, error) { b, err := RenderBytes([]byte(in), getEnvironmentStyle()) return string(b), err } // RenderBytes initializes a new TermRenderer and renders a markdown with a // specific style. func RenderBytes(in []byte, stylePath string) ([]byte, error) { r, err := NewTermRenderer( WithStylePath(stylePath), ) if err != nil { return nil, err } return r.RenderBytes(in) } // NewTermRenderer returns a new TermRenderer the given options. func NewTermRenderer(options ...TermRendererOption) (*TermRenderer, error) { tr := &TermRenderer{ md: goldmark.New( goldmark.WithExtensions( extension.GFM, extension.DefinitionList, ), goldmark.WithParserOptions( parser.WithAutoHeadingID(), ), ), ansiOptions: ansi.Options{ WordWrap: defaultWidth, ColorProfile: termenv.TrueColor, }, } for _, o := range options { if err := o(tr); err != nil { return nil, err } } ar := ansi.NewRenderer(tr.ansiOptions) tr.md.SetRenderer( renderer.NewRenderer( renderer.WithNodeRenderers( util.Prioritized(ar, highPriority), ), ), ) return tr, nil } // WithBaseURL sets a TermRenderer's base URL. func WithBaseURL(baseURL string) TermRendererOption { return func(tr *TermRenderer) error { tr.ansiOptions.BaseURL = baseURL return nil } } // WithColorProfile sets the TermRenderer's color profile // (TrueColor / ANSI256 / ANSI). func WithColorProfile(profile termenv.Profile) TermRendererOption { return func(tr *TermRenderer) error { tr.ansiOptions.ColorProfile = profile return nil } } // WithStandardStyle sets a TermRenderer's styles with a standard (builtin) // style. func WithStandardStyle(style string) TermRendererOption { return func(tr *TermRenderer) error { styles, err := getDefaultStyle(style) if err != nil { return err } tr.ansiOptions.Styles = *styles return nil } } // WithAutoStyle sets a TermRenderer's styles with either the standard dark // or light style, depending on the terminal's background color at run-time. func WithAutoStyle() TermRendererOption { return WithStandardStyle(styles.AutoStyle) } // WithEnvironmentConfig sets a TermRenderer's styles based on the // GLAMOUR_STYLE environment variable. func WithEnvironmentConfig() TermRendererOption { return WithStylePath(getEnvironmentStyle()) } // WithStylePath sets a TermRenderer's style from stylePath. stylePath is first // interpreted as a filename. If no such file exists, it is re-interpreted as a // standard style. func WithStylePath(stylePath string) TermRendererOption { return func(tr *TermRenderer) error { styles, err := getDefaultStyle(stylePath) if err != nil { jsonBytes, err := os.ReadFile(stylePath) if err != nil { return fmt.Errorf("glamour: error reading file: %w", err) } return json.Unmarshal(jsonBytes, &tr.ansiOptions.Styles) } tr.ansiOptions.Styles = *styles return nil } } // WithStyles sets a TermRenderer's styles. func WithStyles(styles ansi.StyleConfig) TermRendererOption { return func(tr *TermRenderer) error { tr.ansiOptions.Styles = styles return nil } } // WithStylesFromJSONBytes sets a TermRenderer's styles by parsing styles from // jsonBytes. func WithStylesFromJSONBytes(jsonBytes []byte) TermRendererOption { return func(tr *TermRenderer) error { return json.Unmarshal(jsonBytes, &tr.ansiOptions.Styles) } } // WithStylesFromJSONFile sets a TermRenderer's styles from a JSON file. func WithStylesFromJSONFile(filename string) TermRendererOption { return func(tr *TermRenderer) error { jsonBytes, err := os.ReadFile(filename) if err != nil { return fmt.Errorf("glamour: error reading file: %w", err) } return json.Unmarshal(jsonBytes, &tr.ansiOptions.Styles) } } // WithWordWrap sets a TermRenderer's word wrap. func WithWordWrap(wordWrap int) TermRendererOption { return func(tr *TermRenderer) error { tr.ansiOptions.WordWrap = wordWrap return nil } } // WithTableWrap controls whether table content will wrap if too long. // This is true by default. If false, table content will be truncated with an // ellipsis if too long to fit. func WithTableWrap(tableWrap bool) TermRendererOption { return func(tr *TermRenderer) error { tr.ansiOptions.TableWrap = &tableWrap return nil } } // WithInlineTableLinks forces tables to render links inline. By default,links // are rendered as a list of links at the bottom of the table. func WithInlineTableLinks(inlineTableLinks bool) TermRendererOption { return func(tr *TermRenderer) error { tr.ansiOptions.InlineTableLinks = inlineTableLinks return nil } } // WithPreservedNewLines preserves newlines from being replaced. func WithPreservedNewLines() TermRendererOption { return func(tr *TermRenderer) error { tr.ansiOptions.PreserveNewLines = true return nil } } // WithEmoji sets a TermRenderer's emoji rendering. func WithEmoji() TermRendererOption { return func(tr *TermRenderer) error { emoji.New().Extend(tr.md) return nil } } // WithChromaFormatter sets a TermRenderer's chroma formatter used for code blocks. func WithChromaFormatter(formatter string) TermRendererOption { return func(tr *TermRenderer) error { tr.ansiOptions.ChromaFormatter = formatter return nil } } // WithOptions sets multiple TermRenderer options within a single TermRendererOption. func WithOptions(options ...TermRendererOption) TermRendererOption { return func(tr *TermRenderer) error { for _, o := range options { if err := o(tr); err != nil { return err } } return nil } } func (tr *TermRenderer) Read(b []byte) (int, error) { n, err := tr.renderBuf.Read(b) if err == io.EOF { return n, io.EOF } if err != nil { return 0, fmt.Errorf("glamour: error reading from buffer: %w", err) } return n, nil } func (tr *TermRenderer) Write(b []byte) (int, error) { n, err := tr.buf.Write(b) if err != nil { return 0, fmt.Errorf("glamour: error writing bytes: %w", err) } return n, nil } // Close must be called after writing to TermRenderer. You can then retrieve // the rendered markdown by calling Read. func (tr *TermRenderer) Close() error { err := tr.md.Convert(tr.buf.Bytes(), &tr.renderBuf) if err != nil { return fmt.Errorf("glamour: error converting markdown: %w", err) } tr.buf.Reset() return nil } // Render returns the markdown rendered into a string. func (tr *TermRenderer) Render(in string) (string, error) { b, err := tr.RenderBytes([]byte(in)) return string(b), err } // RenderBytes returns the markdown rendered into a byte slice. func (tr *TermRenderer) RenderBytes(in []byte) ([]byte, error) { var buf bytes.Buffer err := tr.md.Convert(in, &buf) return buf.Bytes(), err } func getEnvironmentStyle() string { glamourStyle := os.Getenv("GLAMOUR_STYLE") if len(glamourStyle) == 0 { glamourStyle = styles.AutoStyle } return glamourStyle } func getDefaultStyle(style string) (*ansi.StyleConfig, error) { if style == styles.AutoStyle { if !term.IsTerminal(int(os.Stdout.Fd())) { return &styles.NoTTYStyleConfig, nil } if termenv.HasDarkBackground() { return &styles.DarkStyleConfig, nil } return &styles.LightStyleConfig, nil } styles, ok := styles.DefaultStyles[style] if !ok { return nil, fmt.Errorf("%s: style not found", style) } return styles, nil } glamour-0.10.0/glamour_test.go000066400000000000000000000143341500000454500162700ustar00rootroot00000000000000package glamour import ( "bytes" "errors" "fmt" "io" "os" "regexp" "strings" "testing" "github.com/charmbracelet/glamour/styles" "github.com/charmbracelet/x/exp/golden" ) const markdown = "testdata/readme.markdown.in" func TestTermRendererWriter(t *testing.T) { r, err := NewTermRenderer( WithStandardStyle(styles.DarkStyle), ) if err != nil { t.Fatal(err) } in, err := os.ReadFile(markdown) if err != nil { t.Fatal(err) } _, err = r.Write(in) if err != nil { t.Fatal(err) } err = r.Close() if err != nil { t.Fatal(err) } b, err := io.ReadAll(r) if err != nil { t.Fatal(err) } golden.RequireEqual(t, b) } func TestTermRenderer(t *testing.T) { r, err := NewTermRenderer( WithStandardStyle("dark"), ) if err != nil { t.Fatal(err) } in, err := os.ReadFile(markdown) if err != nil { t.Fatal(err) } b, err := r.Render(string(in)) if err != nil { t.Fatal(err) } golden.RequireEqual(t, []byte(b)) } func TestWithEmoji(t *testing.T) { r, err := NewTermRenderer( WithEmoji(), ) if err != nil { t.Fatal(err) } b, err := r.Render(":+1:") if err != nil { t.Fatal(err) } b = strings.TrimSpace(b) // Thumbs up unicode character td := "\U0001f44d" if td != b { t.Errorf("Rendered output doesn't match!\nExpected: `\n%s`\nGot: `\n%s`\n", td, b) } } func TestWithPreservedNewLines(t *testing.T) { r, err := NewTermRenderer( WithPreservedNewLines(), ) if err != nil { t.Fatal(err) } in, err := os.ReadFile("testdata/preserved_newline.in") if err != nil { t.Fatal(err) } b, err := r.Render(string(in)) if err != nil { t.Fatal(err) } golden.RequireEqual(t, []byte(b)) } func TestStyles(t *testing.T) { _, err := NewTermRenderer( WithAutoStyle(), ) if err != nil { t.Fatal(err) } _, err = NewTermRenderer( WithStandardStyle(styles.AutoStyle), ) if err != nil { t.Fatal(err) } _, err = NewTermRenderer( WithEnvironmentConfig(), ) if err != nil { t.Fatal(err) } } // TestCustomStyle checks the expected errors with custom styling. We need to // support built-in styles and custom style sheets. func TestCustomStyle(t *testing.T) { md := "testdata/example.md" tests := []struct { name string stylePath string err error expected string }{ {name: "style exists", stylePath: "testdata/custom.style", err: nil, expected: "testdata/custom.style"}, {name: "style doesn't exist", stylePath: "testdata/notfound.style", err: os.ErrNotExist, expected: styles.AutoStyle}, {name: "style is empty", stylePath: "", err: nil, expected: styles.AutoStyle}, } for _, tc := range tests { t.Run(tc.name, func(t *testing.T) { t.Setenv("GLAMOUR_STYLE", tc.stylePath) g, err := NewTermRenderer( WithEnvironmentConfig(), ) if !errors.Is(err, tc.err) { t.Fatal(err) } if !errors.Is(tc.err, os.ErrNotExist) { w, err := NewTermRenderer(WithStylePath(tc.expected)) if err != nil { t.Fatal(err) } text, _ := os.ReadFile(md) want, err := w.RenderBytes(text) got, err := g.RenderBytes(text) if !bytes.Equal(want, got) { t.Error("Wrong style used") } } }) } } func TestRenderHelpers(t *testing.T) { in, err := os.ReadFile(markdown) if err != nil { t.Fatal(err) } b, err := Render(string(in), "dark") if err != nil { t.Error(err) } golden.RequireEqual(t, []byte(b)) } func TestCapitalization(t *testing.T) { p := true style := styles.DarkStyleConfig style.H1.Upper = &p style.H2.Title = &p style.H3.Lower = &p r, err := NewTermRenderer( WithStyles(style), ) if err != nil { t.Fatal(err) } b, err := r.Render("# everything is uppercase\n## everything is titled\n### everything is lowercase") if err != nil { t.Fatal(err) } golden.RequireEqual(t, []byte(b)) } func FuzzData(f *testing.F) { f.Fuzz(func(t *testing.T, data []byte) { func() int { _, err := RenderBytes(data, styles.DarkStyle) if err != nil { return 0 } return 1 }() }) } func TestTableAscii(t *testing.T) { markdown := strings.TrimSpace(` | Header A | Header B | | --------- | --------- | | Cell 1 | Cell 2 | | Cell 3 | Cell 4 | | Cell 5 | Cell 6 | `) renderer, err := NewTermRenderer( WithStyles(styles.ASCIIStyleConfig), WithWordWrap(80), ) if err != nil { t.Fatal(err) } result, err := renderer.Render(markdown) if err != nil { t.Fatal(err) } nonAsciiRegexp := regexp.MustCompile(`[^\x00-\x7f]+`) nonAsciiChars := nonAsciiRegexp.FindAllString(result, -1) if len(nonAsciiChars) > 0 { t.Errorf("Non-ASCII characters found in output: %v", nonAsciiChars) } } func ExampleASCIIStyleConfig() { markdown := strings.TrimSpace(` | Header A | Header B | | --------- | --------- | | Cell 1 | Cell 2 | | Cell 3 | Cell 4 | | Cell 5 | Cell 6 | `) renderer, err := NewTermRenderer( WithStyles(styles.ASCIIStyleConfig), WithWordWrap(80), ) if err != nil { return } result, err := renderer.Render(markdown) if err != nil { return } result = strings.ReplaceAll(result, " ", ".") fmt.Println(result) // Output: // .............................................................................. // ...Header.A............................|.Header.B............................. // ..-------------------------------------|------------------------------------.. // ...Cell.1..............................|.Cell.2............................... // ...Cell.3..............................|.Cell.4............................... // ...Cell.5..............................|.Cell.6............................... } func TestWithChromaFormatterDefault(t *testing.T) { r, err := NewTermRenderer( WithStandardStyle(styles.DarkStyle), ) if err != nil { t.Fatal(err) } in, err := os.ReadFile("testdata/TestWithChromaFormatter.md") if err != nil { t.Fatal(err) } b, err := r.Render(string(in)) if err != nil { t.Fatal(err) } golden.RequireEqual(t, []byte(b)) } func TestWithChromaFormatterCustom(t *testing.T) { r, err := NewTermRenderer( WithStandardStyle(styles.DarkStyle), WithChromaFormatter("terminal16"), ) if err != nil { t.Fatal(err) } in, err := os.ReadFile("testdata/TestWithChromaFormatter.md") if err != nil { t.Fatal(err) } b, err := r.Render(string(in)) if err != nil { t.Fatal(err) } golden.RequireEqual(t, []byte(b)) } glamour-0.10.0/go.mod000066400000000000000000000026171500000454500143430ustar00rootroot00000000000000module github.com/charmbracelet/glamour go 1.23.0 toolchain go1.23.7 require ( github.com/alecthomas/chroma/v2 v2.14.0 github.com/charmbracelet/lipgloss v1.1.1-0.20250404203927-76690c660834 github.com/charmbracelet/x/ansi v0.8.0 github.com/charmbracelet/x/exp/golden v0.0.0-20240806155701-69247e0abc2a github.com/charmbracelet/x/exp/slice v0.0.0-20250327172914-2fdc97757edf github.com/microcosm-cc/bluemonday v1.0.27 github.com/muesli/reflow v0.3.0 github.com/muesli/termenv v0.16.0 github.com/yuin/goldmark v1.7.8 github.com/yuin/goldmark-emoji v1.0.5 golang.org/x/term v0.31.0 golang.org/x/text v0.24.0 ) require ( github.com/aymanbagabas/go-osc52/v2 v2.0.1 // indirect github.com/aymanbagabas/go-udiff v0.2.0 // indirect github.com/aymerick/douceur v0.2.0 // indirect github.com/charmbracelet/colorprofile v0.2.3-0.20250311203215-f60798e515dc // indirect github.com/charmbracelet/x/cellbuf v0.0.13 // indirect github.com/charmbracelet/x/term v0.2.1 // indirect github.com/dlclark/regexp2 v1.11.0 // indirect github.com/gorilla/css v1.0.1 // indirect github.com/lucasb-eyer/go-colorful v1.2.0 // indirect github.com/mattn/go-isatty v0.0.20 // indirect github.com/mattn/go-runewidth v0.0.16 // indirect github.com/rivo/uniseg v0.4.7 // indirect github.com/xo/terminfo v0.0.0-20220910002029-abceb7e1c41e // indirect golang.org/x/net v0.33.0 // indirect golang.org/x/sys v0.32.0 // indirect ) glamour-0.10.0/go.sum000066400000000000000000000140461500000454500143670ustar00rootroot00000000000000github.com/alecthomas/assert/v2 v2.7.0 h1:QtqSACNS3tF7oasA8CU6A6sXZSBDqnm7RfpLl9bZqbE= github.com/alecthomas/assert/v2 v2.7.0/go.mod h1:Bze95FyfUr7x34QZrjL+XP+0qgp/zg8yS+TtBj1WA3k= github.com/alecthomas/chroma/v2 v2.14.0 h1:R3+wzpnUArGcQz7fCETQBzO5n9IMNi13iIs46aU4V9E= github.com/alecthomas/chroma/v2 v2.14.0/go.mod h1:QolEbTfmUHIMVpBqxeDnNBj2uoeI4EbYP4i6n68SG4I= github.com/alecthomas/repr v0.4.0 h1:GhI2A8MACjfegCPVq9f1FLvIBS+DrQ2KQBFZP1iFzXc= github.com/alecthomas/repr v0.4.0/go.mod h1:Fr0507jx4eOXV7AlPV6AVZLYrLIuIeSOWtW57eE/O/4= github.com/aymanbagabas/go-osc52/v2 v2.0.1 h1:HwpRHbFMcZLEVr42D4p7XBqjyuxQH5SMiErDT4WkJ2k= github.com/aymanbagabas/go-osc52/v2 v2.0.1/go.mod h1:uYgXzlJ7ZpABp8OJ+exZzJJhRNQ2ASbcXHWsFqH8hp8= github.com/aymanbagabas/go-udiff v0.2.0 h1:TK0fH4MteXUDspT88n8CKzvK0X9O2xu9yQjWpi6yML8= github.com/aymanbagabas/go-udiff v0.2.0/go.mod h1:RE4Ex0qsGkTAJoQdQQCA0uG+nAzJO/pI/QwceO5fgrA= github.com/aymerick/douceur v0.2.0 h1:Mv+mAeH1Q+n9Fr+oyamOlAkUNPWPlA8PPGR0QAaYuPk= github.com/aymerick/douceur v0.2.0/go.mod h1:wlT5vV2O3h55X9m7iVYN0TBM0NH/MmbLnd30/FjWUq4= github.com/charmbracelet/colorprofile v0.2.3-0.20250311203215-f60798e515dc h1:4pZI35227imm7yK2bGPcfpFEmuY1gc2YSTShr4iJBfs= github.com/charmbracelet/colorprofile v0.2.3-0.20250311203215-f60798e515dc/go.mod h1:X4/0JoqgTIPSFcRA/P6INZzIuyqdFY5rm8tb41s9okk= github.com/charmbracelet/lipgloss v1.1.1-0.20250404203927-76690c660834 h1:ZR7e0ro+SZZiIZD7msJyA+NjkCNNavuiPBLgerbOziE= github.com/charmbracelet/lipgloss v1.1.1-0.20250404203927-76690c660834/go.mod h1:aKC/t2arECF6rNOnaKaVU6y4t4ZeHQzqfxedE/VkVhA= github.com/charmbracelet/x/ansi v0.8.0 h1:9GTq3xq9caJW8ZrBTe0LIe2fvfLR/bYXKTx2llXn7xE= github.com/charmbracelet/x/ansi v0.8.0/go.mod h1:wdYl/ONOLHLIVmQaxbIYEC/cRKOQyjTkowiI4blgS9Q= github.com/charmbracelet/x/cellbuf v0.0.13 h1:/KBBKHuVRbq1lYx5BzEHBAFBP8VcQzJejZ/IA3iR28k= github.com/charmbracelet/x/cellbuf v0.0.13/go.mod h1:xe0nKWGd3eJgtqZRaN9RjMtK7xUYchjzPr7q6kcvCCs= github.com/charmbracelet/x/exp/golden v0.0.0-20240806155701-69247e0abc2a h1:G99klV19u0QnhiizODirwVksQB91TJKV/UaTnACcG30= github.com/charmbracelet/x/exp/golden v0.0.0-20240806155701-69247e0abc2a/go.mod h1:wDlXFlCrmJ8J+swcL/MnGUuYnqgQdW9rhSD61oNMb6U= github.com/charmbracelet/x/exp/slice v0.0.0-20250327172914-2fdc97757edf h1:rLG0Yb6MQSDKdB52aGX55JT1oi0P0Kuaj7wi1bLUpnI= github.com/charmbracelet/x/exp/slice v0.0.0-20250327172914-2fdc97757edf/go.mod h1:B3UgsnsBZS/eX42BlaNiJkD1pPOUa+oF1IYC6Yd2CEU= github.com/charmbracelet/x/term v0.2.1 h1:AQeHeLZ1OqSXhrAWpYUtZyX1T3zVxfpZuEQMIQaGIAQ= github.com/charmbracelet/x/term v0.2.1/go.mod h1:oQ4enTYFV7QN4m0i9mzHrViD7TQKvNEEkHUMCmsxdUg= github.com/dlclark/regexp2 v1.11.0 h1:G/nrcoOa7ZXlpoa/91N3X7mM3r8eIlMBBJZvsz/mxKI= github.com/dlclark/regexp2 v1.11.0/go.mod h1:DHkYz0B9wPfa6wondMfaivmHpzrQ3v9q8cnmRbL6yW8= github.com/gorilla/css v1.0.1 h1:ntNaBIghp6JmvWnxbZKANoLyuXTPZ4cAMlo6RyhlbO8= github.com/gorilla/css v1.0.1/go.mod h1:BvnYkspnSzMmwRK+b8/xgNPLiIuNZr6vbZBTPQ2A3b0= github.com/hexops/gotextdiff v1.0.3 h1:gitA9+qJrrTCsiCl7+kh75nPqQt1cx4ZkudSTLoUqJM= github.com/hexops/gotextdiff v1.0.3/go.mod h1:pSWU5MAI3yDq+fZBTazCSJysOMbxWL1BSow5/V2vxeg= github.com/lucasb-eyer/go-colorful v1.2.0 h1:1nnpGOrhyZZuNyfu1QjKiUICQ74+3FNCN69Aj6K7nkY= github.com/lucasb-eyer/go-colorful v1.2.0/go.mod h1:R4dSotOR9KMtayYi1e77YzuveK+i7ruzyGqttikkLy0= github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY= github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y= github.com/mattn/go-runewidth v0.0.12/go.mod h1:RAqKPSqVFrSLVXbA8x7dzmKdmGzieGRCM46jaSJTDAk= github.com/mattn/go-runewidth v0.0.16 h1:E5ScNMtiwvlvB5paMFdw9p4kSQzbXFikJ5SQO6TULQc= github.com/mattn/go-runewidth v0.0.16/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w= github.com/microcosm-cc/bluemonday v1.0.27 h1:MpEUotklkwCSLeH+Qdx1VJgNqLlpY2KXwXFM08ygZfk= github.com/microcosm-cc/bluemonday v1.0.27/go.mod h1:jFi9vgW+H7c3V0lb6nR74Ib/DIB5OBs92Dimizgw2cA= github.com/muesli/reflow v0.3.0 h1:IFsN6K9NfGtjeggFP+68I4chLZV2yIKsXJFNZ+eWh6s= github.com/muesli/reflow v0.3.0/go.mod h1:pbwTDkVPibjO2kyvBQRBxTWEEGDGq0FlB1BIKtnHY/8= github.com/muesli/termenv v0.16.0 h1:S5AlUN9dENB57rsbnkPyfdGuWIlkmzJjbFf0Tf5FWUc= github.com/muesli/termenv v0.16.0/go.mod h1:ZRfOIKPFDYQoDFF4Olj7/QJbW60Ol/kL1pU3VfY/Cnk= github.com/rivo/uniseg v0.1.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc= github.com/rivo/uniseg v0.2.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc= github.com/rivo/uniseg v0.4.7 h1:WUdvkW8uEhrYfLC4ZzdpI2ztxP1I582+49Oc5Mq64VQ= github.com/rivo/uniseg v0.4.7/go.mod h1:FN3SvrM+Zdj16jyLfmOkMNblXMcoc8DfTHruCPUcx88= github.com/xo/terminfo v0.0.0-20220910002029-abceb7e1c41e h1:JVG44RsyaB9T2KIHavMF/ppJZNG9ZpyihvCd0w101no= github.com/xo/terminfo v0.0.0-20220910002029-abceb7e1c41e/go.mod h1:RbqR21r5mrJuqunuUZ/Dhy/avygyECGrLceyNeo4LiM= github.com/yuin/goldmark v1.7.1/go.mod h1:uzxRWxtg69N339t3louHJ7+O03ezfj6PlliRlaOzY1E= github.com/yuin/goldmark v1.7.8 h1:iERMLn0/QJeHFhxSt3p6PeN9mGnvIKSpG9YYorDMnic= github.com/yuin/goldmark v1.7.8/go.mod h1:uzxRWxtg69N339t3louHJ7+O03ezfj6PlliRlaOzY1E= github.com/yuin/goldmark-emoji v1.0.5 h1:EMVWyCGPlXJfUXBXpuMu+ii3TIaxbVBnEX9uaDC4cIk= github.com/yuin/goldmark-emoji v1.0.5/go.mod h1:tTkZEbwu5wkPmgTcitqddVxY9osFZiavD+r4AzQrh1U= golang.org/x/exp v0.0.0-20220909182711-5c715a9e8561 h1:MDc5xs78ZrZr3HMQugiXOAkSZtfTpbJLDr/lwfgO53E= golang.org/x/exp v0.0.0-20220909182711-5c715a9e8561/go.mod h1:cyybsKvd6eL0RnXn6p/Grxp8F5bW7iYuBgsNCOHpMYE= golang.org/x/net v0.33.0 h1:74SYHlV8BIgHIFC/LrYkOGIwL19eTYXQ5wc6TBuO36I= golang.org/x/net v0.33.0/go.mod h1:HXLR5J+9DxmrqMwG9qjGCxZ+zKXxBru04zlTvWlWuN4= golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.32.0 h1:s77OFDvIQeibCmezSnk/q6iAfkdiQaJi4VzroCFrN20= golang.org/x/sys v0.32.0/go.mod h1:BJP2sWEmIv4KK5OTEluFJCKSidICx8ciO85XgH3Ak8k= golang.org/x/term v0.31.0 h1:erwDkOK1Msy6offm1mOgvspSkslFnIGsFnxOKoufg3o= golang.org/x/term v0.31.0/go.mod h1:R4BeIy7D95HzImkxGkTW1UQTtP54tio2RyHz7PwK0aw= golang.org/x/text v0.24.0 h1:dd5Bzh4yt5KYA8f9CJHCP4FB4D51c2c6JvN37xJJkJ0= golang.org/x/text v0.24.0/go.mod h1:L8rBsPeo2pSS+xqN0d5u2ikmjtmoJbDBT1b7nHvFCdU= glamour-0.10.0/internal/000077500000000000000000000000001500000454500150435ustar00rootroot00000000000000glamour-0.10.0/internal/autolink/000077500000000000000000000000001500000454500166715ustar00rootroot00000000000000glamour-0.10.0/internal/autolink/autolink.go000066400000000000000000000040141500000454500210450ustar00rootroot00000000000000// Package autolink provides a function to detect and format GitHub links into // a more readable manner. package autolink import ( "fmt" "regexp" ) type pattern struct { pattern *regexp.Regexp yield func(m []string) string } var patterns = []pattern{ { regexp.MustCompile(`^https?://github\.com/([A-z0-9_-]+)/([A-z0-9_-]+)/(issues?|pulls?|discussions?)/([0-9]+)$`), func(m []string) string { return fmt.Sprintf("%s/%s#%s", m[1], m[2], m[4]) }, }, { regexp.MustCompile(`^https?://github\.com/([A-z0-9_-]+)/([A-z0-9_-]+)/(issues?|pulls?|discussions?)/([0-9]+)#issuecomment-[0-9]+$`), func(m []string) string { return fmt.Sprintf("%s/%s#%s (comment)", m[1], m[2], m[4]) }, }, { regexp.MustCompile(`^https?://github\.com/([A-z0-9_-]+)/([A-z0-9_-]+)/pulls?/([0-9]+)#discussion_r[0-9]+$`), func(m []string) string { return fmt.Sprintf("%s/%s#%s (comment)", m[1], m[2], m[3]) }, }, { regexp.MustCompile(`^https?://github\.com/([A-z0-9_-]+)/([A-z0-9_-]+)/pulls?/([0-9]+)#pullrequestreview-[0-9]+$`), func(m []string) string { return fmt.Sprintf("%s/%s#%s (review)", m[1], m[2], m[3]) }, }, { regexp.MustCompile(`^https?://github\.com/([A-z0-9_-]+)/([A-z0-9_-]+)/discussions/([0-9]+)#discussioncomment-[0-9]+$`), func(m []string) string { return fmt.Sprintf("%s/%s#%s (comment)", m[1], m[2], m[3]) }, }, { regexp.MustCompile(`^https?://github\.com/([A-z0-9_-]+)/([A-z0-9_-]+)/commit/([A-z0-9]{7,})(#.*)?$`), func(m []string) string { return fmt.Sprintf("%s/%s@%s", m[1], m[2], m[3][:7]) }, }, { regexp.MustCompile(`^https?://github\.com/([A-z0-9_-]+)/([A-z0-9_-]+)/pulls?/[0-9]+/commits/([A-z0-9]{7,})(#.*)?$`), func(m []string) string { return fmt.Sprintf("%s/%s@%s", m[1], m[2], m[3][:7]) }, }, } // Detect checks if the given URL matches any of the known patterns and // returns a human-readable formatted string if a match is found. func Detect(u string) (string, bool) { for _, p := range patterns { if m := p.pattern.FindStringSubmatch(u); len(m) > 0 { return p.yield(m), true } } return "", false } glamour-0.10.0/internal/autolink/autolink_test.go000066400000000000000000000043301500000454500221050ustar00rootroot00000000000000package autolink_test import ( "testing" "github.com/charmbracelet/glamour/internal/autolink" ) func TestDetect(t *testing.T) { tests := []struct { url string expected string }{ {"https://github.com/owner/repo/issue/123", "owner/repo#123"}, {"https://github.com/owner/repo/issues/123", "owner/repo#123"}, {"https://github.com/owner/repo/pull/123", "owner/repo#123"}, {"https://github.com/owner/repo/pulls/123", "owner/repo#123"}, {"https://github.com/owner/repo/discussions/123", "owner/repo#123"}, {"https://github.com/owner/repo/issue/123#issuecomment-456", "owner/repo#123 (comment)"}, {"https://github.com/owner/repo/issues/123#issuecomment-456", "owner/repo#123 (comment)"}, {"https://github.com/owner/repo/pull/123#issuecomment-456", "owner/repo#123 (comment)"}, {"https://github.com/owner/repo/pulls/123#issuecomment-456", "owner/repo#123 (comment)"}, {"https://github.com/owner/repo/pull/123#discussion_r456", "owner/repo#123 (comment)"}, {"https://github.com/owner/repo/pulls/123#discussion_r456", "owner/repo#123 (comment)"}, {"https://github.com/owner/repo/pull/123#pullrequestreview-456", "owner/repo#123 (review)"}, {"https://github.com/owner/repo/pulls/123#pullrequestreview-456", "owner/repo#123 (review)"}, {"https://github.com/owner/repo/discussions/123#discussioncomment-456", "owner/repo#123 (comment)"}, {"https://github.com/owner/repo/commit/abcdefghijklmnopqrsxyz", "owner/repo@abcdefg"}, {"https://github.com/owner/repo/pull/123/commits/abcdefghijklmnopqrsxyz", "owner/repo@abcdefg"}, {"https://github.com/owner/repo/pulls/123/commits/abcdefghijklmnopqrsxyz", "owner/repo@abcdefg"}, {"https://github.com/owner/repo/commit/abcdefghijklmnopqrsxyz#diff-123", "owner/repo@abcdefg"}, {"https://github.com/owner/repo/pull/123/commits/abcdefghijklmnopqrsxyz#diff-123", "owner/repo@abcdefg"}, {"https://github.com/owner/repo/pulls/123/commits/abcdefghijklmnopqrsxyz#diff-123", "owner/repo@abcdefg"}, } for _, test := range tests { t.Run(test.url, func(t *testing.T) { result, ok := autolink.Detect(test.url) if !ok { t.Errorf("expected to detect URL, got nil") } if result != test.expected { t.Errorf("expected %s, got %s", test.expected, result) } }) } } glamour-0.10.0/internal/generate-style-json/000077500000000000000000000000001500000454500207425ustar00rootroot00000000000000glamour-0.10.0/internal/generate-style-json/main.go000066400000000000000000000015431500000454500222200ustar00rootroot00000000000000package main //nolint:revive import ( "encoding/json" "fmt" "os" "path/filepath" "github.com/charmbracelet/glamour/ansi" styles "github.com/charmbracelet/glamour/styles" ) func writeStyleJSON(filename string, styleConfig *ansi.StyleConfig) error { f, err := os.Create(filename) if err != nil { return fmt.Errorf("glamour: error creating file: %w", err) } defer f.Close() //nolint: errcheck e := json.NewEncoder(f) e.SetIndent("", " ") if err := e.Encode(styleConfig); err != nil { return fmt.Errorf("glamour: error encoding json: %w", err) } return nil } func run() error { for style, styleConfig := range styles.DefaultStyles { if err := writeStyleJSON(filepath.Join("styles", style+".json"), styleConfig); err != nil { return err } } return nil } func main() { if err := run(); err != nil { fmt.Println(err) os.Exit(1) } } glamour-0.10.0/styles/000077500000000000000000000000001500000454500145525ustar00rootroot00000000000000glamour-0.10.0/styles/README.md000066400000000000000000000245171500000454500160420ustar00rootroot00000000000000# Glamour Style Guide The JSON files in this directory are generated from the default styles. To re-generate them, run: go generate .. ## Block Elements Block elements contain other elements and are rendered around them. All block elements support the following style settings: | Attribute | Value | Description | | ---------------- | ------ | ------------------------------------------------------------ | | block_prefix | string | Printed before the block's first element (in parent's style) | | block_suffix | string | Printed after the block's last element (in parent's style) | | prefix | string | Printed before the block's first element | | suffix | string | Printed after the block's last element | | indent | number | Specifies the indentation of the block | | indent_token | string | Specifies the indentation format | | margin | number | Specifies the margin around the block | | color | color | Defines the default text color for the block | | background_color | color | Defines the default background color for the block | Elements inside a block inherit the block's following style settings: | Attribute | Value | Description | | ---------------- | ----- | -------------------------------------------------- | | color | color | Defines the default text color for the block | | background_color | color | Defines the default background color for the block | | bold | bool | Increases text intensity | | faint | bool | Decreases text intensity | | italic | bool | Prints the text in italic | | crossed_out | bool | Enables strikethrough as text decoration | | underline | bool | Enables underline as text decoration | | overlined | bool | Enables overline as text decoration | | blink | bool | Enables blinking text | | conceal | bool | Conceals / hides the text | | inverse | bool | Swaps fore- & background colors | ### document The `document` element represents the markdown's body. #### Example Style: ```json "document": { "indent": 2, "background_color": "234", "block_prefix": "\n", "block_suffix": "\n" } ``` --- ### paragraph The `paragraph` element represents a paragraph in the document. #### Example Style: ```json "paragraph": { "margin": 4, "color": "15", "background_color": "235" } ``` --- ### heading The `heading` element represents a heading. ### h1 - h6 The `h1` to `h6` elements represent headings. `h1` defines the most important heading, `h6` the least important heading. Undefined attributes are inherited from the `heading` element. #### Example Markdown: ```markdown # h1 ## h2 ### h3 ``` Style: ```json "heading": { "color": "15", "background_color": "57" }, "h1": { "prefix": "=> ", "suffix": " <=", "margin": 2, "bold": true, "background_color": "69" }, "h2": { "prefix": "## ", "margin": 4 }, "h3": { "prefix": "### ", "margin": 6 } ``` Output: ![Heading Example](https://github.com/charmbracelet/glamour/raw/master/styles/examples/heading.png) --- ### block_quote The `block_quote` element represents a quote. #### Example Style: ```json "block_quote": { "color": "200", "indent": 1, "indent_token": "=> " } ``` Output: ![Block Quote Example](https://github.com/charmbracelet/glamour/raw/master/styles/examples/block_quote.png) --- ### list The `list` element represents a list in the document. | Attribute | Value | Description | | ------------ | ------ | ------------------------------------------ | | level_indent | number | Specifies the indentation for nested lists | #### Example Style: ```json "list": { "color": "15", "background_color": "52", "level_indent": 4 } ``` --- ### code_block The `code_block` element represents a block of code. | Attribute | Value | Description | | --------- | ------ | --------------------------------------------------------------- | | theme | string | Defines the [Chroma][chroma] theme used for syntax highlighting | [chroma]: https://github.com/alecthomas/chroma #### Example Style: ```json "code_block": { "color": "200", "theme": "solarized-dark" } ``` Output: ![Code Block Example](https://github.com/charmbracelet/glamour/raw/master/styles/examples/code_block.png) --- ### table The `table` element represents a table of data. #### Example Markdown: ```markdown | Label | Value | | ------ | ----- | | First | foo | | Second | bar | ``` Style: ```json "table": { "margin": 4 } ``` Output: ![Table Example](https://github.com/charmbracelet/glamour/raw/master/styles/examples/table.png) ## Inline Elements All inline elements support the following style settings: | Attribute | Value | Description | | ---------------- | ------ | ----------------------------------------------------- | | block_prefix | string | Printed before the element (in parent's style) | | block_suffix | string | Printed after the element (in parent's style) | | prefix | string | Printed before the element | | suffix | string | Printed after the element | | color | color | Defines the default text color for the document | | background_color | color | Defines the default background color for the document | | bold | bool | Increases text intensity | | faint | bool | Decreases text intensity | | italic | bool | Prints the text in italic | | crossed_out | bool | Enables strikethrough as text decoration | | underline | bool | Enables underline as text decoration | | overlined | bool | Enables overline as text decoration | | blink | bool | Enables blinking text | | conceal | bool | Conceals / hides the text | | inverse | bool | Swaps fore- & background colors | ### text The `text` element represents a block of text. #### Example Style: ```json "text": { "bold": true, "color": "15", "background_color": "57" } ``` --- ### item The `item` element represents an item in a list. #### Example Markdown: ```markdown - First Item - Nested List Item - Second Item ``` Style: ```json "item": { "block_prefix": "• " } ``` Output: ![List Example](https://github.com/charmbracelet/glamour/raw/master/styles/examples/list.png) --- ### enumeration The `enumeration` element represents an item in an ordered list. #### Example Markdown: ```markdown 1. First Item 2. Second Item ``` Style: ```json "enumeration": { "block_prefix": ". " } ``` Output: ![Enumeration Example](https://github.com/charmbracelet/glamour/raw/master/styles/examples/enumeration.png) --- ### task The `task` element represents a task item. | Attribute | Value | Description | | --------- | ------ | --------------------------- | | ticked | string | Prefix for finished tasks | | unticked | string | Prefix for unfinished tasks | #### Example Markdown: ```markdown - [x] Finished Task - [ ] Outstanding Task ``` Style: ```json "task": { "ticked": "✓ ", "unticked": "✗ " } ``` Output: ![Task Example](https://github.com/charmbracelet/glamour/raw/master/styles/examples/task.png) --- ### link The `link` element represents a link. #### Example Markdown: ```markdown This is a [link](https://charm.sh). ``` Style: ```json "link": { "color": "123", "underline": true, "block_prefix": "(", "block_suffix": ")" } ``` Output: ![Link Example](https://github.com/charmbracelet/glamour/raw/master/styles/examples/link.png) --- ### link_text The `link_text` element represents the text associated with a link. #### Example Style: ```json "link_text": { "color": "123", "bold": true } ``` --- ### image The `image` element represents an image. #### Example Markdown: ```markdown ![Image](https://charm.sh/logo.png). ``` Style: ```json "image": { "color": "123", "block_prefix": "[Image: ", "block_suffix": "]" } ``` Output: ![Image Example](https://github.com/charmbracelet/glamour/raw/master/styles/examples/image.png) --- ### image_text The `image_text` element represents the text associated with an image. #### Example Style: ```json "image_text": { "color": "8" } ``` --- ### code The `code` element represents an inline code segment. #### Example Style: ```json "code": { "color": "200" } ``` Output: ![Code Example](https://github.com/charmbracelet/glamour/raw/master/styles/examples/code.png) --- ### emph The `emph` element represents an emphasized text. #### Example Markdown: ```markdown This text is *emphasized*. ``` Style: ```json "emph": { "italic": true } ``` Output: ![Emph Example](https://github.com/charmbracelet/glamour/raw/master/styles/examples/emph.png) --- ### strong The `strong` element represents important text. #### Example Markdown: ```markdown This text is **strong**. ``` Style: ```json "strong": { "bold": true } ``` Output: ![Strong Example](https://github.com/charmbracelet/glamour/raw/master/styles/examples/strong.png) --- ### strikethrough The `strikethrough` element represents strikethrough text. #### Example Markdown: ```markdown ~~Scratch this~~. ``` Style: ```json "strikethrough": { "crossed_out": true } ``` Output: ![Strikethrough Example](https://github.com/charmbracelet/glamour/raw/master/styles/examples/strikethrough.png) --- ### hr The `hr` element represents a horizontal rule. #### Example Markdown: ```markdown --- ``` Style: ```json "hr": { "block_prefix": "---" } ``` ## html_block ## html_span glamour-0.10.0/styles/ascii.json000066400000000000000000000024051500000454500165360ustar00rootroot00000000000000{ "document": { "block_prefix": "\n", "block_suffix": "\n", "margin": 2 }, "block_quote": { "indent": 1, "indent_token": "| " }, "paragraph": {}, "list": { "level_indent": 4 }, "heading": { "block_suffix": "\n" }, "h1": { "prefix": "# " }, "h2": { "prefix": "## " }, "h3": { "prefix": "### " }, "h4": { "prefix": "#### " }, "h5": { "prefix": "##### " }, "h6": { "prefix": "###### " }, "text": {}, "strikethrough": { "block_prefix": "~~", "block_suffix": "~~" }, "emph": { "block_prefix": "*", "block_suffix": "*" }, "strong": { "block_prefix": "**", "block_suffix": "**" }, "hr": { "format": "\n--------\n" }, "item": { "block_prefix": "• " }, "enumeration": { "block_prefix": ". " }, "task": { "ticked": "[x] ", "unticked": "[ ] " }, "link": {}, "link_text": {}, "image": {}, "image_text": { "format": "Image: {{.text}} →" }, "code": { "block_prefix": "`", "block_suffix": "`" }, "code_block": { "margin": 2 }, "table": {}, "definition_list": {}, "definition_term": {}, "definition_description": { "block_prefix": "\n* " }, "html_block": {}, "html_span": {} } glamour-0.10.0/styles/dark.json000066400000000000000000000065151500000454500163750ustar00rootroot00000000000000{ "document": { "block_prefix": "\n", "block_suffix": "\n", "color": "252", "margin": 2 }, "block_quote": { "indent": 1, "indent_token": "│ " }, "paragraph": {}, "list": { "level_indent": 2 }, "heading": { "block_suffix": "\n", "color": "39", "bold": true }, "h1": { "prefix": " ", "suffix": " ", "color": "228", "background_color": "63", "bold": true }, "h2": { "prefix": "## " }, "h3": { "prefix": "### " }, "h4": { "prefix": "#### " }, "h5": { "prefix": "##### " }, "h6": { "prefix": "###### ", "color": "35", "bold": false }, "text": {}, "strikethrough": { "crossed_out": true }, "emph": { "italic": true }, "strong": { "bold": true }, "hr": { "color": "240", "format": "\n--------\n" }, "item": { "block_prefix": "• " }, "enumeration": { "block_prefix": ". " }, "task": { "ticked": "[✓] ", "unticked": "[ ] " }, "link": { "color": "30", "underline": true }, "link_text": { "color": "35", "bold": true }, "image": { "color": "212", "underline": true }, "image_text": { "color": "243", "format": "Image: {{.text}} →" }, "code": { "prefix": " ", "suffix": " ", "color": "203", "background_color": "236" }, "code_block": { "color": "244", "margin": 2, "chroma": { "text": { "color": "#C4C4C4" }, "error": { "color": "#F1F1F1", "background_color": "#F05B5B" }, "comment": { "color": "#676767" }, "comment_preproc": { "color": "#FF875F" }, "keyword": { "color": "#00AAFF" }, "keyword_reserved": { "color": "#FF5FD2" }, "keyword_namespace": { "color": "#FF5F87" }, "keyword_type": { "color": "#6E6ED8" }, "operator": { "color": "#EF8080" }, "punctuation": { "color": "#E8E8A8" }, "name": { "color": "#C4C4C4" }, "name_builtin": { "color": "#FF8EC7" }, "name_tag": { "color": "#B083EA" }, "name_attribute": { "color": "#7A7AE6" }, "name_class": { "color": "#F1F1F1", "underline": true, "bold": true }, "name_constant": {}, "name_decorator": { "color": "#FFFF87" }, "name_exception": {}, "name_function": { "color": "#00D787" }, "name_other": {}, "literal": {}, "literal_number": { "color": "#6EEFC0" }, "literal_date": {}, "literal_string": { "color": "#C69669" }, "literal_string_escape": { "color": "#AFFFD7" }, "generic_deleted": { "color": "#FD5B5B" }, "generic_emph": { "italic": true }, "generic_inserted": { "color": "#00D787" }, "generic_strong": { "bold": true }, "generic_subheading": { "color": "#777777" }, "background": { "background_color": "#373737" } } }, "table": {}, "definition_list": {}, "definition_term": {}, "definition_description": { "block_prefix": "\n🠶 " }, "html_block": {}, "html_span": {} } glamour-0.10.0/styles/dracula.go000066400000000000000000000116741500000454500165250ustar00rootroot00000000000000package styles import "github.com/charmbracelet/glamour/ansi" // DraculaStyleConfig is the dracula style. var DraculaStyleConfig = ansi.StyleConfig{ Document: ansi.StyleBlock{ StylePrimitive: ansi.StylePrimitive{ BlockPrefix: "\n", BlockSuffix: "\n", Color: stringPtr("#f8f8f2"), }, Margin: uintPtr(defaultMargin), }, BlockQuote: ansi.StyleBlock{ StylePrimitive: ansi.StylePrimitive{ Color: stringPtr("#f1fa8c"), Italic: boolPtr(true), }, Indent: uintPtr(defaultMargin), }, List: ansi.StyleList{ LevelIndent: defaultMargin, StyleBlock: ansi.StyleBlock{ StylePrimitive: ansi.StylePrimitive{ Color: stringPtr("#f8f8f2"), }, }, }, Heading: ansi.StyleBlock{ StylePrimitive: ansi.StylePrimitive{ BlockSuffix: "\n", Color: stringPtr("#bd93f9"), Bold: boolPtr(true), }, }, H1: ansi.StyleBlock{ StylePrimitive: ansi.StylePrimitive{ Prefix: "# ", }, }, H2: ansi.StyleBlock{ StylePrimitive: ansi.StylePrimitive{ Prefix: "## ", }, }, H3: ansi.StyleBlock{ StylePrimitive: ansi.StylePrimitive{ Prefix: "### ", }, }, H4: ansi.StyleBlock{ StylePrimitive: ansi.StylePrimitive{ Prefix: "#### ", }, }, H5: ansi.StyleBlock{ StylePrimitive: ansi.StylePrimitive{ Prefix: "##### ", }, }, H6: ansi.StyleBlock{ StylePrimitive: ansi.StylePrimitive{ Prefix: "###### ", }, }, Strikethrough: ansi.StylePrimitive{ CrossedOut: boolPtr(true), }, Emph: ansi.StylePrimitive{ Color: stringPtr("#f1fa8c"), Italic: boolPtr(true), }, Strong: ansi.StylePrimitive{ Bold: boolPtr(true), Color: stringPtr("#ffb86c"), }, HorizontalRule: ansi.StylePrimitive{ Color: stringPtr("#6272A4"), Format: "\n--------\n", }, Item: ansi.StylePrimitive{ BlockPrefix: "• ", }, Enumeration: ansi.StylePrimitive{ BlockPrefix: ". ", Color: stringPtr("#8be9fd"), }, Task: ansi.StyleTask{ StylePrimitive: ansi.StylePrimitive{}, Ticked: "[✓] ", Unticked: "[ ] ", }, Link: ansi.StylePrimitive{ Color: stringPtr("#8be9fd"), Underline: boolPtr(true), }, LinkText: ansi.StylePrimitive{ Color: stringPtr("#ff79c6"), }, Image: ansi.StylePrimitive{ Color: stringPtr("#8be9fd"), Underline: boolPtr(true), }, ImageText: ansi.StylePrimitive{ Color: stringPtr("#ff79c6"), Format: "Image: {{.text}} →", }, Code: ansi.StyleBlock{ StylePrimitive: ansi.StylePrimitive{ Color: stringPtr("#50fa7b"), }, }, CodeBlock: ansi.StyleCodeBlock{ StyleBlock: ansi.StyleBlock{ StylePrimitive: ansi.StylePrimitive{ Color: stringPtr("#ffb86c"), }, Margin: uintPtr(defaultMargin), }, Chroma: &ansi.Chroma{ Text: ansi.StylePrimitive{ Color: stringPtr("#f8f8f2"), }, Error: ansi.StylePrimitive{ Color: stringPtr("#f8f8f2"), BackgroundColor: stringPtr("#ff5555"), }, Comment: ansi.StylePrimitive{ Color: stringPtr("#6272A4"), }, CommentPreproc: ansi.StylePrimitive{ Color: stringPtr("#ff79c6"), }, Keyword: ansi.StylePrimitive{ Color: stringPtr("#ff79c6"), }, KeywordReserved: ansi.StylePrimitive{ Color: stringPtr("#ff79c6"), }, KeywordNamespace: ansi.StylePrimitive{ Color: stringPtr("#ff79c6"), }, KeywordType: ansi.StylePrimitive{ Color: stringPtr("#8be9fd"), }, Operator: ansi.StylePrimitive{ Color: stringPtr("#ff79c6"), }, Punctuation: ansi.StylePrimitive{ Color: stringPtr("#f8f8f2"), }, Name: ansi.StylePrimitive{ Color: stringPtr("#8be9fd"), }, NameBuiltin: ansi.StylePrimitive{ Color: stringPtr("#8be9fd"), }, NameTag: ansi.StylePrimitive{ Color: stringPtr("#ff79c6"), }, NameAttribute: ansi.StylePrimitive{ Color: stringPtr("#50fa7b"), }, NameClass: ansi.StylePrimitive{ Color: stringPtr("#8be9fd"), }, NameConstant: ansi.StylePrimitive{ Color: stringPtr("#bd93f9"), }, NameDecorator: ansi.StylePrimitive{ Color: stringPtr("#50fa7b"), }, NameFunction: ansi.StylePrimitive{ Color: stringPtr("#50fa7b"), }, LiteralNumber: ansi.StylePrimitive{ Color: stringPtr("#6EEFC0"), }, LiteralString: ansi.StylePrimitive{ Color: stringPtr("#f1fa8c"), }, LiteralStringEscape: ansi.StylePrimitive{ Color: stringPtr("#ff79c6"), }, GenericDeleted: ansi.StylePrimitive{ Color: stringPtr("#ff5555"), }, GenericEmph: ansi.StylePrimitive{ Color: stringPtr("#f1fa8c"), Italic: boolPtr(true), }, GenericInserted: ansi.StylePrimitive{ Color: stringPtr("#50fa7b"), }, GenericStrong: ansi.StylePrimitive{ Color: stringPtr("#ffb86c"), Bold: boolPtr(true), }, GenericSubheading: ansi.StylePrimitive{ Color: stringPtr("#bd93f9"), }, Background: ansi.StylePrimitive{ BackgroundColor: stringPtr("#282a36"), }, }, }, Table: ansi.StyleTable{ StyleBlock: ansi.StyleBlock{ StylePrimitive: ansi.StylePrimitive{}, }, }, DefinitionDescription: ansi.StylePrimitive{ BlockPrefix: "\n🠶 ", }, } glamour-0.10.0/styles/dracula.json000066400000000000000000000064721500000454500170710ustar00rootroot00000000000000{ "document": { "block_prefix": "\n", "block_suffix": "\n", "color": "#f8f8f2", "margin": 2 }, "block_quote": { "color": "#f1fa8c", "italic": true, "indent": 2 }, "paragraph": {}, "list": { "color": "#f8f8f2", "level_indent": 2 }, "heading": { "block_suffix": "\n", "color": "#bd93f9", "bold": true }, "h1": { "prefix": "# " }, "h2": { "prefix": "## " }, "h3": { "prefix": "### " }, "h4": { "prefix": "#### " }, "h5": { "prefix": "##### " }, "h6": { "prefix": "###### " }, "text": {}, "strikethrough": { "crossed_out": true }, "emph": { "color": "#f1fa8c", "italic": true }, "strong": { "color": "#ffb86c", "bold": true }, "hr": { "color": "#6272A4", "format": "\n--------\n" }, "item": { "block_prefix": "• " }, "enumeration": { "block_prefix": ". ", "color": "#8be9fd" }, "task": { "ticked": "[✓] ", "unticked": "[ ] " }, "link": { "color": "#8be9fd", "underline": true }, "link_text": { "color": "#ff79c6" }, "image": { "color": "#8be9fd", "underline": true }, "image_text": { "color": "#ff79c6", "format": "Image: {{.text}} →" }, "code": { "color": "#50fa7b" }, "code_block": { "color": "#ffb86c", "margin": 2, "chroma": { "text": { "color": "#f8f8f2" }, "error": { "color": "#f8f8f2", "background_color": "#ff5555" }, "comment": { "color": "#6272A4" }, "comment_preproc": { "color": "#ff79c6" }, "keyword": { "color": "#ff79c6" }, "keyword_reserved": { "color": "#ff79c6" }, "keyword_namespace": { "color": "#ff79c6" }, "keyword_type": { "color": "#8be9fd" }, "operator": { "color": "#ff79c6" }, "punctuation": { "color": "#f8f8f2" }, "name": { "color": "#8be9fd" }, "name_builtin": { "color": "#8be9fd" }, "name_tag": { "color": "#ff79c6" }, "name_attribute": { "color": "#50fa7b" }, "name_class": { "color": "#8be9fd" }, "name_constant": { "color": "#bd93f9" }, "name_decorator": { "color": "#50fa7b" }, "name_exception": {}, "name_function": { "color": "#50fa7b" }, "name_other": {}, "literal": {}, "literal_number": { "color": "#6EEFC0" }, "literal_date": {}, "literal_string": { "color": "#f1fa8c" }, "literal_string_escape": { "color": "#ff79c6" }, "generic_deleted": { "color": "#ff5555" }, "generic_emph": { "color": "#f1fa8c", "italic": true }, "generic_inserted": { "color": "#50fa7b" }, "generic_strong": { "color": "#ffb86c", "bold": true }, "generic_subheading": { "color": "#bd93f9" }, "background": { "background_color": "#282a36" } } }, "table": {}, "definition_list": {}, "definition_term": {}, "definition_description": { "block_prefix": "\n🠶 " }, "html_block": {}, "html_span": {} } glamour-0.10.0/styles/examples/000077500000000000000000000000001500000454500163705ustar00rootroot00000000000000glamour-0.10.0/styles/examples/block_quote.md000066400000000000000000000000441500000454500212170ustar00rootroot00000000000000> First line of quote > Second line glamour-0.10.0/styles/examples/block_quote.png000066400000000000000000000002011500000454500213760ustar00rootroot00000000000000version https://git-lfs.github.com/spec/v1 oid sha256:37e3a1775cc1ea394b24a49f77038260e813428de5fb8c76df83e84d4983dad0 size 2109 glamour-0.10.0/styles/examples/block_quote.style000066400000000000000000000001521500000454500217570ustar00rootroot00000000000000{ "block_quote": { "color": "200", "indent": 1, "indent_token": "=> " } } glamour-0.10.0/styles/examples/code.md000066400000000000000000000000221500000454500176160ustar00rootroot00000000000000This is a `code`. glamour-0.10.0/styles/examples/code.png000066400000000000000000000002011500000454500200010ustar00rootroot00000000000000version https://git-lfs.github.com/spec/v1 oid sha256:38bcb0ce17254d2ca23667384bf1d61c7ff86f5915445fed48df1b694613ed3b size 1452 glamour-0.10.0/styles/examples/code.style000066400000000000000000000000571500000454500203660ustar00rootroot00000000000000{ "code": { "color": "200" } } glamour-0.10.0/styles/examples/code_block.md000066400000000000000000000000361500000454500207750ustar00rootroot00000000000000``` This is a code block. ``` glamour-0.10.0/styles/examples/code_block.png000066400000000000000000000002011500000454500211530ustar00rootroot00000000000000version https://git-lfs.github.com/spec/v1 oid sha256:46a44185c7823970b89a54dd86e250910c54b5c9c56b3f0fe8d080f49974e686 size 1065 glamour-0.10.0/styles/examples/code_block.style000066400000000000000000000001301500000454500215300ustar00rootroot00000000000000{ "code_block": { "color": "200", "theme": "solarized-dark" } } glamour-0.10.0/styles/examples/document.style000066400000000000000000000002171500000454500212700ustar00rootroot00000000000000{ "document": { "indent": 2, "background_color": "234", "block_prefix": "\n", "block_suffix": "\n" } } glamour-0.10.0/styles/examples/emoji.md000066400000000000000000000000401500000454500200070ustar00rootroot00000000000000:octopus: :zap: :cat: = :heart: glamour-0.10.0/styles/examples/emoji.style000066400000000000000000000000201500000454500205450ustar00rootroot00000000000000{ "emoji": {} } glamour-0.10.0/styles/examples/emph.md000066400000000000000000000000331500000454500176370ustar00rootroot00000000000000This text is *emphasized*. glamour-0.10.0/styles/examples/emph.png000066400000000000000000000002011500000454500200200ustar00rootroot00000000000000version https://git-lfs.github.com/spec/v1 oid sha256:12e2fd2c53dc7433cae8def84312f46691c9edf57c6fa950265c423bee886ed3 size 1300 glamour-0.10.0/styles/examples/emph.style000066400000000000000000000000571500000454500204050ustar00rootroot00000000000000{ "emph": { "italic": true } } glamour-0.10.0/styles/examples/enumeration.md000066400000000000000000000000351500000454500212360ustar00rootroot000000000000001. First Item 2. Second Item glamour-0.10.0/styles/examples/enumeration.png000066400000000000000000000002011500000454500214150ustar00rootroot00000000000000version https://git-lfs.github.com/spec/v1 oid sha256:8a7594dbeab152d6e11ce582e2c49e543bfe20d915b6c9f962e93a86f4963fe0 size 1967 glamour-0.10.0/styles/examples/enumeration.style000066400000000000000000000002111500000454500217720ustar00rootroot00000000000000{ "list": { "color": "15", "background_color": "52" }, "enumeration": { "block_prefix": ". " } } glamour-0.10.0/styles/examples/heading.md000066400000000000000000000000241500000454500203050ustar00rootroot00000000000000# h1 ## h2 ### h3 glamour-0.10.0/styles/examples/heading.png000066400000000000000000000002011500000454500204660ustar00rootroot00000000000000version https://git-lfs.github.com/spec/v1 oid sha256:c2fc6d744dd4b3dc91b9f353b6d29f37d62b3cb4936bae70d299cb7144fdb604 size 1824 glamour-0.10.0/styles/examples/heading.style000066400000000000000000000005451500000454500210550ustar00rootroot00000000000000{ "heading": { "color": "15", "background_color": "57" }, "h1": { "prefix": "=> ", "suffix": " <=", "margin": 2, "bold": true, "background_color": "69" }, "h2": { "prefix": "## ", "margin": 4 }, "h3": { "prefix": "### ", "margin": 6 } } glamour-0.10.0/styles/examples/hr.md000066400000000000000000000000041500000454500173150ustar00rootroot00000000000000--- glamour-0.10.0/styles/examples/hr.png000066400000000000000000000002001500000454500174770ustar00rootroot00000000000000version https://git-lfs.github.com/spec/v1 oid sha256:d892957e43cce45e4e26c955d2b125311e44a7a881bc41b1c7284da2ef844d8f size 354 glamour-0.10.0/styles/examples/hr.style000066400000000000000000000000561500000454500200640ustar00rootroot00000000000000{ "hr": { "prefix": "---" } } glamour-0.10.0/styles/examples/image.md000066400000000000000000000000451500000454500177730ustar00rootroot00000000000000![Image](https://charm.sh/logo.png). glamour-0.10.0/styles/examples/image.png000066400000000000000000000002011500000454500201510ustar00rootroot00000000000000version https://git-lfs.github.com/spec/v1 oid sha256:528da9a10586a4703694446aa40f6091b7c1b540ef38e8d3dc81388bae1c15b9 size 3177 glamour-0.10.0/styles/examples/image.style000066400000000000000000000002411500000454500205310ustar00rootroot00000000000000{ "image": { "color": "123", "block_prefix": "[Image: ", "block_suffix": "]" }, "image_text": { "color": "8" } } glamour-0.10.0/styles/examples/link.md000066400000000000000000000000441500000454500176450ustar00rootroot00000000000000This is a [link](https://charm.sh). glamour-0.10.0/styles/examples/link.png000066400000000000000000000002011500000454500200240ustar00rootroot00000000000000version https://git-lfs.github.com/spec/v1 oid sha256:13a53203048afa62484fdef9e21b8734f5cf493a7d017de514039eabd0c8ea12 size 2498 glamour-0.10.0/styles/examples/link.style000066400000000000000000000003131500000454500204040ustar00rootroot00000000000000{ "link": { "color": "123", "underline": true, "block_prefix": "(", "block_suffix": ")" }, "link_text": { "color": "123", "bold": true } } glamour-0.10.0/styles/examples/list.md000066400000000000000000000000621500000454500176630ustar00rootroot00000000000000- First Item - Nested List Item - Second Item glamour-0.10.0/styles/examples/list.png000066400000000000000000000002011500000454500200420ustar00rootroot00000000000000version https://git-lfs.github.com/spec/v1 oid sha256:b96bd5657e99fc7683ea048db7aaeccbb10b544b78ec6d08206cfde4aedc2476 size 2285 glamour-0.10.0/styles/examples/list.style000066400000000000000000000002371500000454500204270ustar00rootroot00000000000000{ "list": { "color": "15", "background_color": "52", "level_indent": 4 }, "item": { "block_prefix": "• " } } glamour-0.10.0/styles/examples/ordered_list.md000066400000000000000000000001331500000454500213660ustar00rootroot000000000000003. 3 is first and numbered 3 4. 4 is second and numbered 4 10. ten is third and numbered 5 glamour-0.10.0/styles/examples/ordered_list.style000066400000000000000000000001531500000454500221300ustar00rootroot00000000000000{ "list": { "level_indent": 1 }, "enumeration": { "block_prefix": ". " } } glamour-0.10.0/styles/examples/paragraph.style000066400000000000000000000001531500000454500214160ustar00rootroot00000000000000{ "paragraph": { "margin": 4, "color": "15", "background_color": "235" } } glamour-0.10.0/styles/examples/strikethrough.md000066400000000000000000000000221500000454500216060ustar00rootroot00000000000000~~Scratch this~~. glamour-0.10.0/styles/examples/strikethrough.png000066400000000000000000000002001500000454500217700ustar00rootroot00000000000000version https://git-lfs.github.com/spec/v1 oid sha256:9a4b9a49510ed6e602696205b6c3610562499a4206aa71714d924b948d26b2be size 768 glamour-0.10.0/styles/examples/strikethrough.style000066400000000000000000000000751500000454500223560ustar00rootroot00000000000000{ "strikethrough": { "crossed_out": true } } glamour-0.10.0/styles/examples/strong.md000066400000000000000000000000311500000454500202200ustar00rootroot00000000000000This text is **strong**. glamour-0.10.0/styles/examples/strong.png000066400000000000000000000002011500000454500204030ustar00rootroot00000000000000version https://git-lfs.github.com/spec/v1 oid sha256:3211392c0cbe3314f7f22f92e641fff9ed4cf254819b35cfaec628f934b22e75 size 1039 glamour-0.10.0/styles/examples/strong.style000066400000000000000000000000571500000454500207700ustar00rootroot00000000000000{ "strong": { "bold": true } } glamour-0.10.0/styles/examples/table.md000066400000000000000000000002301500000454500177740ustar00rootroot00000000000000| Label | Value | URL | | ------ | ----- | ---------------- | | First | foo | https://charm.sh | | Second | bar | https://charm.sh | glamour-0.10.0/styles/examples/table.png000066400000000000000000000002011500000454500201560ustar00rootroot00000000000000version https://git-lfs.github.com/spec/v1 oid sha256:f72170b9ada9c5f426f778fb9a0933e8dc4cd615ac257d981b20386cb34b700d size 1585 glamour-0.10.0/styles/examples/table.style000066400000000000000000000000551500000454500205410ustar00rootroot00000000000000{ "table": { "margin": 4 } } glamour-0.10.0/styles/examples/table_align.md000066400000000000000000000001641500000454500211540ustar00rootroot00000000000000| Label | Value | URL | | :----- | :---: | ------: | | First | foo | charm.sh | | Second | bar | https://charm.sh | glamour-0.10.0/styles/examples/table_align.style000066400000000000000000000000551500000454500217130ustar00rootroot00000000000000{ "table": { "margin": 4 } } glamour-0.10.0/styles/examples/table_truncate.md000066400000000000000000000006451500000454500217130ustar00rootroot00000000000000| Name | Description | Type | Required | Default | |---------|----------------------------------------|------|----------|---------| | command | A command to be executed inside the container to assess its health. Each space delimited token of the command is a separate array element. Commands exiting 0 are considered to be successful probes, whilst all other exit codes are considered failures. | yes | hello | yep | glamour-0.10.0/styles/examples/table_truncate.style000066400000000000000000000000031500000454500224370ustar00rootroot00000000000000{} glamour-0.10.0/styles/examples/table_with_footer_auto_links.md000066400000000000000000000006001500000454500246360ustar00rootroot00000000000000| Name | Role | Handle | | ---- | ---- | ------ | | Andrey | Engineering | https://github.com/andreynering | | Ayman | Engineering | https://github.com/aymanbagabas | | Bash | Engineering | https://github.com/bashbunni | | Carlos | Engineering | https://github.com/caarlos0 | | Christian | Product | https://github.com/meowgorithm | | Rapha | Intern | https://github.com/raphamorim | glamour-0.10.0/styles/examples/table_with_footer_auto_links.style000066400000000000000000000001671500000454500254060ustar00rootroot00000000000000{ "link": { "color": "30", "underline": true }, "link_text": { "color": "35", "bold": true } } glamour-0.10.0/styles/examples/table_with_footer_auto_links_short.md000066400000000000000000000044621500000454500260670ustar00rootroot00000000000000| Description | Link | | -------------------- | ------------------------------------------------------------------------------- | | Issue | https://github.com/owner/repo/issue/123 | | Issue | https://github.com/owner/repo/issues/123 | | Issue Comment | https://github.com/owner/repo/issue/123#issuecomment-456 | | Issue Comment | https://github.com/owner/repo/issues/123#issuecomment-456 | | Pull Request | https://github.com/owner/repo/pull/123 | | Pull Request | https://github.com/owner/repo/pulls/123 | | Pull Request Comment | https://github.com/owner/repo/pull/123#issuecomment-456 | | Pull Request Comment | https://github.com/owner/repo/pulls/123#issuecomment-456 | | Pull Request Comment | https://github.com/owner/repo/pull/123#discussion_r456 | | Pull Request Comment | https://github.com/owner/repo/pulls/123#discussion_r456 | | Pull Request Review | https://github.com/owner/repo/pull/123#pullrequestreview-456 | | Pull Request Review | https://github.com/owner/repo/pulls/123#pullrequestreview-456 | | Discussion | https://github.com/owner/repo/discussions/123 | | Discussion Comment | https://github.com/owner/repo/discussions/123#discussioncomment-456 | | Commit | https://github.com/owner/repo/commit/abcdefghijklmnopqrsxyz | | Commit | https://github.com/owner/repo/commit/abcdefghijklmnopqrsxyz#diff-123 | | Pull Request Commit | https://github.com/owner/repo/pull/123/commits/abcdefghijklmnopqrsxyz | | Pull Request Commit | https://github.com/owner/repo/pulls/123/commits/abcdefghijklmnopqrsxyz | | Pull Request Commit | https://github.com/owner/repo/pull/123/commits/abcdefghijklmnopqrsxyz#diff-123 | | Pull Request Commit | https://github.com/owner/repo/pulls/123/commits/abcdefghijklmnopqrsxyz#diff-123 | glamour-0.10.0/styles/examples/table_with_footer_auto_links_short.style000066400000000000000000000001671500000454500266250ustar00rootroot00000000000000{ "link": { "color": "30", "underline": true }, "link_text": { "color": "35", "bold": true } } glamour-0.10.0/styles/examples/table_with_footer_images.md000066400000000000000000000015361500000454500237440ustar00rootroot00000000000000| Name | Role | Handle | Image | | ---- | ---- | ------ | ----- | | Andrey | Engineering | [@andreynering](https://github.com/andreynering) | ![@andreynering's avatar](https://github.com/andreynering.png) | | Ayman | Engineering | [@aymanbagabas](https://github.com/aymanbagabas) | ![@aymanbagabas's avatar](https://github.com/aymanbagabas.png) | | Bash | Engineering | [@bashbunni](https://github.com/bashbunni) | ![@bashbunni's avatar](https://github.com/bashbunni.png) | | Carlos | Engineering | [@caarlos0](https://github.com/caarlos0) | ![@caarlos0's avatar](https://github.com/caarlos0.png) | | Christian | Product | [@meowgorithm](https://github.com/meowgorithm) | ![@meowgorithm's avatar](https://github.com/meowgorithm.png) | | Rapha | Intern | [@raphamorim](https://github.com/raphamorim) | ![@raphamorim's avatar](https://github.com/raphamorim.png) | glamour-0.10.0/styles/examples/table_with_footer_images.style000066400000000000000000000004031500000454500244740ustar00rootroot00000000000000{ "link": { "color": "30", "underline": true }, "link_text": { "color": "35", "bold": true }, "image": { "color": "212", "underline": true }, "image_text": { "color": "243", "format": "Image: {{.text}} →" } } glamour-0.10.0/styles/examples/table_with_footer_images_no_alt.md000066400000000000000000000013441500000454500252750ustar00rootroot00000000000000| Name | Role | Handle | Image | | ---- | ---- | ------ | ----- | | Andrey | Engineering | [@andreynering](https://github.com/andreynering) | ![](https://github.com/andreynering.png) | | Ayman | Engineering | [@aymanbagabas](https://github.com/aymanbagabas) | ![](https://github.com/aymanbagabas.png) | | Bash | Engineering | [@bashbunni](https://github.com/bashbunni) | ![](https://github.com/bashbunni.png) | | Carlos | Engineering | [@caarlos0](https://github.com/caarlos0) | ![](https://github.com/caarlos0.png) | | Christian | Product | [@meowgorithm](https://github.com/meowgorithm) | ![](https://github.com/meowgorithm.png) | | Rapha | Intern | [@raphamorim](https://github.com/raphamorim) | ![](https://github.com/raphamorim.png) | glamour-0.10.0/styles/examples/table_with_footer_images_no_alt.style000066400000000000000000000004031500000454500260300ustar00rootroot00000000000000{ "link": { "color": "30", "underline": true }, "link_text": { "color": "35", "bold": true }, "image": { "color": "212", "underline": true }, "image_text": { "color": "243", "format": "Image: {{.text}} →" } } glamour-0.10.0/styles/examples/table_with_footer_images_same_alt.md000066400000000000000000000014621500000454500256070ustar00rootroot00000000000000| Name | Role | Handle | Image | | ---- | ---- | ------ | ----- | | Andrey | Engineering | [@andreynering](https://github.com/andreynering) | ![GitHub avatar](https://github.com/andreynering.png) | | Ayman | Engineering | [@aymanbagabas](https://github.com/aymanbagabas) | ![GitHub avatar](https://github.com/aymanbagabas.png) | | Bash | Engineering | [@bashbunni](https://github.com/bashbunni) | ![GitHub avatar](https://github.com/bashbunni.png) | | Carlos | Engineering | [@caarlos0](https://github.com/caarlos0) | ![GitHub avatar](https://github.com/caarlos0.png) | | Christian | Product | [@meowgorithm](https://github.com/meowgorithm) | ![GitHub avatar](https://github.com/meowgorithm.png) | | Rapha | Intern | [@raphamorim](https://github.com/raphamorim) | ![GitHub avatar](https://github.com/raphamorim.png) | glamour-0.10.0/styles/examples/table_with_footer_images_same_alt.style000066400000000000000000000004031500000454500263410ustar00rootroot00000000000000{ "link": { "color": "30", "underline": true }, "link_text": { "color": "35", "bold": true }, "image": { "color": "212", "underline": true }, "image_text": { "color": "243", "format": "Image: {{.text}} →" } } glamour-0.10.0/styles/examples/table_with_footer_links.md000066400000000000000000000007341500000454500236160ustar00rootroot00000000000000| Name | Role | Handle | | ---- | ---- | ------ | | Andrey | Engineering | [@andreynering](https://github.com/andreynering) | | Ayman | Engineering | [@aymanbagabas](https://github.com/aymanbagabas) | | Bash | Engineering | [@bashbunni](https://github.com/bashbunni) | | Carlos | Engineering | [@caarlos0](https://github.com/caarlos0) | | Christian | Product | [@meowgorithm](https://github.com/meowgorithm) | | Rapha | Intern | [@raphamorim](https://github.com/raphamorim) | glamour-0.10.0/styles/examples/table_with_footer_links.style000066400000000000000000000001671500000454500243560ustar00rootroot00000000000000{ "link": { "color": "30", "underline": true }, "link_text": { "color": "35", "bold": true } } glamour-0.10.0/styles/examples/table_with_footer_links_complex.md000066400000000000000000000042421500000454500253430ustar00rootroot00000000000000| Handle | Description | Image | | ------ | ----------- | ----- | | [@andreynering](https://github.com/andreynering) | Passionate engineer pushing the boundaries of technology.
Check out Andrey's [GitHub projects](https://github.com/andreynering) and [personal blog](https://andreynering.dev).
Connect on [Twitter](https://twitter.com/andreynering) for tech insights. | ![](https://github.com/andreynering.png) | | [@aymanbagabas](https://github.com/aymanbagabas) | Open-source enthusiast and innovative software engineer.
Explore Ayman's [GitHub contributions](https://github.com/aymanbagabas) and [technical writings](https://aymanbagabas.medium.com).
Follow on [LinkedIn](https://www.linkedin.com/in/aymanbagabas) for professional updates. | ![](https://github.com/aymanbagabas.png) | | [@bashbunni](https://github.com/bashbunni) | Creative developer with a passion for cutting-edge technologies.
Dive into Bash's [GitHub repositories](https://github.com/bashbunni) and [dev portfolio](https://bashbunni.dev).
Engage on [Twitter](https://twitter.com/bashbunni) for tech discussions. | ![](https://github.com/bashbunni.png) | | [@caarlos0](https://github.com/caarlos0) | Innovative engineering leader and open-source contributor.
Discover Carlos's [GitHub projects](https://github.com/caarlos0) and [technical blog](https://caarlos0.dev).
Connect on [LinkedIn](https://www.linkedin.com/in/caarlos0) for professional networking. | ![](https://github.com/caarlos0.png) | | [@meowgorithm](https://github.com/meowgorithm) | Product visionary bridging technology and user experience.
Explore Christian's [GitHub profile](https://github.com/meowgorithm) and [personal website](https://meowgorithm.com).
Follow on [Twitter](https://twitter.com/meowgorithm) for product insights. | ![](https://github.com/meowgorithm.png) | | [@raphamorim](https://github.com/raphamorim) | Ambitious intern making waves in the tech world.
Check out Rapha's [GitHub repositories](https://github.com/raphamorim) and [growing portfolio](https://raphamorim.dev).
Connect on [LinkedIn](https://www.linkedin.com/in/raphamorim) for emerging talent. | ![](https://github.com/raphamorim.png) | glamour-0.10.0/styles/examples/table_with_footer_links_complex.style000066400000000000000000000004031500000454500260760ustar00rootroot00000000000000{ "link": { "color": "30", "underline": true }, "link_text": { "color": "35", "bold": true }, "image": { "color": "212", "underline": true }, "image_text": { "color": "243", "format": "Image: {{.text}} →" } } glamour-0.10.0/styles/examples/table_with_footer_links_huge.md000066400000000000000000000005631500000454500246260ustar00rootroot00000000000000| Word | Link | | ---- | ---- | | foo | [foo](https://www.pudim.com.br/huge-0/huge-1/huge-2/huge-3/huge-4/huge-5/huge-6/huge-7/huge-8/huge-9/) | | bar | [bar](https://www.pudim.com.br/huge-0/huge-1/huge-2/huge-3/huge-4/huge-5/huge-6/huge-7/huge-8/huge-9/) | | baz | [baz](https://www.pudim.com.br/huge-0/huge-1/huge-2/huge-3/huge-4/huge-5/huge-6/huge-7/huge-8/huge-9/) | glamour-0.10.0/styles/examples/table_with_footer_links_huge.style000066400000000000000000000001671500000454500253660ustar00rootroot00000000000000{ "link": { "color": "30", "underline": true }, "link_text": { "color": "35", "bold": true } } glamour-0.10.0/styles/examples/table_with_footer_links_no_color.md000066400000000000000000000007341500000454500255100ustar00rootroot00000000000000| Name | Role | Handle | | ---- | ---- | ------ | | Andrey | Engineering | [@andreynering](https://github.com/andreynering) | | Ayman | Engineering | [@aymanbagabas](https://github.com/aymanbagabas) | | Bash | Engineering | [@bashbunni](https://github.com/bashbunni) | | Carlos | Engineering | [@caarlos0](https://github.com/caarlos0) | | Christian | Product | [@meowgorithm](https://github.com/meowgorithm) | | Rapha | Intern | [@raphamorim](https://github.com/raphamorim) | glamour-0.10.0/styles/examples/table_with_footer_links_no_color.style000066400000000000000000000000031500000454500262350ustar00rootroot00000000000000{} glamour-0.10.0/styles/examples/table_with_footer_links_repeated.md000066400000000000000000000002411500000454500254600ustar00rootroot00000000000000| Word | Link | | ---- | ---- | | foo | [link](https://www.pudim.com.br) | | bar | [link](https://www.pudim.com.br) | | baz | [link](https://www.pudim.com.br) | glamour-0.10.0/styles/examples/table_with_footer_links_repeated.style000066400000000000000000000001671500000454500262270ustar00rootroot00000000000000{ "link": { "color": "30", "underline": true }, "link_text": { "color": "35", "bold": true } } glamour-0.10.0/styles/examples/table_with_inline_links.md000066400000000000000000000007341500000454500235760ustar00rootroot00000000000000| Name | Role | Handle | | ---- | ---- | ------ | | Andrey | Engineering | [@andreynering](https://github.com/andreynering) | | Ayman | Engineering | [@aymanbagabas](https://github.com/aymanbagabas) | | Bash | Engineering | [@bashbunni](https://github.com/bashbunni) | | Carlos | Engineering | [@caarlos0](https://github.com/caarlos0) | | Christian | Product | [@meowgorithm](https://github.com/meowgorithm) | | Rapha | Intern | [@raphamorim](https://github.com/raphamorim) | glamour-0.10.0/styles/examples/table_with_inline_links.style000066400000000000000000000001671500000454500243360ustar00rootroot00000000000000{ "link": { "color": "30", "underline": true }, "link_text": { "color": "35", "bold": true } } glamour-0.10.0/styles/examples/table_wrap.md000066400000000000000000000006451500000454500210370ustar00rootroot00000000000000| Name | Description | Type | Required | Default | |---------|----------------------------------------|------|----------|---------| | command | A command to be executed inside the container to assess its health. Each space delimited token of the command is a separate array element. Commands exiting 0 are considered to be successful probes, whilst all other exit codes are considered failures. | yes | hello | yep | glamour-0.10.0/styles/examples/table_wrap.style000066400000000000000000000000031500000454500215630ustar00rootroot00000000000000{} glamour-0.10.0/styles/examples/task.md000066400000000000000000000000531500000454500176520ustar00rootroot00000000000000- [x] Finished Task - [ ] Outstanding Task glamour-0.10.0/styles/examples/task.png000066400000000000000000000002011500000454500200310ustar00rootroot00000000000000version https://git-lfs.github.com/spec/v1 oid sha256:23e8d86e18d11e274d8a3fc787503d0f3e8c67fb5a07360119543c7166c69eb1 size 2373 glamour-0.10.0/styles/examples/task.style000066400000000000000000000002321500000454500204110ustar00rootroot00000000000000{ "list": { "color": "15", "background_color": "52" }, "task": { "ticked": "✓ ", "unticked": "✗ " } } glamour-0.10.0/styles/examples/text.style000066400000000000000000000001461500000454500204370ustar00rootroot00000000000000{ "text": { "bold": true, "color": "15", "background_color": "57" } } glamour-0.10.0/styles/gallery/000077500000000000000000000000001500000454500162115ustar00rootroot00000000000000glamour-0.10.0/styles/gallery/README.md000066400000000000000000000004371500000454500174740ustar00rootroot00000000000000# Glamour Style Section ## Dark ![Glamour Dark Style](./dark.png) ## Light ![Glamour Light Style](./light.png) ## NoTTY Pronounced _naughty_. ![Glamour NoTTY Style](./notty.png) ## Dracula ![Dracula Style](./dracula.png) ## Tokyo Night ![Tokyo Night Style](./tokyo-night.png) glamour-0.10.0/styles/gallery/ascii.png000066400000000000000000000002031500000454500200020ustar00rootroot00000000000000version https://git-lfs.github.com/spec/v1 oid sha256:5128c02d5dbac60af23ae4d277ae0f9b2982d8d7075bdbf3b775bc02495b7648 size 284108 glamour-0.10.0/styles/gallery/auto.png000066400000000000000000000002031500000454500176620ustar00rootroot00000000000000version https://git-lfs.github.com/spec/v1 oid sha256:25ed3a3576a959efeb1c8e770c4550245a88e8864674ec48eb057f0b0a13eacb size 754908 glamour-0.10.0/styles/gallery/dark.png000066400000000000000000000002031500000454500176330ustar00rootroot00000000000000version https://git-lfs.github.com/spec/v1 oid sha256:f79e4f218b0edfa9112d3a4ce0dea9e850d2eb9e029230e8a66ac087c5d91938 size 541064 glamour-0.10.0/styles/gallery/dracula.png000066400000000000000000000002031500000454500203250ustar00rootroot00000000000000version https://git-lfs.github.com/spec/v1 oid sha256:ec587d674b781248779619b13f6500ef5918bd57b37c60d54363f70f61a507cc size 588183 glamour-0.10.0/styles/gallery/light.png000066400000000000000000000002031500000454500200210ustar00rootroot00000000000000version https://git-lfs.github.com/spec/v1 oid sha256:5d06e782f22c9e1028c03b75cc0f1d514637ee20f1d31896326261c984ed4b7a size 567534 glamour-0.10.0/styles/gallery/notty.png000066400000000000000000000002031500000454500200670ustar00rootroot00000000000000version https://git-lfs.github.com/spec/v1 oid sha256:5128c02d5dbac60af23ae4d277ae0f9b2982d8d7075bdbf3b775bc02495b7648 size 284108 glamour-0.10.0/styles/gallery/pink.png000066400000000000000000000002031500000454500176530ustar00rootroot00000000000000version https://git-lfs.github.com/spec/v1 oid sha256:d8f719c370008888a245d9c4c788317ae8a50e9628d6170b0b50fdaf2107a2ed size 513371 glamour-0.10.0/styles/gallery/tokyo-night.png000066400000000000000000000002031500000454500211660ustar00rootroot00000000000000version https://git-lfs.github.com/spec/v1 oid sha256:9fa5bf8f1bfb736708bae6eb83959e5612d9ef18da330d9d5ca36356228cc74b size 557034 glamour-0.10.0/styles/light.json000066400000000000000000000064721500000454500165650ustar00rootroot00000000000000{ "document": { "block_prefix": "\n", "block_suffix": "\n", "color": "234", "margin": 2 }, "block_quote": { "indent": 1, "indent_token": "│ " }, "paragraph": {}, "list": { "level_indent": 2 }, "heading": { "block_suffix": "\n", "color": "27", "bold": true }, "h1": { "prefix": " ", "suffix": " ", "color": "228", "background_color": "63", "bold": true }, "h2": { "prefix": "## " }, "h3": { "prefix": "### " }, "h4": { "prefix": "#### " }, "h5": { "prefix": "##### " }, "h6": { "prefix": "###### ", "bold": false }, "text": {}, "strikethrough": { "crossed_out": true }, "emph": { "italic": true }, "strong": { "bold": true }, "hr": { "color": "249", "format": "\n--------\n" }, "item": { "block_prefix": "• " }, "enumeration": { "block_prefix": ". " }, "task": { "ticked": "[✓] ", "unticked": "[ ] " }, "link": { "color": "36", "underline": true }, "link_text": { "color": "29", "bold": true }, "image": { "color": "205", "underline": true }, "image_text": { "color": "243", "format": "Image: {{.text}} →" }, "code": { "prefix": " ", "suffix": " ", "color": "203", "background_color": "254" }, "code_block": { "color": "242", "margin": 2, "chroma": { "text": { "color": "#2A2A2A" }, "error": { "color": "#F1F1F1", "background_color": "#FF5555" }, "comment": { "color": "#8D8D8D" }, "comment_preproc": { "color": "#FF875F" }, "keyword": { "color": "#279EFC" }, "keyword_reserved": { "color": "#FF5FD2" }, "keyword_namespace": { "color": "#FB406F" }, "keyword_type": { "color": "#7049C2" }, "operator": { "color": "#FF2626" }, "punctuation": { "color": "#FA7878" }, "name": {}, "name_builtin": { "color": "#0A1BB1" }, "name_tag": { "color": "#581290" }, "name_attribute": { "color": "#8362CB" }, "name_class": { "color": "#212121", "underline": true, "bold": true }, "name_constant": { "color": "#581290" }, "name_decorator": { "color": "#A3A322" }, "name_exception": {}, "name_function": { "color": "#019F57" }, "name_other": {}, "literal": {}, "literal_number": { "color": "#22CCAE" }, "literal_date": {}, "literal_string": { "color": "#7E5B38" }, "literal_string_escape": { "color": "#00AEAE" }, "generic_deleted": { "color": "#FD5B5B" }, "generic_emph": { "italic": true }, "generic_inserted": { "color": "#00D787" }, "generic_strong": { "bold": true }, "generic_subheading": { "color": "#777777" }, "background": { "background_color": "#373737" } } }, "table": {}, "definition_list": {}, "definition_term": {}, "definition_description": { "block_prefix": "\n🠶 " }, "html_block": {}, "html_span": {} } glamour-0.10.0/styles/notty.json000066400000000000000000000024051500000454500166230ustar00rootroot00000000000000{ "document": { "block_prefix": "\n", "block_suffix": "\n", "margin": 2 }, "block_quote": { "indent": 1, "indent_token": "| " }, "paragraph": {}, "list": { "level_indent": 4 }, "heading": { "block_suffix": "\n" }, "h1": { "prefix": "# " }, "h2": { "prefix": "## " }, "h3": { "prefix": "### " }, "h4": { "prefix": "#### " }, "h5": { "prefix": "##### " }, "h6": { "prefix": "###### " }, "text": {}, "strikethrough": { "block_prefix": "~~", "block_suffix": "~~" }, "emph": { "block_prefix": "*", "block_suffix": "*" }, "strong": { "block_prefix": "**", "block_suffix": "**" }, "hr": { "format": "\n--------\n" }, "item": { "block_prefix": "• " }, "enumeration": { "block_prefix": ". " }, "task": { "ticked": "[x] ", "unticked": "[ ] " }, "link": {}, "link_text": {}, "image": {}, "image_text": { "format": "Image: {{.text}} →" }, "code": { "block_prefix": "`", "block_suffix": "`" }, "code_block": { "margin": 2 }, "table": {}, "definition_list": {}, "definition_term": {}, "definition_description": { "block_prefix": "\n* " }, "html_block": {}, "html_span": {} } glamour-0.10.0/styles/pink.json000066400000000000000000000025301500000454500164060ustar00rootroot00000000000000{ "document": { "margin": 2 }, "block_quote": { "indent": 1, "indent_token": "│ " }, "paragraph": {}, "list": { "level_indent": 2 }, "heading": { "block_suffix": "\n", "color": "212", "bold": true }, "h1": { "block_prefix": "\n", "block_suffix": "\n" }, "h2": { "prefix": "▌ " }, "h3": { "prefix": "┃ " }, "h4": { "prefix": "│ " }, "h5": { "prefix": "┆ " }, "h6": { "prefix": "┊ ", "bold": false }, "text": {}, "strikethrough": { "crossed_out": true }, "emph": { "italic": true }, "strong": { "bold": true }, "hr": { "color": "212", "format": "\n──────\n" }, "item": { "block_prefix": "• " }, "enumeration": { "block_prefix": ". " }, "task": { "ticked": "[✓] ", "unticked": "[ ] " }, "link": { "color": "99", "underline": true }, "link_text": { "bold": true }, "image": { "underline": true }, "image_text": { "format": "Image: {{.text}}" }, "code": { "prefix": " ", "suffix": " ", "color": "212", "background_color": "236" }, "code_block": {}, "table": {}, "definition_list": {}, "definition_term": {}, "definition_description": { "block_prefix": "\n🠶 " }, "html_block": {}, "html_span": {} } glamour-0.10.0/styles/styles.go000066400000000000000000000374441500000454500164400ustar00rootroot00000000000000// Package styles provides default styles for the glamour package. package styles //go:generate go run ../internal/generate-style-json import ( "github.com/charmbracelet/glamour/ansi" ) const ( defaultListIndent = 2 defaultListLevelIndent = 4 defaultMargin = 2 ) // Default styles. const ( AsciiStyle = "ascii" //nolint: revive AutoStyle = "auto" DarkStyle = "dark" DraculaStyle = "dracula" TokyoNightStyle = "tokyo-night" LightStyle = "light" NoTTYStyle = "notty" PinkStyle = "pink" ) var ( // ASCIIStyleConfig uses only ASCII characters. ASCIIStyleConfig = ansi.StyleConfig{ Document: ansi.StyleBlock{ StylePrimitive: ansi.StylePrimitive{ BlockPrefix: "\n", BlockSuffix: "\n", }, Margin: uintPtr(defaultMargin), }, BlockQuote: ansi.StyleBlock{ StylePrimitive: ansi.StylePrimitive{}, Indent: uintPtr(1), IndentToken: stringPtr("| "), }, Paragraph: ansi.StyleBlock{ StylePrimitive: ansi.StylePrimitive{}, }, List: ansi.StyleList{ StyleBlock: ansi.StyleBlock{ StylePrimitive: ansi.StylePrimitive{}, }, LevelIndent: defaultListLevelIndent, }, Heading: ansi.StyleBlock{ StylePrimitive: ansi.StylePrimitive{ BlockSuffix: "\n", }, }, H1: ansi.StyleBlock{ StylePrimitive: ansi.StylePrimitive{ Prefix: "# ", }, }, H2: ansi.StyleBlock{ StylePrimitive: ansi.StylePrimitive{ Prefix: "## ", }, }, H3: ansi.StyleBlock{ StylePrimitive: ansi.StylePrimitive{ Prefix: "### ", }, }, H4: ansi.StyleBlock{ StylePrimitive: ansi.StylePrimitive{ Prefix: "#### ", }, }, H5: ansi.StyleBlock{ StylePrimitive: ansi.StylePrimitive{ Prefix: "##### ", }, }, H6: ansi.StyleBlock{ StylePrimitive: ansi.StylePrimitive{ Prefix: "###### ", }, }, Strikethrough: ansi.StylePrimitive{ BlockPrefix: "~~", BlockSuffix: "~~", }, Emph: ansi.StylePrimitive{ BlockPrefix: "*", BlockSuffix: "*", }, Strong: ansi.StylePrimitive{ BlockPrefix: "**", BlockSuffix: "**", }, HorizontalRule: ansi.StylePrimitive{ Format: "\n--------\n", }, Item: ansi.StylePrimitive{ BlockPrefix: "• ", }, Enumeration: ansi.StylePrimitive{ BlockPrefix: ". ", }, Task: ansi.StyleTask{ Ticked: "[x] ", Unticked: "[ ] ", }, ImageText: ansi.StylePrimitive{ Format: "Image: {{.text}} →", }, Code: ansi.StyleBlock{ StylePrimitive: ansi.StylePrimitive{ BlockPrefix: "`", BlockSuffix: "`", }, }, CodeBlock: ansi.StyleCodeBlock{ StyleBlock: ansi.StyleBlock{ Margin: uintPtr(defaultMargin), }, }, Table: ansi.StyleTable{ CenterSeparator: stringPtr("|"), ColumnSeparator: stringPtr("|"), RowSeparator: stringPtr("-"), }, DefinitionDescription: ansi.StylePrimitive{ BlockPrefix: "\n* ", }, } // DarkStyleConfig is the default dark style. DarkStyleConfig = ansi.StyleConfig{ Document: ansi.StyleBlock{ StylePrimitive: ansi.StylePrimitive{ BlockPrefix: "\n", BlockSuffix: "\n", Color: stringPtr("252"), }, Margin: uintPtr(defaultMargin), }, BlockQuote: ansi.StyleBlock{ StylePrimitive: ansi.StylePrimitive{}, Indent: uintPtr(1), IndentToken: stringPtr("│ "), }, List: ansi.StyleList{ LevelIndent: defaultListIndent, }, Heading: ansi.StyleBlock{ StylePrimitive: ansi.StylePrimitive{ BlockSuffix: "\n", Color: stringPtr("39"), Bold: boolPtr(true), }, }, H1: ansi.StyleBlock{ StylePrimitive: ansi.StylePrimitive{ Prefix: " ", Suffix: " ", Color: stringPtr("228"), BackgroundColor: stringPtr("63"), Bold: boolPtr(true), }, }, H2: ansi.StyleBlock{ StylePrimitive: ansi.StylePrimitive{ Prefix: "## ", }, }, H3: ansi.StyleBlock{ StylePrimitive: ansi.StylePrimitive{ Prefix: "### ", }, }, H4: ansi.StyleBlock{ StylePrimitive: ansi.StylePrimitive{ Prefix: "#### ", }, }, H5: ansi.StyleBlock{ StylePrimitive: ansi.StylePrimitive{ Prefix: "##### ", }, }, H6: ansi.StyleBlock{ StylePrimitive: ansi.StylePrimitive{ Prefix: "###### ", Color: stringPtr("35"), Bold: boolPtr(false), }, }, Strikethrough: ansi.StylePrimitive{ CrossedOut: boolPtr(true), }, Emph: ansi.StylePrimitive{ Italic: boolPtr(true), }, Strong: ansi.StylePrimitive{ Bold: boolPtr(true), }, HorizontalRule: ansi.StylePrimitive{ Color: stringPtr("240"), Format: "\n--------\n", }, Item: ansi.StylePrimitive{ BlockPrefix: "• ", }, Enumeration: ansi.StylePrimitive{ BlockPrefix: ". ", }, Task: ansi.StyleTask{ StylePrimitive: ansi.StylePrimitive{}, Ticked: "[✓] ", Unticked: "[ ] ", }, Link: ansi.StylePrimitive{ Color: stringPtr("30"), Underline: boolPtr(true), }, LinkText: ansi.StylePrimitive{ Color: stringPtr("35"), Bold: boolPtr(true), }, Image: ansi.StylePrimitive{ Color: stringPtr("212"), Underline: boolPtr(true), }, ImageText: ansi.StylePrimitive{ Color: stringPtr("243"), Format: "Image: {{.text}} →", }, Code: ansi.StyleBlock{ StylePrimitive: ansi.StylePrimitive{ Prefix: " ", Suffix: " ", Color: stringPtr("203"), BackgroundColor: stringPtr("236"), }, }, CodeBlock: ansi.StyleCodeBlock{ StyleBlock: ansi.StyleBlock{ StylePrimitive: ansi.StylePrimitive{ Color: stringPtr("244"), }, Margin: uintPtr(defaultMargin), }, Chroma: &ansi.Chroma{ Text: ansi.StylePrimitive{ Color: stringPtr("#C4C4C4"), }, Error: ansi.StylePrimitive{ Color: stringPtr("#F1F1F1"), BackgroundColor: stringPtr("#F05B5B"), }, Comment: ansi.StylePrimitive{ Color: stringPtr("#676767"), }, CommentPreproc: ansi.StylePrimitive{ Color: stringPtr("#FF875F"), }, Keyword: ansi.StylePrimitive{ Color: stringPtr("#00AAFF"), }, KeywordReserved: ansi.StylePrimitive{ Color: stringPtr("#FF5FD2"), }, KeywordNamespace: ansi.StylePrimitive{ Color: stringPtr("#FF5F87"), }, KeywordType: ansi.StylePrimitive{ Color: stringPtr("#6E6ED8"), }, Operator: ansi.StylePrimitive{ Color: stringPtr("#EF8080"), }, Punctuation: ansi.StylePrimitive{ Color: stringPtr("#E8E8A8"), }, Name: ansi.StylePrimitive{ Color: stringPtr("#C4C4C4"), }, NameBuiltin: ansi.StylePrimitive{ Color: stringPtr("#FF8EC7"), }, NameTag: ansi.StylePrimitive{ Color: stringPtr("#B083EA"), }, NameAttribute: ansi.StylePrimitive{ Color: stringPtr("#7A7AE6"), }, NameClass: ansi.StylePrimitive{ Color: stringPtr("#F1F1F1"), Underline: boolPtr(true), Bold: boolPtr(true), }, NameDecorator: ansi.StylePrimitive{ Color: stringPtr("#FFFF87"), }, NameFunction: ansi.StylePrimitive{ Color: stringPtr("#00D787"), }, LiteralNumber: ansi.StylePrimitive{ Color: stringPtr("#6EEFC0"), }, LiteralString: ansi.StylePrimitive{ Color: stringPtr("#C69669"), }, LiteralStringEscape: ansi.StylePrimitive{ Color: stringPtr("#AFFFD7"), }, GenericDeleted: ansi.StylePrimitive{ Color: stringPtr("#FD5B5B"), }, GenericEmph: ansi.StylePrimitive{ Italic: boolPtr(true), }, GenericInserted: ansi.StylePrimitive{ Color: stringPtr("#00D787"), }, GenericStrong: ansi.StylePrimitive{ Bold: boolPtr(true), }, GenericSubheading: ansi.StylePrimitive{ Color: stringPtr("#777777"), }, Background: ansi.StylePrimitive{ BackgroundColor: stringPtr("#373737"), }, }, }, Table: ansi.StyleTable{ StyleBlock: ansi.StyleBlock{ StylePrimitive: ansi.StylePrimitive{}, }, }, DefinitionDescription: ansi.StylePrimitive{ BlockPrefix: "\n🠶 ", }, } // LightStyleConfig is the default light style. LightStyleConfig = ansi.StyleConfig{ Document: ansi.StyleBlock{ StylePrimitive: ansi.StylePrimitive{ BlockPrefix: "\n", BlockSuffix: "\n", Color: stringPtr("234"), }, Margin: uintPtr(defaultMargin), }, BlockQuote: ansi.StyleBlock{ StylePrimitive: ansi.StylePrimitive{}, Indent: uintPtr(1), IndentToken: stringPtr("│ "), }, List: ansi.StyleList{ LevelIndent: defaultListIndent, }, Heading: ansi.StyleBlock{ StylePrimitive: ansi.StylePrimitive{ BlockSuffix: "\n", Color: stringPtr("27"), Bold: boolPtr(true), }, }, H1: ansi.StyleBlock{ StylePrimitive: ansi.StylePrimitive{ Prefix: " ", Suffix: " ", Color: stringPtr("228"), BackgroundColor: stringPtr("63"), Bold: boolPtr(true), }, }, H2: ansi.StyleBlock{ StylePrimitive: ansi.StylePrimitive{ Prefix: "## ", }, }, H3: ansi.StyleBlock{ StylePrimitive: ansi.StylePrimitive{ Prefix: "### ", }, }, H4: ansi.StyleBlock{ StylePrimitive: ansi.StylePrimitive{ Prefix: "#### ", }, }, H5: ansi.StyleBlock{ StylePrimitive: ansi.StylePrimitive{ Prefix: "##### ", }, }, H6: ansi.StyleBlock{ StylePrimitive: ansi.StylePrimitive{ Prefix: "###### ", Bold: boolPtr(false), }, }, Strikethrough: ansi.StylePrimitive{ CrossedOut: boolPtr(true), }, Emph: ansi.StylePrimitive{ Italic: boolPtr(true), }, Strong: ansi.StylePrimitive{ Bold: boolPtr(true), }, HorizontalRule: ansi.StylePrimitive{ Color: stringPtr("249"), Format: "\n--------\n", }, Item: ansi.StylePrimitive{ BlockPrefix: "• ", }, Enumeration: ansi.StylePrimitive{ BlockPrefix: ". ", }, Task: ansi.StyleTask{ StylePrimitive: ansi.StylePrimitive{}, Ticked: "[✓] ", Unticked: "[ ] ", }, Link: ansi.StylePrimitive{ Color: stringPtr("36"), Underline: boolPtr(true), }, LinkText: ansi.StylePrimitive{ Color: stringPtr("29"), Bold: boolPtr(true), }, Image: ansi.StylePrimitive{ Color: stringPtr("205"), Underline: boolPtr(true), }, ImageText: ansi.StylePrimitive{ Color: stringPtr("243"), Format: "Image: {{.text}} →", }, Code: ansi.StyleBlock{ StylePrimitive: ansi.StylePrimitive{ Prefix: " ", Suffix: " ", Color: stringPtr("203"), BackgroundColor: stringPtr("254"), }, }, CodeBlock: ansi.StyleCodeBlock{ StyleBlock: ansi.StyleBlock{ StylePrimitive: ansi.StylePrimitive{ Color: stringPtr("242"), }, Margin: uintPtr(defaultMargin), }, Chroma: &ansi.Chroma{ Text: ansi.StylePrimitive{ Color: stringPtr("#2A2A2A"), }, Error: ansi.StylePrimitive{ Color: stringPtr("#F1F1F1"), BackgroundColor: stringPtr("#FF5555"), }, Comment: ansi.StylePrimitive{ Color: stringPtr("#8D8D8D"), }, CommentPreproc: ansi.StylePrimitive{ Color: stringPtr("#FF875F"), }, Keyword: ansi.StylePrimitive{ Color: stringPtr("#279EFC"), }, KeywordReserved: ansi.StylePrimitive{ Color: stringPtr("#FF5FD2"), }, KeywordNamespace: ansi.StylePrimitive{ Color: stringPtr("#FB406F"), }, KeywordType: ansi.StylePrimitive{ Color: stringPtr("#7049C2"), }, Operator: ansi.StylePrimitive{ Color: stringPtr("#FF2626"), }, Punctuation: ansi.StylePrimitive{ Color: stringPtr("#FA7878"), }, NameBuiltin: ansi.StylePrimitive{ Color: stringPtr("#0A1BB1"), }, NameTag: ansi.StylePrimitive{ Color: stringPtr("#581290"), }, NameAttribute: ansi.StylePrimitive{ Color: stringPtr("#8362CB"), }, NameClass: ansi.StylePrimitive{ Color: stringPtr("#212121"), Underline: boolPtr(true), Bold: boolPtr(true), }, NameConstant: ansi.StylePrimitive{ Color: stringPtr("#581290"), }, NameDecorator: ansi.StylePrimitive{ Color: stringPtr("#A3A322"), }, NameFunction: ansi.StylePrimitive{ Color: stringPtr("#019F57"), }, LiteralNumber: ansi.StylePrimitive{ Color: stringPtr("#22CCAE"), }, LiteralString: ansi.StylePrimitive{ Color: stringPtr("#7E5B38"), }, LiteralStringEscape: ansi.StylePrimitive{ Color: stringPtr("#00AEAE"), }, GenericDeleted: ansi.StylePrimitive{ Color: stringPtr("#FD5B5B"), }, GenericEmph: ansi.StylePrimitive{ Italic: boolPtr(true), }, GenericInserted: ansi.StylePrimitive{ Color: stringPtr("#00D787"), }, GenericStrong: ansi.StylePrimitive{ Bold: boolPtr(true), }, GenericSubheading: ansi.StylePrimitive{ Color: stringPtr("#777777"), }, Background: ansi.StylePrimitive{ BackgroundColor: stringPtr("#373737"), }, }, }, Table: ansi.StyleTable{ StyleBlock: ansi.StyleBlock{ StylePrimitive: ansi.StylePrimitive{}, }, }, DefinitionDescription: ansi.StylePrimitive{ BlockPrefix: "\n🠶 ", }, } // PinkStyleConfig is the default pink style. PinkStyleConfig = ansi.StyleConfig{ Document: ansi.StyleBlock{ Margin: uintPtr(defaultMargin), }, BlockQuote: ansi.StyleBlock{ Indent: uintPtr(1), IndentToken: stringPtr("│ "), }, List: ansi.StyleList{ LevelIndent: defaultListIndent, }, Heading: ansi.StyleBlock{ StylePrimitive: ansi.StylePrimitive{ BlockSuffix: "\n", Color: stringPtr("212"), Bold: boolPtr(true), }, }, H1: ansi.StyleBlock{ StylePrimitive: ansi.StylePrimitive{ BlockSuffix: "\n", BlockPrefix: "\n", Prefix: "", }, }, H2: ansi.StyleBlock{ StylePrimitive: ansi.StylePrimitive{ Prefix: "▌ ", }, }, H3: ansi.StyleBlock{ StylePrimitive: ansi.StylePrimitive{ Prefix: "┃ ", }, }, H4: ansi.StyleBlock{ StylePrimitive: ansi.StylePrimitive{ Prefix: "│ ", }, }, H5: ansi.StyleBlock{ StylePrimitive: ansi.StylePrimitive{ Prefix: "┆ ", }, }, H6: ansi.StyleBlock{ StylePrimitive: ansi.StylePrimitive{ Prefix: "┊ ", Bold: boolPtr(false), }, }, Text: ansi.StylePrimitive{}, Strikethrough: ansi.StylePrimitive{ CrossedOut: boolPtr(true), }, Emph: ansi.StylePrimitive{ Italic: boolPtr(true), }, Strong: ansi.StylePrimitive{ Bold: boolPtr(true), }, HorizontalRule: ansi.StylePrimitive{ Color: stringPtr("212"), Format: "\n──────\n", }, Item: ansi.StylePrimitive{ BlockPrefix: "• ", }, Enumeration: ansi.StylePrimitive{ BlockPrefix: ". ", }, Task: ansi.StyleTask{ Ticked: "[✓] ", Unticked: "[ ] ", }, Link: ansi.StylePrimitive{ Color: stringPtr("99"), Underline: boolPtr(true), }, LinkText: ansi.StylePrimitive{ Bold: boolPtr(true), }, Image: ansi.StylePrimitive{ Underline: boolPtr(true), }, ImageText: ansi.StylePrimitive{ Format: "Image: {{.text}}", }, Code: ansi.StyleBlock{ StylePrimitive: ansi.StylePrimitive{ Color: stringPtr("212"), BackgroundColor: stringPtr("236"), Prefix: " ", Suffix: " ", }, }, Table: ansi.StyleTable{}, DefinitionList: ansi.StyleBlock{}, DefinitionTerm: ansi.StylePrimitive{}, DefinitionDescription: ansi.StylePrimitive{ BlockPrefix: "\n🠶 ", }, HTMLBlock: ansi.StyleBlock{}, HTMLSpan: ansi.StyleBlock{}, } // NoTTYStyleConfig is the default notty style. NoTTYStyleConfig = ASCIIStyleConfig // DefaultStyles are the default styles. DefaultStyles = map[string]*ansi.StyleConfig{ AsciiStyle: &ASCIIStyleConfig, DarkStyle: &DarkStyleConfig, LightStyle: &LightStyleConfig, NoTTYStyle: &NoTTYStyleConfig, PinkStyle: &PinkStyleConfig, // Popular themes DraculaStyle: &DraculaStyleConfig, TokyoNightStyle: &TokyoNightStyleConfig, } ) func boolPtr(b bool) *bool { return &b } func stringPtr(s string) *string { return &s } func uintPtr(u uint) *uint { return &u } glamour-0.10.0/styles/tokyo-night.go000066400000000000000000000114361500000454500173620ustar00rootroot00000000000000package styles import "github.com/charmbracelet/glamour/ansi" // TokyoNightStyleConfig is the tokyo night style. var TokyoNightStyleConfig = ansi.StyleConfig{ Document: ansi.StyleBlock{ StylePrimitive: ansi.StylePrimitive{ BlockPrefix: "\n", BlockSuffix: "\n", Color: stringPtr("#a9b1d6"), }, Margin: uintPtr(defaultMargin), }, BlockQuote: ansi.StyleBlock{ StylePrimitive: ansi.StylePrimitive{}, Indent: uintPtr(1), IndentToken: stringPtr("│ "), }, List: ansi.StyleList{ StyleBlock: ansi.StyleBlock{ StylePrimitive: ansi.StylePrimitive{ Color: stringPtr("#a9b1d6"), }, }, LevelIndent: defaultListIndent, }, Heading: ansi.StyleBlock{ StylePrimitive: ansi.StylePrimitive{ BlockSuffix: "\n", Color: stringPtr("#bb9af7"), Bold: boolPtr(true), }, }, H1: ansi.StyleBlock{ StylePrimitive: ansi.StylePrimitive{ Prefix: "# ", Bold: boolPtr(true), }, }, H2: ansi.StyleBlock{ StylePrimitive: ansi.StylePrimitive{ Prefix: "## ", }, }, H3: ansi.StyleBlock{ StylePrimitive: ansi.StylePrimitive{ Prefix: "### ", }, }, H4: ansi.StyleBlock{ StylePrimitive: ansi.StylePrimitive{ Prefix: "#### ", }, }, H5: ansi.StyleBlock{ StylePrimitive: ansi.StylePrimitive{ Prefix: "##### ", }, }, H6: ansi.StyleBlock{ StylePrimitive: ansi.StylePrimitive{ Prefix: "###### ", }, }, Strikethrough: ansi.StylePrimitive{ CrossedOut: boolPtr(true), }, Emph: ansi.StylePrimitive{ Italic: boolPtr(true), }, Strong: ansi.StylePrimitive{ Bold: boolPtr(true), }, HorizontalRule: ansi.StylePrimitive{ Color: stringPtr("#565f89"), Format: "\n--------\n", }, Item: ansi.StylePrimitive{ BlockPrefix: "• ", }, Enumeration: ansi.StylePrimitive{ BlockPrefix: ". ", Color: stringPtr("#7aa2f7"), }, Task: ansi.StyleTask{ StylePrimitive: ansi.StylePrimitive{}, Ticked: "[✓] ", Unticked: "[ ] ", }, Link: ansi.StylePrimitive{ Color: stringPtr("#7aa2f7"), Underline: boolPtr(true), }, LinkText: ansi.StylePrimitive{ Color: stringPtr("#2ac3de"), }, Image: ansi.StylePrimitive{ Color: stringPtr("#7aa2f7"), Underline: boolPtr(true), }, ImageText: ansi.StylePrimitive{ Color: stringPtr("#2ac3de"), Format: "Image: {{.text}} →", }, Code: ansi.StyleBlock{ StylePrimitive: ansi.StylePrimitive{ Color: stringPtr("#9ece6a"), }, }, CodeBlock: ansi.StyleCodeBlock{ StyleBlock: ansi.StyleBlock{ StylePrimitive: ansi.StylePrimitive{ Color: stringPtr("#ff9e64"), }, Margin: uintPtr(defaultMargin), }, Chroma: &ansi.Chroma{ Text: ansi.StylePrimitive{ Color: stringPtr("#a9b1d6"), }, Error: ansi.StylePrimitive{ Color: stringPtr("#a9b1d6"), BackgroundColor: stringPtr("#f7768e"), }, Comment: ansi.StylePrimitive{ Color: stringPtr("#565f89"), }, CommentPreproc: ansi.StylePrimitive{ Color: stringPtr("#2ac3de"), }, Keyword: ansi.StylePrimitive{ Color: stringPtr("#2ac3de"), }, KeywordReserved: ansi.StylePrimitive{ Color: stringPtr("#2ac3de"), }, KeywordNamespace: ansi.StylePrimitive{ Color: stringPtr("#2ac3de"), }, KeywordType: ansi.StylePrimitive{ Color: stringPtr("#7aa2f7"), }, Operator: ansi.StylePrimitive{ Color: stringPtr("#2ac3de"), }, Punctuation: ansi.StylePrimitive{ Color: stringPtr("#a9b1d6"), }, Name: ansi.StylePrimitive{ Color: stringPtr("#7aa2f7"), }, NameConstant: ansi.StylePrimitive{ Color: stringPtr("#bb9af7"), }, NameBuiltin: ansi.StylePrimitive{ Color: stringPtr("#7aa2f7"), }, NameTag: ansi.StylePrimitive{ Color: stringPtr("#2ac3de"), }, NameAttribute: ansi.StylePrimitive{ Color: stringPtr("#9ece6a"), }, NameClass: ansi.StylePrimitive{ Color: stringPtr("#7aa2f7"), }, NameDecorator: ansi.StylePrimitive{ Color: stringPtr("#9ece6a"), }, NameFunction: ansi.StylePrimitive{ Color: stringPtr("#9ece6a"), }, LiteralNumber: ansi.StylePrimitive{}, LiteralString: ansi.StylePrimitive{ Color: stringPtr("#e0af68"), }, LiteralStringEscape: ansi.StylePrimitive{ Color: stringPtr("#2ac3de"), }, GenericDeleted: ansi.StylePrimitive{ Color: stringPtr("#f7768e"), }, GenericEmph: ansi.StylePrimitive{ Italic: boolPtr(true), }, GenericInserted: ansi.StylePrimitive{ Color: stringPtr("#9ece6a"), }, GenericStrong: ansi.StylePrimitive{ Bold: boolPtr(true), }, GenericSubheading: ansi.StylePrimitive{ Color: stringPtr("#bb9af7"), }, Background: ansi.StylePrimitive{ BackgroundColor: stringPtr("#1a1b26"), }, }, }, Table: ansi.StyleTable{ StyleBlock: ansi.StyleBlock{ StylePrimitive: ansi.StylePrimitive{}, }, }, DefinitionDescription: ansi.StylePrimitive{ BlockPrefix: "\n🠶 ", }, } glamour-0.10.0/styles/tokyo_night.json000066400000000000000000000062621500000454500200110ustar00rootroot00000000000000{ "document": { "block_prefix": "\n", "block_suffix": "\n", "color": "#a9b1d6", "margin": 2 }, "block_quote": { "indent": 1, "indent_token": "│ " }, "paragraph": {}, "list": { "color": "#a9b1d6", "level_indent": 2 }, "heading": { "block_suffix": "\n", "color": "#bb9af7", "bold": true }, "h1": { "prefix": "# ", "bold": true }, "h2": { "prefix": "## " }, "h3": { "prefix": "### " }, "h4": { "prefix": "#### " }, "h5": { "prefix": "##### " }, "h6": { "prefix": "###### " }, "text": {}, "strikethrough": { "crossed_out": true }, "emph": { "italic": true }, "strong": { "bold": true }, "hr": { "color": "#565f89", "format": "\n--------\n" }, "item": { "block_prefix": "• " }, "enumeration": { "block_prefix": ". ", "color": "#7aa2f7" }, "task": { "ticked": "[✓] ", "unticked": "[ ] " }, "link": { "color": "#7aa2f7", "underline": true }, "link_text": { "color": "#2ac3de" }, "image": { "color": "#7aa2f7", "underline": true }, "image_text": { "color": "#2ac3de", "format": "Image: {{.text}} →" }, "code": { "color": "#9ece6a" }, "code_block": { "color": "#ff9e64", "margin": 2, "chroma": { "text": { "color": "#a9b1d6" }, "error": { "color": "#a9b1d6", "background_color": "#f7768e" }, "comment": { "color": "#565f89" }, "comment_preproc": { "color": "#2ac3de" }, "keyword": { "color": "#2ac3de" }, "keyword_reserved": { "color": "#2ac3de" }, "keyword_namespace": { "color": "#2ac3de" }, "keyword_type": { "color": "#7aa2f7" }, "operator": { "color": "#2ac3de" }, "punctuation": { "color": "#a9b1d6" }, "name": { "color": "#7aa2f7" }, "name_builtin": { "color": "#7aa2f7" }, "name_tag": { "color": "#2ac3de" }, "name_attribute": { "color": "#9ece6a" }, "name_class": { "color": "#7aa2f7" }, "name_constant": { "color": "#bb9af7" }, "name_decorator": { "color": "#9ece6a" }, "name_exception": {}, "name_function": { "color": "#9ece6a" }, "name_other": {}, "literal": {}, "literal_number": {}, "literal_date": {}, "literal_string": { "color": "#e0af68" }, "literal_string_escape": { "color": "#2ac3de" }, "generic_deleted": { "color": "#f7768e" }, "generic_emph": { "italic": true }, "generic_inserted": { "color": "#9ece6a" }, "generic_strong": { "bold": true }, "generic_subheading": { "color": "#bb9af7" }, "background": { "background_color": "#1a1b26" } } }, "table": {}, "definition_list": {}, "definition_term": {}, "definition_description": { "block_prefix": "\n🠶 " }, "html_block": {}, "html_span": {} } glamour-0.10.0/testdata/000077500000000000000000000000001500000454500150405ustar00rootroot00000000000000glamour-0.10.0/testdata/TestCapitalization.golden000066400000000000000000000124371500000454500220540ustar00rootroot00000000000000   EVERYTHING IS UPPERCASE                                                                                                                                    ## Everything Is Titled                                                                                                                                     ### everything is lowercase                                                   glamour-0.10.0/testdata/TestRenderHelpers.golden000066400000000000000000001004511500000454500216350ustar00rootroot00000000000000   Gold                                                                                                                                                       Render markdown on the CLI, with pizzazz!                                                                                                                   ## What is it?                                                                                                                                              Gold is a Golang library that allows you to use JSON based stylesheets to     render Markdown files in the terminal. Just like CSS, you can define color    and style attributes on Markdown elements. The difference is that you use     ANSI color and terminal codes instead of CSS properties and hex colors.                                                                                     ## Usage                                                                                                                                                    See cmd/gold /cmd/gold/.                                                                                                                                    ## Example Output                                                                                                                                           Image: Gold Dark Style →                                                      https://github.com/charmbracelet/gold/raw/master/styles/gallery/dark.png                                                                                   Check out the Gold Style Gallery                                              https://github.com/charmbracelet/gold/blob/master/styles/gallery/README.md!                                                                                 ## Colors                                                                                                                                                   Currently  gold  uses the Aurora ANSI colors                                  https://godoc.org/github.com/logrusorgru/aurora#Index.                                                                                                      ## Development                                                                                                                                              Style definitions located in  styles/  can be embedded into the binary by     running statik https://github.com/rakyll/statik:                                                                                                             statik -f -src styles -include "*.json"                                                                                                                   You can re-generate screenshots of all available styles by running            gallery.sh . This requires  termshot  and  pngcrush  installed on your        system!                                                                      glamour-0.10.0/testdata/TestTermRenderer.golden000066400000000000000000001004511500000454500214710ustar00rootroot00000000000000   Gold                                                                                                                                                       Render markdown on the CLI, with pizzazz!                                                                                                                   ## What is it?                                                                                                                                              Gold is a Golang library that allows you to use JSON based stylesheets to     render Markdown files in the terminal. Just like CSS, you can define color    and style attributes on Markdown elements. The difference is that you use     ANSI color and terminal codes instead of CSS properties and hex colors.                                                                                     ## Usage                                                                                                                                                    See cmd/gold /cmd/gold/.                                                                                                                                    ## Example Output                                                                                                                                           Image: Gold Dark Style →                                                      https://github.com/charmbracelet/gold/raw/master/styles/gallery/dark.png                                                                                   Check out the Gold Style Gallery                                              https://github.com/charmbracelet/gold/blob/master/styles/gallery/README.md!                                                                                 ## Colors                                                                                                                                                   Currently  gold  uses the Aurora ANSI colors                                  https://godoc.org/github.com/logrusorgru/aurora#Index.                                                                                                      ## Development                                                                                                                                              Style definitions located in  styles/  can be embedded into the binary by     running statik https://github.com/rakyll/statik:                                                                                                             statik -f -src styles -include "*.json"                                                                                                                   You can re-generate screenshots of all available styles by running            gallery.sh . This requires  termshot  and  pngcrush  installed on your        system!                                                                      glamour-0.10.0/testdata/TestTermRendererWriter.golden000066400000000000000000001004511500000454500226660ustar00rootroot00000000000000   Gold                                                                                                                                                       Render markdown on the CLI, with pizzazz!                                                                                                                   ## What is it?                                                                                                                                              Gold is a Golang library that allows you to use JSON based stylesheets to     render Markdown files in the terminal. Just like CSS, you can define color    and style attributes on Markdown elements. The difference is that you use     ANSI color and terminal codes instead of CSS properties and hex colors.                                                                                     ## Usage                                                                                                                                                    See cmd/gold /cmd/gold/.                                                                                                                                    ## Example Output                                                                                                                                           Image: Gold Dark Style →                                                      https://github.com/charmbracelet/gold/raw/master/styles/gallery/dark.png                                                                                   Check out the Gold Style Gallery                                              https://github.com/charmbracelet/gold/blob/master/styles/gallery/README.md!                                                                                 ## Colors                                                                                                                                                   Currently  gold  uses the Aurora ANSI colors                                  https://godoc.org/github.com/logrusorgru/aurora#Index.                                                                                                      ## Development                                                                                                                                              Style definitions located in  styles/  can be embedded into the binary by     running statik https://github.com/rakyll/statik:                                                                                                             statik -f -src styles -include "*.json"                                                                                                                   You can re-generate screenshots of all available styles by running            gallery.sh . This requires  termshot  and  pngcrush  installed on your        system!                                                                      glamour-0.10.0/testdata/TestWithChromaFormatter.md000066400000000000000000000004641500000454500221570ustar00rootroot00000000000000## Usage ```go import "github.com/charmbracelet/glamour" in := `# Hello World This is a simple example of Markdown rendering with Glamour! Check out the [other examples](https://github.com/charmbracelet/glamour/tree/master/examples) too. Bye! ` out, err := glamour.Render(in, "dark") fmt.Print(out) ``` glamour-0.10.0/testdata/TestWithChromaFormatterCustom.golden000066400000000000000000000346551500000454500242330ustar00rootroot00000000000000  ## Usage                                                                                                                                                      import "github.com/charmbracelet/glamour"                                                                                                                   in := `# Hello World                                                                                                                                        This is a simple example of Markdown rendering with Glamour!                  Check out the [other examples](https://github.                              com/charmbracelet/glamour/tree/master/examples) too.                                                                                                          Bye!                                                                          `                                                                                                                                                           out, err := glamour.Render(in, "dark")                                        fmt.Print(out)                                                              glamour-0.10.0/testdata/TestWithChromaFormatterDefault.golden000066400000000000000000000353051500000454500243360ustar00rootroot00000000000000  ## Usage                                                                                                                                                      import "github.com/charmbracelet/glamour"                                                                                                                   in := `# Hello World                                                                                                                                        This is a simple example of Markdown rendering with Glamour!                  Check out the [other examples](https://github.                              com/charmbracelet/glamour/tree/master/examples) too.                                                                                                          Bye!                                                                          `                                                                                                                                                           out, err := glamour.Render(in, "dark")                                        fmt.Print(out)                                                              glamour-0.10.0/testdata/TestWithPreservedNewLines.golden000066400000000000000000000006251500000454500233350ustar00rootroot00000000000000Preserving line breaks will ensure that this text displays on two separate lines While this text appears on one line, it will wrap when the text meets the renderer's default value of 80 characters glamour-0.10.0/testdata/custom.style000066400000000000000000000064211500000454500174370ustar00rootroot00000000000000{ "document": { "block_prefix": "\n", "block_suffix": "\n", "color": "252", "margin": 2 }, "block_quote": { "indent": 1, "indent_token": "│ " }, "paragraph": {}, "list": { "level_indent": 2 }, "heading": { "block_suffix": "\n", "color": "39", "bold": true }, "h1": { "prefix": " ", "suffix": " ", "color": "228", "background_color": "63", "bold": true }, "h6": { "prefix": " ", "color": "35", "bold": false }, "text": {}, "strikethrough": { "crossed_out": true }, "emph": { "italic": true }, "strong": { "bold": true }, "hr": { "color": "240", "format": "\n--------\n" }, "item": { "block_prefix": "• " }, "enumeration": { "block_prefix": ". " }, "task": { "ticked": "[✓] ", "unticked": "[ ] " }, "link": { "color": "30", "underline": true }, "link_text": { "color": "35", "bold": true }, "image": { "color": "212", "underline": true }, "image_text": { "color": "243", "format": "Image: {{.text}} →" }, "code": { "prefix": " ", "suffix": " ", "color": "203", "background_color": "236" }, "code_block": { "color": "244", "margin": 2, "chroma": { "text": { "color": "#C4C4C4" }, "error": { "color": "#F1F1F1", "background_color": "#F05B5B" }, "comment": { "color": "#676767" }, "comment_preproc": { "color": "#FF875F" }, "keyword": { "color": "#00AAFF" }, "keyword_reserved": { "color": "#FF5FD2" }, "keyword_namespace": { "color": "#FF5F87" }, "keyword_type": { "color": "#6E6ED8" }, "operator": { "color": "#EF8080" }, "punctuation": { "color": "#E8E8A8" }, "name": { "color": "#C4C4C4" }, "name_builtin": { "color": "#FF8EC7" }, "name_tag": { "color": "#B083EA" }, "name_attribute": { "color": "#7A7AE6" }, "name_class": { "color": "#F1F1F1", "underline": true, "bold": true }, "name_constant": {}, "name_decorator": { "color": "#FFFF87" }, "name_exception": {}, "name_function": { "color": "#00D787" }, "name_other": {}, "literal": {}, "literal_number": { "color": "#6EEFC0" }, "literal_date": {}, "literal_string": { "color": "#C69669" }, "literal_string_escape": { "color": "#AFFFD7" }, "generic_deleted": { "color": "#FD5B5B" }, "generic_emph": { "italic": true }, "generic_inserted": { "color": "#00D787" }, "generic_strong": { "bold": true }, "generic_subheading": { "color": "#777777" }, "background": { "background_color": "#373737" } } }, "table": { "center_separator": "┼", "column_separator": "│", "row_separator": "─" }, "definition_list": {}, "definition_term": {}, "definition_description": { "block_prefix": "\n🠶 " }, "html_block": {}, "html_span": {} } glamour-0.10.0/testdata/empty.style000066400000000000000000000000031500000454500172510ustar00rootroot00000000000000{} glamour-0.10.0/testdata/example.md000066400000000000000000000030441500000454500170160ustar00rootroot00000000000000Glamour ======= A casual introduction. 你好世界! ## Let’s talk about artichokes The _artichoke_ is mentioned as a garden plant in the 8th century BC by Homer **and** Hesiod. The naturally occurring variant of the artichoke, the cardoon, which is native to the Mediterranean area, also has records of use as a food among the ancient Greeks and Romans. Pliny the Elder mentioned growing of _carduus_ in Carthage and Cordoba. > He holds him with a skinny hand, > ‘There was a ship,’ quoth he. > ‘Hold off! unhand me, grey-beard loon!’ > An artichoke, dropt he. --Samuel Taylor Coleridge, [The Rime of the Ancient Mariner][rime] [rime]: https://poetryfoundation.org/poems/43997/ ## Other foods worth mentioning 1. Carrots 1. Celery 1. Tacos * Soft * Hard 1. Cucumber ## Things to eat today * [x] Carrots * [x] Ramen * [ ] Currywurst ### Power levels of the aforementioned foods | Name | Power | Comment | | --- | --- | --- | | Carrots | 9001 | It’s over 9000?! | | Ramen | 9002 | Also over 9000?! | | Currywurst | 10000 | What?! | ## Currying Artichokes Here’s a bit of code in [Haskell](https://haskell.org), because we are fancy. Remember that to compile Haskell you’ll need `ghc`. ```haskell module Main where import Data.List (intercalate) hello :: String -> String hello s = "Hello, " <> s <> "." main :: IO () main = putStrLn $ intercalate "\n" $ hello <$> [ "artichoke", "alcachofa" ] ``` *** _Alcachofa_, if you were wondering, is artichoke in Spanish. glamour-0.10.0/testdata/issues/000077500000000000000000000000001500000454500163535ustar00rootroot00000000000000glamour-0.10.0/testdata/issues/106.md000066400000000000000000000001621500000454500172020ustar00rootroot00000000000000- \`hi\` - \\hi - \*hi - \_hi - \{hi\} - \[hi\] - \ - \(hi\) - \# hi - \+ hi - \- hi - \. hi - \! hi - \| hi glamour-0.10.0/testdata/issues/107.md000066400000000000000000000002751500000454500172100ustar00rootroot00000000000000```ini [Mount] Options=reconnect,ServerAliveInterval=15,ServerAliveCountMax=3,noauto,_netdev,allow_other,uid=1000,gid=1000,IdentityFile=/PATH/TO/SSH-KEY/id_rsa,StrictHostKeyChecking=no ``` glamour-0.10.0/testdata/issues/117.md000066400000000000000000000001571500000454500172100ustar00rootroot00000000000000| cmd | descr | | ------------- | ---------------- | | `glow config` | open glow config | glamour-0.10.0/testdata/issues/149.md000066400000000000000000000002421500000454500172100ustar00rootroot00000000000000[a](http://example.com/with-a-big-path/likely-to-use-more-than-one-line?why-not=after-all-why-not-use-queryparams-too&abc=123) glamour-0.10.0/testdata/issues/172.md000066400000000000000000000003251500000454500172060ustar00rootroot00000000000000 > The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog. glamour-0.10.0/testdata/issues/237.md000066400000000000000000000004541500000454500172130ustar00rootroot00000000000000> Content Security Policy (CSP) is an added layer of security that helps to detect and mitigate certain types of attacks, including Cross-Site Scripting (XSS) and data injection attacks. These attacks are used for everything from data theft, to site defacement, to malware distribution. > > from MDN glamour-0.10.0/testdata/issues/239.md000066400000000000000000000001311500000454500172050ustar00rootroot00000000000000First term : Definition one of first term. Second term : Definition one of second term. glamour-0.10.0/testdata/issues/257.md000066400000000000000000000000611500000454500172070ustar00rootroot00000000000000```vim set runtimepath^=$XDG_CONFIG_HOME/vim ``` glamour-0.10.0/testdata/issues/290.md000066400000000000000000000001031500000454500172010ustar00rootroot00000000000000- **test@example.com** - https://google.com - _https://google.com_ glamour-0.10.0/testdata/issues/312.md000066400000000000000000000005471500000454500172100ustar00rootroot00000000000000# File **bold text with [URL](https://www.example.com)** _italic text with [URL](https://www.example.com)_ [URL](https://www.example.com) [url with **bold** within](https://www.example.com) [url with _italic_ within](https://www.example.com) [**entire url text is bold**](https://www.example.com) [_entire url text is italic_](https://www.example.com) glamour-0.10.0/testdata/issues/313.md000066400000000000000000000001421500000454500172000ustar00rootroot00000000000000> This is a block quote > > > This is the nested quote > > This is part of the outer block quote. glamour-0.10.0/testdata/issues/315.md000066400000000000000000000002371500000454500172070ustar00rootroot00000000000000| Expression | Value | Type | | --------------------------------- | ----- | ---- | | `(1 >= 26) \|\| (12 >= 6)`{.java} | s | a | glamour-0.10.0/testdata/issues/316.md000066400000000000000000000002401500000454500172020ustar00rootroot00000000000000| A | B | | --------------------------: | ----- | | [Here](https://example.com) | hello | | https://autolink.com | world | glamour-0.10.0/testdata/issues/42.md000066400000000000000000000004351500000454500171240ustar00rootroot00000000000000If you want to make a more significant change, please first [open an issue](https://github.com/twpayne/chezmoi/issues/new) to discuss the change that you want to make. Dave Cheney gives a [good rationale](https://dave.cheney.net/2019/02/18/talk-then-code) as to why this is important. glamour-0.10.0/testdata/issues/43.md000066400000000000000000000004501500000454500171220ustar00rootroot00000000000000* [Getting started](#getting-started) * [Developing locally](#developing-locally) * [Documentation changes](#documentation-changes) * [Contributing changes](#contributing-changes) * [Managing releases](#managing-releases) * [Packaging](#packaging) * [Updating the website](#updating-the-website) glamour-0.10.0/testdata/issues/44.md000066400000000000000000000016261500000454500171310ustar00rootroot00000000000000| Distribution | Architectures | Package | | ------------ | --------------------------------------------------------- | ------------------------------------------------------------------------- | | Debian | `amd64`, `arm64`, `armel`, `i386`, `ppc64`, `ppc64le` | [`deb`](https://github.com/twpayne/chezmoi/releases/latest) | | RedHat | `aarch64`, `armhfp`, `i686`, `ppc64`, `ppc64le`, `x86_64` | [`rpm`](https://github.com/twpayne/chezmoi/releases/latest) | | OpenSUSE | `aarch64`, `armhfp`, `i686`, `ppc64`, `ppc64le`, `x86_64` | [`rpm`](https://github.com/twpayne/chezmoi/releases/latest) | | Ubuntu | `amd64`, `arm64`, `armel`, `i386`, `ppc64`, `ppc64le` | [`deb`](https://github.com/twpayne/chezmoi/releases/latest) | glamour-0.10.0/testdata/issues/46_1.md000066400000000000000000000001501500000454500173420ustar00rootroot00000000000000- Navigation - Familiar shortcuts (arrows, ~, -, @), quick reference glamour-0.10.0/testdata/issues/46_2.md000066400000000000000000000016311500000454500173500ustar00rootroot00000000000000| Dependency | Installation | Operation | | --- | --- | --- | | xdg-open (Linux), open(1) (macOS), cygstart (Cygwin) | base | desktop opener | | file, coreutils (cp, mv, rm), xargs | base | file type, copy, move and remove | | tar, (un)zip [atool/bsdtar for more formats] | base | create, list, extract tar, gzip, bzip2, zip | | archivemount, fusermount(3) | optional | mount, unmount archives | | sshfs, [rclone](https://rclone.org/), fusermount(3) | optional | mount, unmount remotes | | trash-cli | optional | trash files (default action: rm) | | vlock (Linux), bashlock (macOS), lock(1) (BSD) | optional | terminal locker (fallback: [cmatrix](https://github.com/abishekvashok/cmatrix)) | | advcpmv (Linux) ([integration](https://github.com/jarun/nnn/wiki/Advanced-use-cases#show-cp-mv-progress)) | optional | copy, move progress | | `$VISUAL` (else `$EDITOR`), `$PAGER`, `$SHELL` | optional | fallback vi, less, sh | glamour-0.10.0/testdata/issues/47.md000066400000000000000000000000341500000454500171240ustar00rootroot00000000000000Example: `` glamour-0.10.0/testdata/issues/48.md000066400000000000000000000003411500000454500171260ustar00rootroot00000000000000emoji in text :octopus: :zap: :cat: = :heart: emoji in header ## :octopus: :zap: :cat: = :heart: no emoji in code blocks ``` :octopus: :zap: :cat: = :heart: ``` no emoji in inline code `:octopus: :zap: :cat: = :heart:` glamour-0.10.0/testdata/issues/493.md000066400000000000000000000016261500000454500172210ustar00rootroot00000000000000| Avatar | Name | Role | Handle | ------ | ---- | ---- | ------ | ![@andreynering](https://avatars.githubusercontent.com/andreynering?s=80) | Andrey | Engineering | [@andreynering](https://github.com/andreynering) | ![@aymanbagabas](https://avatars.githubusercontent.com/aymanbagabas?s=80) | Ayman | Engineering | [@aymanbagabas](https://github.com/aymanbagabas) | ![@bashbunni](https://avatars.githubusercontent.com/bashbunni?s=80) | Bash | Engineering | [@bashbunni](https://github.com/bashbunni) | ![@caarlos0](https://avatars.githubusercontent.com/caarlos0?s=80) | Carlos | Engineering | [@caarlos0](https://github.com/caarlos0) | ![@meowgorithm](https://avatars.githubusercontent.com/meowgorithm?s=80) | Christian | Engineering | [@meowgorithm](https://github.com/meowgorithm) | ![@raphamorim](https://avatars.githubusercontent.com/raphamorim?s=80) | Rapha | Product | [@raphamorim](https://github.com/raphamorim)glamour-0.10.0/testdata/issues/60.md000066400000000000000000000036051500000454500171260ustar00rootroot00000000000000| Library | Version | | ----------------------------------------------------------- | ---------- | | [ESMF](https://github.com/esmf-org/esmf) | v8.6.1 | | [FMS](https://github.com/NOAA-GFDL/FMS/) | 2024.01.02 | | [netCDF](https://github.com/Unidata/netcdf-c) | 4.9.2 | | [netCDF Fortran](https://github.com/Unidata/netcdf-fortran) | 4.6.1 | | [netCDF C++](https://github.com/Unidata/netcdf-cxx4) | 4.3.1 | | [HDF5](https://portal.hdfgroup.org/display/support) | 1.10.11 | | [HDF4](https://portal.hdfgroup.org/display/support) | 4.2.16-2 | | [GFE](https://github.com/Goddard-Fortran-Ecosystem/GFE) | v1.16.0 | | [xgboost](https://github.com/dmlc/xgboost) | v1.6.0 | | [libyaml](https://github.com/yaml/libyaml.git) | 0.2.5 | | [antlr2](https://www.antlr2.org/) | 2.7.7 | | [GSL](https://www.gnu.org/software/gsl/) | 2.7 | | [jpeg](http://www.ijg.org/) | 9e | | [zlib](http://www.zlib.net/) | 1.3.1 | | [szip](https://support.hdfgroup.org/doc_resource/SZIP/) | 2.1.1 | | [cURL](https://curl.haxx.se/) | 8.8.0 | | [UDUNITS2](https://github.com/GMAO-SI-Team/UDUNITS-2.git) | 2.2.28 | | [NCO](http://nco.sourceforge.net/) | 5.2.6 | | [CDO](https://code.mpimet.mpg.de/projects/cdo) | 2.3.0 | | [nccmp](https://gitlab.com/remikz/nccmp) | 1.9.1.0 | | [HDF-EOS2](https://wiki.earthdata.nasa.gov/display/DAS) | 3.0 | | [HDF-EOS5](https://wiki.earthdata.nasa.gov/display/DAS) | 2.0 | | [SDP Toolkit](https://wiki.earthdata.nasa.gov/display/DAS) | 5.2.20 | glamour-0.10.0/testdata/issues/79.md000066400000000000000000000002211500000454500171270ustar00rootroot00000000000000Preceding blockquote paragraph > 1st blockquote paragraph > > quoted code block > > 2nd blockquote paragraph glamour-0.10.0/testdata/preserved_newline.in000066400000000000000000000003051500000454500211060ustar00rootroot00000000000000Preserving line breaks will ensure that this text displays on two separate lines While this text appears on one line, it will wrap when the text meets the renderer's default value of 80 charactersglamour-0.10.0/testdata/readme.markdown.in000066400000000000000000000023141500000454500204460ustar00rootroot00000000000000# Gold Render markdown on the CLI, with _pizzazz_! ## What is it? Gold is a Golang library that allows you to use JSON based stylesheets to render Markdown files in the terminal. Just like CSS, you can define color and style attributes on Markdown elements. The difference is that you use ANSI color and terminal codes instead of CSS properties and hex colors. ## Usage See [cmd/gold](cmd/gold/). ## Example Output ![Gold Dark Style](https://github.com/charmbracelet/gold/raw/master/styles/gallery/dark.png) Check out the [Gold Style Gallery](https://github.com/charmbracelet/gold/blob/master/styles/gallery/README.md)! ## Colors Currently `gold` uses the [Aurora ANSI colors](https://godoc.org/github.com/logrusorgru/aurora#Index). ## Development Style definitions located in `styles/` can be embedded into the binary by running [statik](https://github.com/rakyll/statik): ```console statik -f -src styles -include "*.json" ``` You can re-generate screenshots of all available styles by running `gallery.sh`. This requires `termshot` and `pngcrush` installed on your system!