DeabLabs / urlmd

An http API that ingests some url, and returns markdown from the html, caching the results
MIT License
0 stars 0 forks source link

html-to-markdown plugin #1

Open JohannesKaufmann opened 2 hours ago

JohannesKaufmann commented 2 hours ago

@cephalization Hi, I just saw that you are using the html-to-markdown converter and even wrote your own plugin! That's great to hear!

If I am reading it correctly you wrote the plugin to rewrite links.

FYI: You can use WithDomain to give the converter the current url. This then gets used to convert relative to absolute URLs.

This wasn't previously mentioned in the REAMDE, just fixed that. And I also improved the logic for the domain in the newest version.

markdown, err := htmltomarkdown.ConvertString(input, converter.WithDomain("https://example.com"))

Feel free to close this once you have read it... And let me know if you encounter any problems!

cephalization commented 2 hours ago

I was gonna reach out about that soon haha thanks! Will let you know how it works