refined-github / refined-github

:octocat: Browser extension that simplifies the GitHub interface and adds useful features
MIT License
24.86k stars 1.49k forks source link

Linkify relative URLs in Markdown files #4081

Closed fregante closed 3 years ago

fregante commented 3 years ago

We linkify full URLs in every piece of code, for example:

<a href="https://fregante.com">

But we don't linkify relative URLs because they're harder to detect and sometimes we can't really resolve them.

I think however that we could detect some URLs, for example in Markdown files:

![Logo](./logo.png)
[Contribute](./docs/contributing/)
[Cool stuff][demo-url]

[demo-url]: ./demo/

Example URL: https://github.com/fregante/ghosttext.fregante.com/commit/a8f1666a7f1e65c2e62764b933e86f769ffabe1d#diff-ab203343d005bd9ca2666791f127c15b798285a9e579edcb628b3be27caa9305R59

The linkifier part would be a function in dom-formatters.ts and would need to have tests.

This feature might be a little difficult to implement. Maybe you can query .pl-e and parse the textNode that immediately follows instead of parsing everything

fregante commented 3 years ago

Probably too much trouble, we'd have to parse markdown for something relatively rare.