charmbracelet / glamour

Stylesheet-based markdown rendering for your CLI apps 💇🏻‍♀️
MIT License
2.48k stars 180 forks source link

"Plain" link regression #347

Open polds opened 1 month ago

polds commented 1 month ago

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

To Reproduce Steps to reproduce the behavior:

  1. go get github.com/charmbracelet/glamour@v0.8.0
  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 commented 1 month ago

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