It's annoying when you have to search for a language homepage, get its link, and add it to your SE comment/answer, right? Let's write a script to do that for you!
Challenge
For each language name (intentional or not) in the input, replace it with the markdown link to the language home page, defined by TIO.
Rules
- (important) You can only connect to
https://tio.run
. Use the language list on TIO at the time your program is run.
The input is a string. Assume no newline (because multiline messages can't have markdown anyway). Unicode characters may be inside the string because they can exist in chat messages (example).
The input is valid markdown, but it is unlikely that this is related to the challenge.
You can assume there is no link inside the input. (Whoops, I missed this when the challenge was in the sandbox, thanks mercator for pointing that out. As far as I can see this should not invalidate any existing answers)
Case sensitive or insensitive, whatever you choose.
Only word breaks (not both adjacent to an English letter) are considered. (for example,
matlab
should not be converted tomatlab
,47
should be converted to47
)Note: It's too hard to define what's a "character" in Unicode, so your program can detect a word break or not if one of the two surrounding characters are not printable ASCII.
Only use markdown
[...](...)
, not HTML link<a href="...">...</a>
because the latter doesn't work in chat.Markdown components (
*
/_
for italic,**
for bold,---
for strikethrough (in chat)) in messages should not matter, because AFAIK there are no languages with such names on TIO.Use the language name (
Wolfram Language (Mathematica)
), not language ID.- No overlapping replacement.
In case there are multiple output, pick whichever. See example below.
Although by default chat markdown doesn't allow links in code blocks, for simplicity I would just assume that they don't need to be treated specially.
Winning criteria
Test cases
Input -> Output
matlab -> matlab
47 -> [4](https://github.com/urielieli/py-four)[7](https://esolangs.org/wiki/7)
/// -> [///](https://esolangs.org/wiki////)
//// -> [///](https://esolangs.org/wiki////)/ or /[///](https://esolangs.org/wiki////)
////// -> [///](https://esolangs.org/wiki////)[///](https://esolangs.org/wiki////) or //[///](https://esolangs.org/wiki////)/
Uṅıċȯḋė -> Uṅıċȯḋė
More test cases
(suggested by Adám. Any replacement is fine as long as they don't overlap (valid markdown source))
\///
S.I.L.O.S.I.L.O.S
Del|m|t
Del|m|tcl