The "decorated" URL for a GitHub file looks like this:
And on GitLab, the "decorated" URLs looks like this:
I don't particularly like syntax highlighting (or at least not the kind done on Rebol files by these sites, which also happens to be buggy...so I turn it off on my repos). But there are other good reasons to like using these links:
It gives you context to see what project the file is in and to navigate around that project to see other related files.
You can click on a line number or line number range and then give that link to someone to point to a specific line you're talking to.
You have buttons for viewing the file history and "git blame" to see where changed lines came from.
If you're an owner on the repo, you can edit it right there in the browser and commit it.
But the HTML decorations mean these URLs give back code that the intepreter will choke on. So historically, if you were going to DO or IMPORT them, you would have to translate them to raw links...which lack these conveniences:
(Interestingly the GitLab raw link is actually a character shorter than the decorated one, but the GitHub raw link is longer.)
The web build has been willing to assume that when you say DO or IMPORT of the decorated link, what you want is the raw link.
It wouldn't be good to redirect these URLs generally. e.g. a READ might actually want to scrape the decorated HTML for something. But since DO and IMPORT would just choke on the decorated URL, it's just helpful to automatically redirect them.
Now This Feature is in the Desktop Builds Too
By request from @gchiu, I moved the function that does this to
sys.adjust-url-for-raw and it is run by the core DO and IMPORT functions on URLs.
It's a generic utility that can be used by similar functions. So CSS-DO and JS-DO use the functions as well.
If a URL is adjusted it returns it, otherwise it returns NULL. So this is used with MAYBE:
url: maybe sys.adjust-url-for-raw url
As a reminder of what MAYBE does...it leaves the SET-WORD! on the left unchanged if the result on the right is NULL, otherwise sets it to the new value.