Stylesheet-based markdown rendering for your CLI apps πŸ’‡πŸ»β€β™€οΈ

Glamour

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

Write handsome command-line tools with Glamour.

Glamour dark style example

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.

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)

Hello World example

Custom Renderer

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
    glamour.WithWordWrap(40),
)

out, err := r.Render(in)
fmt.Print(out)

Styles

You can find all available default styles in our gallery. Want to create your own style? Learn how!

There are a few options for using a custom style:

  1. Call glamour.Render(inputText, "desiredStyle")
  2. Set the GLAMOUR_STYLE environment variable to your desired default style or a file location for a style and call glamour.RenderWithEnvironmentConfig(inputText)
  3. Set the GLAMOUR_STYLE environment variable and pass glamour.WithEnvironmentConfig() to your custom renderer

Glamourous Projects

Check out these projects, which use glamour:

  • Glow, a markdown renderer for the command-line.
  • GitHub CLI, GitHub’s official command line tool.
  • GLab, An open source GitLab command line tool.

License

MIT


Part of Charm.

The Charm logo

Charmηƒ­ηˆ±εΌ€ζΊ β€’ Charm loves open source

Owner
Charm
We build tools to make the command line glamorous
Charm
Comments
  • Fix resolving of absolute URLs

    Fix resolving of absolute URLs

    URL resolver treats all URLs as path-relative, even path-absolute ones like / πŸ€”

    The thing is, that resolveRelativeURL() is not only used for relative URLs. This means, a link with a path-absolute URL like /foo/bar.jpg would be resolved as relative.

    I'm not sure what the check for a leading / was meant for, this was in the repo from the first commit on (in a different variant having the same issue)..

  • Some rendering issues

    Some rendering issues

    I was viewing a README with glow. Noticed the following issues:

    From the Features section (https://github.com/jarun/nnn/blob/master/README.md#features):

      β€’ Familiar shortcuts (arrows,                                                                   
        ~                                                                                               
        ,                                                                                               
        -                                                                                               
        ,                                                                                               
        @                                                                                               
        ), quick reference                                                                              
        β€’ CD on quit (easy shell integration)
    

    Also the table of deps (https://github.com/jarun/nnn/blob/master/README.md#utility-dependencies) looks broken:

      $VISUAL$EDITOR$PAGER$SHELL            DEPENDENCY           β”‚ INSTALLATION β”‚           OPERATION   
      ─────────────────────────────────┼──────────────┼─────────────────────────────────                
        xdg-open (Linux), open(1)      β”‚ base         β”‚ desktop opener                                  
        (macOS), cygstart (Cygwin)     β”‚              β”‚                                                 
        file, coreutils (cp, mv, rm),  β”‚ base         β”‚ file type, copy, move and                       
        xargs                          β”‚              β”‚ remove                                          
        tar, (un)zip [atool/bsdtar for β”‚ base         β”‚ create, list, extract tar,                      
        more formats]                  β”‚              β”‚ gzip, bzip2, zip                                
        archivemount, fusermount(3)    β”‚ optional     β”‚ mount, unmount archives                         
        sshfs, rclone, fusermount(3)   β”‚ optional     β”‚ mount, unmount remotes                          
        trash-cli                      β”‚ optional     β”‚ trash files (default action:                    
                                       β”‚              β”‚ rm)                                             
        vlock (Linux), bashlock        β”‚ optional     β”‚ terminal locker (fallback:                      
        (macOS), lock(1) (BSD)         β”‚              β”‚ cmatrix)                                        
        advcpmv (Linux) (integration)  β”‚ optional     β”‚ copy, move progress                             
        $VISUAL (else $EDITOR),        β”‚ optional     β”‚ fallback vi, less, sh                           
        $PAGER, $SHELL                 β”‚              β”‚                                                 
    
  • Implement Capitalization

    Implement Capitalization

    Fixes #100 (adds lower and upper case styling).

    I used an example, in which h1 and h3 tags were wrongly capitalized. This produced the following output: arrows

    You can rerun the example, by running go run examples/capitalization/main.go and by making h1 upper case and h3 lower case by adding the following lines to styles.go:

    2021-08-13_21-57

  • Update for latest release of yuin/goldmark

    Update for latest release of yuin/goldmark

    https://github.com/yuin/goldmark/commit/9e0189df270cb443c204b51e89e2b0749b98370c broke backwards compatibility by renaming exported structs without a bump of the module's major version.

    This commit updates glamour to use goldmark's new API.

  • Options to preserve the hard line break while render

    Options to preserve the hard line break while render

    Consider the string input as in := "This is a simple example of glamour! Check out"

    executing this, out, err := glamour.Render(in, "dark") fmt.Print(out)

    It gets printed in one line. I would like to preserve the hard line break while rendering to get the result as the input.

  • Code syntax highlighting and background color rendering

    Code syntax highlighting and background color rendering

    Code coloring doesn't inherit the background color of the document, instead it shifts the background color right. Additionally, code doesn’t highlight in MacOS's stock Terminal.

    Kitty (with a dark gray background):

    Screen Shot 2019-12-07 at 8 13 57 AM

    MacOS default terminal (with a white background):

    Screen Shot 2019-12-07 at 8 21 29 AM
  • fix issue where lists that didn't start at 1 were not respected

    fix issue where lists that didn't start at 1 were not respected

    The problem is more thoroughly elaborated in this issue for a depending project. The tl;dr is that most/all markdown processors will respect the first number in a numbered list, and ignore all subsequent values. The commonmark reference implementation implements this, and github flavored markdown respects this as well.

    This change is to recalculate the list enumeration value based on the starting number in the list. It has been manually tested, and lists starting at 0 are rendered correctly as well.

    Sample showing fixed behavior: image

    Sample showing fixed behavior with 0: image

  • Optionally Preserving New Lines

    Optionally Preserving New Lines

    #70 Allowing for new lines to be preserved in paragraph elements.

    I wasn't sure where to place the tests for this functionality. If you could provide some direction, I am happy to add them.

  • Problems in running the tests.

    Problems in running the tests.

    During the execution of the tests these problems are occurring:

    go test -vet=off -v -p 4 github.com/charmbracelet/glamour github.com/charmbracelet/glamour/ansi github.com/charmbracelet/glamour/internal/generate-style-json === RUN TestTermRendererWriter glamour_test.go:59: Rendered output doesn't match! Expected: `

           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!                                                                     
        
        `
        Got: `
        
           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!                                                                     
        
        `
    

    --- FAIL: TestTermRendererWriter (0.02s) === RUN TestTermRenderer glamour_test.go:89: Rendered output doesn't match! Expected: `

           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!                                                                     
        
        `
        Got: `
        
           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!                                                                     
        
        `
    

    --- FAIL: TestTermRenderer (0.01s) === RUN TestWithEmoji --- PASS: TestWithEmoji (0.00s) === RUN TestStyles --- PASS: TestStyles (0.00s) === RUN TestRenderHelpers glamour_test.go:157: Rendered output doesn't match! Expected: `

           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!                                                                     
        
        `
        Got: `
        
           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!                                                                     
        
        `
    

    --- FAIL: TestRenderHelpers (0.01s) FAIL FAIL github.com/charmbracelet/glamour 0.060s === RUN TestRenderer renderer_test.go:94: Rendered output for block_quote doesn't match! Expected: `

        => First line of quote                                                            
        => Second line                                                                    
        `
        Got: `
                                                                                        
        => First line of quote                                                            
        => Second line                                                                    
        `
    renderer_test.go:94: Rendered output for code doesn't match!
        Expected: `
        This is a code.                                                                 
        `
        Got: `
        This is a code.                                                                 
        `
    renderer_test.go:94: Rendered output for emph doesn't match!
        Expected: `
        This text is emphasized.                                                        
        `
        Got: `
        This text is emphasized.                                                        
        `
    renderer_test.go:94: Rendered output for enumeration doesn't match!
        Expected: `
                                                                                        
        1. First Item                                                                   
        2. Second Item                                                                  
        `
        Got: `
                                                                                        
        1. First Item                                                                   
        2. Second Item                                                                  
        `
    renderer_test.go:94: Rendered output for heading doesn't match!
        Expected: `
          => h1 <=                                                                      
            ## h2                                                                       
              ### h3`
        Got: `
          => h1 <=                                                                      
            ## h2                                                                       
              ### h3`
    renderer_test.go:94: Rendered output for image doesn't match!
        Expected: `
        Image [Image: https://charm.sh/logo.png].                                       
        `
        Got: `
        Image [Image: https://charm.sh/logo.png].                                       
        `
    renderer_test.go:94: Rendered output for link doesn't match!
        Expected: `
        This is a link (https://charm.sh).                                              
        `
        Got: `
        This is a link (https://charm.sh).                                              
        `
    renderer_test.go:94: Rendered output for list doesn't match!
        Expected: `
                                                                                        
        β€’ First Item                                                                    
            β€’ Nested List Item                                                          
        β€’ Second Item                                                                   
        `
        Got: `
                                                                                        
        β€’ First Item                                                                    
            β€’ Nested List Item                                                          
        β€’ Second Item                                                                   
        `
    renderer_test.go:94: Rendered output for strikethrough doesn't match!
        Expected: `
        Scratch this.                                                                   
        `
        Got: `
        Scratch this.                                                                   
        `
    renderer_test.go:94: Rendered output for strong doesn't match!
        Expected: `
        This text is strong.                                                            
        `
        Got: `
        This text is strong.                                                            
        `
    renderer_test.go:94: Rendered output for task doesn't match!
        Expected: `
                                                                                        
        βœ“ Finished Task                                                                 
        βœ— Outstanding Task                                                              
        `
        Got: `
                                                                                        
        βœ“ Finished Task                                                                 
        βœ— Outstanding Task                                                              
        `
    

    --- FAIL: TestRenderer (0.01s) === RUN TestRendererIssues renderer_test.go:166: Rendered output for 42 doesn't match! Expected: `

          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.
        
        `
        Got: `
        
          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.
        
        `
    renderer_test.go:166: Rendered output for 43 doesn't match!
        Expected: `
        
                                                                                      
          β€’ Getting started                                                           
          β€’ Developing locally                                                        
          β€’ Documentation changes                                                     
          β€’ Contributing changes                                                      
          β€’ Managing releases                                                         
          β€’ Packaging                                                                 
          β€’ Updating the website                                                      
        
        `
        Got: `
        
                                                                                      
          β€’ Getting started                                                           
          β€’ Developing locally                                                        
          β€’ Documentation changes                                                     
          β€’ Contributing changes                                                      
          β€’ Managing releases                                                         
          β€’ Packaging                                                                 
          β€’ Updating the website                                                      
        
        `
    renderer_test.go:166: Rendered output for 46_1 doesn't match!
        Expected: `
        
                                                                                      
          β€’ Navigation                                                                
            β€’ Familiar shortcuts (arrows, ~, -, @), quick reference                   
                                                                                      
        
        `
        Got: `
        
                                                                                      
          β€’ Navigation                                                                
            β€’ Familiar shortcuts (arrows, ~, -, @), quick reference                   
                                                                                      
        
        `
    renderer_test.go:166: Rendered output for 47 doesn't match!
        Expected: `
        
          Example:  <some directory>                                                  
        
        `
        Got: `
        
          Example:  <some directory>                                                  
        
        `
    renderer_test.go:166: Rendered output for 48 doesn't match!
        Expected: `
        
          emoji in text                                                               
                                                                                      
          πŸ™ ⚑ 🐱 = ❀️                                                               
                                                                                      
          emoji in header                                                             
                                                                                      
          ## πŸ™ ⚑ 🐱 = ❀️                                                            
                                                                                      
          no emoji in code blocks                                                     
                                                                                      
            :octopus: :zap: :cat: = :heart:                                           
                                                                                     
          no emoji in inline code                                                     
                                                                                      
           :octopus: :zap: :cat: = :heart:                                            
        
        `
        Got: `
        
          emoji in text                                                               
                                                                                      
          πŸ™ ⚑ 🐱 = ❀️                                                               
                                                                                      
          emoji in header                                                             
                                                                                      
          ## πŸ™ ⚑ 🐱 = ❀️                                                            
                                                                                      
          no emoji in code blocks                                                     
                                                                                      
            :octopus: :zap: :cat: = :heart:                                           
                                                                                      
          no emoji in inline code                                                     
                                                                                      
           :octopus: :zap: :cat: = :heart:                                            
        
        `
    

    --- FAIL: TestRendererIssues (0.02s) FAIL FAIL github.com/charmbracelet/glamour/ansi 0.055s ? github.com/charmbracelet/glamour/internal/generate-style-json [no test files] FAIL

    Can you indicate any corrections for this?

  • Hex colors?

    Hex colors?

    Some portions of the default style JSON files use hex colors and other parts use 256-style colors. The style docs don't mention anything about non-256 colors, but I'd assume they're meant to work since they're present in the dark/light styles. Looking through the history of the project, it seems like there was originally no support for hex colors, then it was added in a way that converted hex to 256, then the default became TrueColor...?

    Long story short, I can't get custom hex colors to function (e.g. changing heading.color in dark.json to something like #ff0000 has no effect). Is this meant to work at this point?

    I'm using glow/glow -s dark.json to test theme changes. I'd ask in the Glow repository but it seems like Glow style questions are often redirected here.

  • Space before, space after

    Space before, space after

    An option to add a few blank lines above or below block-level elements in styles would be helpful in both providing a sense of hierarchy and aiding readability.

  • Feature/frontmatter yaml parser

    Feature/frontmatter yaml parser

    Parsing Frontmatter in YAML Format.

    This PR adds a Frontmatter Parser to detect and parse Frontmatter in YAML Format. Frontmatter produces its own AST Element which can be handled by renderers. But as the Frontmatter is more about adding non-visible meta data, its also possible to register a Callback Handler to receive the Parsed FrontMatter Meta Data once the Parser detected a Frontmatter block

    Possible Usage in https://github.com/charmbracelet/glow

    func (h Handler) HandleFrontmatter(frontmatter map[string]interface{}) {
    	fmt.Printf("Hello Frontmatter %v", frontmatter)
    }
    
    // This is where the magic happens.
    func glamourRender(m pagerModel, markdown string) (string, error) {
    	if !config.GlamourEnabled {
    		return markdown, nil
    	}
    
    	// initialize glamour
    	var gs glamour.TermRendererOption
    	if m.common.cfg.GlamourStyle == "auto" {
    		gs = glamour.WithAutoStyle()
    	} else {
    		gs = glamour.WithStylePath(m.common.cfg.GlamourStyle)
    	}
    
    	width := max(0, min(int(m.common.cfg.GlamourMaxWidth), m.viewport.Width))
    	r, err := glamour.NewTermRenderer(
    		gs,
    		glamour.WithWordWrap(width),
    		glamour.WithFrontMatterHandler(Handler{}),
    	)
    
  • feature: Option to toggle between Link Text only and Link Text + URL …

    feature: Option to toggle between Link Text only and Link Text + URL …

    Preparing glamour to be configured to render links using the link text only or the Link text and url.

    Ideally in another PR this would be extended to display clickable Link Texts whenever possible. When using glow as a quick reader of markdown files, it seems natural to hide the urls, as this is the expected behaviour of a markdown viewer.

  • feat(image): basic iTerm image protocol support

    feat(image): basic iTerm image protocol support

    This commit implements the function requested in issue #175.

    image

    Currently, only the iTerm image protocol is supported. Some code from muesli/reflow is copied & manually patched, so wrapping and indentation will not interfere with the iTerm escape sequence (which is not quite the same as the ANSI sequences)

    This functionality is only enabled if you pass WithImageDisplay() when creating a new TermRenderer. You also need to specify the BaseURL with WithBaseURL(path), where path ends with a slash.

    I have verified that it works under WezTerm. If the terminal is not supported, it will automatically switch to the old rendering mode of images as fallback.

    For more details, please see TestImageDisplay in glamour_test.go .

    I'm happy to integrate any modification from the maintainers into my code.

  • feat(chroma): export charm themes

    feat(chroma): export charm themes

    • Register chroma glamour charm themes
    • Start using StyleCodeBlock.Theme property
    • Use Chroma Dracula theme
    • Don't register Chroma theme every time a codeblock is rendered
    • Upgrade chroma to v2. Fixes: https://github.com/charmbracelet/glamour/pull/154

    Related: 50e7d3bab8875f8fbd88fbc7e3cc641ef3401bf5

  • Links in level 1 headings are hard to read with the default (dark?) palette

    Links in level 1 headings are hard to read with the default (dark?) palette

    I originally raised this issue at cli/cli, but since they use glamour and don't customize the color palette it was recommended to raise the issue here.


    When a level 1 heading contains a link, the purple-ish background and the dark cyan foreground of the link result in a low contrast that makes the text hard to read.

    Here is a screenshot: https://github.com/cli/cli/issues/6351#issuecomment-1258321751

Markdown - Markdown converter for golang

markdown ?? Talks ?? Join ?? Youtube ❀️ Sponsor Install via nami nami install ma

Jun 2, 2022
Mdfmt - A Markdown formatter that follow the CommonMark. Like gofmt, but for Markdown

Introduction A Markdown formatter that follow the CommonMark. Like gofmt, but fo

Dec 18, 2022
Glow is a terminal based markdown reader designed from the ground up to bring out the beautyβ€”and powerβ€”of the CLI.πŸ’…πŸ»
Glow is a terminal based markdown reader designed from the ground up to bring out the beautyβ€”and powerβ€”of the CLI.πŸ’…πŸ»

Glow Render markdown on the CLI, with pizzazz! What is it? Glow is a terminal based markdown reader designed from the ground up to bring out the beaut

Dec 30, 2022
Geziyor, a fast web crawling & scraping framework for Go. Supports JS rendering.

Geziyor Geziyor is a blazing fast web crawling and web scraping framework. It can be used to crawl websites and extract structured data from them. Gez

Dec 29, 2022
A UTF-8 and internationalisation testing utility for text rendering.

Ι±Γ©Ε₯Γ Ε‚ "English, but metal" Metal is a tool that converts English text into a legible, Zalgo-like character swap for the purposes of testing localisati

Jan 1, 2023
A CLI markdown converter written in Go.

MDConv is a markdown converter written in Go. It is able to create PDF and HTML files from Markdown without using LaTeX. Instead MDConv u

Dec 20, 2022
The Markdown-based note-taking app that doesn't suck.
The Markdown-based note-taking app that doesn't suck.

Notable I couldn't find a note-taking app that ticked all the boxes I'm interested in: notes are written and rendered in GitHub Flavored Markdown, no

Jan 2, 2023
Generate markdown formatted sprint updates based on the Jira tickets were involved in the given sprint.

Generate markdown formatted sprint updates based on the Jira tickets were involved in the given sprint.

Nov 15, 2021
Effortless customization for markdown-based SvelteKit blogs!

reece Effortless customization for markdown-based SvelteKit blogs! Installation Install using: One-Script Installation (Linux): curl -sfL https://gith

Dec 11, 2021
A terminal based preview tool for markdown πŸͺ
A terminal based preview tool for markdown πŸͺ

Smooth Smooth is a terminal based preview tool for markdown. Features Turning: turn next/previous slide Scroll: scroll up/down slide Search: search wo

May 22, 2022
A clean, Markdown-based publishing platform made for writers. Write together, and build a community.
A clean, Markdown-based publishing platform made for writers. Write together, and build a community.

WriteFreely is a clean, minimalist publishing platform made for writers. Start a blog, share knowledge within your organization, or build a community

Jan 4, 2023
Schedule daily tweets from markdown files in your repo, posted via github actions.

markdown-tweet-scheduler Schedule daily tweets from markdown files in your repo, posted to twitter via github actions. Setup Fork this repo Get your t

Dec 6, 2022
Convert your markdown files to PDF instantly
Convert your markdown files to PDF instantly

Will take a markdown file as input and then create a PDF file with the markdown formatting.

Nov 7, 2022
Blackfriday: a markdown processor for Go

Blackfriday Blackfriday is a Markdown processor implemented in Go. It is paranoid about its input (so you can safely feed it user-supplied data), it i

Jan 8, 2023
βš™οΈ Convert HTML to Markdown. Even works with entire websites and can be extended through rules.
βš™οΈ Convert HTML to Markdown. Even works with entire websites and can be extended through rules.

html-to-markdown Convert HTML into Markdown with Go. It is using an HTML Parser to avoid the use of regexp as much as possible. That should prevent so

Jan 6, 2023
Produces a set of tags from given source. Source can be either an HTML page, Markdown document or a plain text. Supports English, Russian, Chinese, Hindi, Spanish, Arabic, Japanese, German, Hebrew, French and Korean languages.
Produces a set of tags from given source. Source can be either an HTML page, Markdown document or a plain text. Supports English, Russian, Chinese, Hindi, Spanish, Arabic, Japanese, German, Hebrew, French and Korean languages.

Tagify Gets STDIN, file or HTTP address as an input and returns a list of most popular words ordered by popularity as an output. More info about what

Dec 19, 2022
Upskirt markdown library bindings for Go

Goskirt Package goskirt provides Go-bindings for the excellent Sundown Markdown parser. (F/K/A Upskirt). To use goskirt, create a new Goskirt-value wi

Oct 23, 2022
A markdown renderer package for the terminal
A markdown renderer package for the terminal

go-term-markdown go-term-markdown is a go package implementing a Markdown renderer for the terminal. Note: Markdown being originally designed to rende

Nov 25, 2022
A markdown parser written in Go. Easy to extend, standard(CommonMark) compliant, well structured.

goldmark A Markdown parser written in Go. Easy to extend, standards-compliant, well-structured. goldmark is compliant with CommonMark 0.29. Motivation

Dec 29, 2022