glamour icon indicating copy to clipboard operation
glamour copied to clipboard

"Plain" link regression

Open polds opened this issue 1 year ago • 1 comments

Describe the bug From #19 it seems like links that are "plain" (reference themselves) was fixed to only print the url once. This no longer seems to be the case and doubly prints plain links.

ie: https://www.example.com => https://www.example.com https://www.example.com

This issue is not present in Glamour v0.7.0 but is in Glamour v0.8.0

Setup

  • OS: macOS 14.6.1 (23G93)
  • Shell: zsh 5.9 (x86_64-apple-darwin23.0)
  • Terminal Emulator: Warp, Intellij
  • Terminal Multiplexer: None
  • Glamour: v0.8.0

To Reproduce Steps to reproduce the behavior:

  1. go get github.com/charmbracelet/[email protected]
  2. Use below snippet as main.go
  3. go run main.go

Source Code

package main

import (
	"fmt"
	
	"github.com/charmbracelet/glamour"
)

func main() {
	md, err := glamour.Render("https://www.example.com", "dark")
	if err != nil {
		fmt.Printf("Error: %v\n", err)
		return
	}
	fmt.Println(md)
}

https://play.golang.com/p/3mfQERFnZ3e (Note: Usually doesn't work due to timeouts importing Glamour)

Expected behavior From the above example I expect that https://www.example.com is written exactly once.

Screenshots image

Additional context #19 references commit 9b192ba but I'm presently having a difficult time finding that commit, I'm still looking.

polds avatar Sep 08 '24 02:09 polds

Looks like the change in behavior was introduced in https://github.com/charmbracelet/glamour/commit/5f5965ed1282e3d4299ca9eac221771fc2488159#diff-ea3fd9921125a5b147d806d777214ac9493e6aaeead982dce3e518cf83df1308

polds avatar Sep 09 '24 01:09 polds

This will be fixed by #415.

andreynering avatar Apr 02 '25 17:04 andreynering