gomarkdown / markdown

markdown parser and HTML renderer for Go
Other
1.37k stars 172 forks source link

Relative links not always identified #218

Open jedthehumanoid opened 2 years ago

jedthehumanoid commented 2 years ago

Bear with me if I have misunderstood usage.

I feel like a common usage is having images that look like this: ![](image.png) which references current directory.

Now if I want to prefix that in html, so that it points to /public/ or something, my solution was to use

RendererOptions{
    ...
    AbsolutePrefix: "/public/",
}

Which does not seem to work.

Digging a little bit shows that isRelativeLink()-function says that it's not relative Isn't it though? :slightly_smiling_face:

AFAICT, it's proper syntax for relative urls, and quite commonly used.

Would you be open for a pull request, adding some more heuristics to isRelativeLink()?

jedthehumanoid commented 2 years ago

Seems like I can probably solve this with a custom RenderNodeHook otherwise?