11

The link http://localhost shows up as an auto-created link while creating the question, but after posting it comes out as normal text.

I noticed this when I posted this question about 127.0.0.0. If you look at the question directly, you can notice that that link to http://localhost is normal text. When you click the edit link, you can see that THE SAME LINK is now an actual link. Same occurs for this question. You can click the edit link to see that.

I think that this is happening because SO uses some regex to detect links, that requires at least one dot in the domain name. http://localhost, on the other hand, does not follow that. I am not sure if this is how it is done, so any guidance would be helpful.

8
  • What's your question? Jan 27, 2021 at 20:01
  • 5
    Yeah, the frontend preview renderer does not use exactly the same logic as the backend renderer, occasionally resulting in inconsistencies like these. Jan 27, 2021 at 20:07
  • 7
    @billynoah OPs question is a bug report about the question preview rendering localhost as a link, whereas the "normal" rendered post doesn't.
    – Tom
    Jan 27, 2021 at 21:10
  • @Tom: I think billynoah was thrown off by the "any guidance would be helpful" bit at the end. It seems to be both a bug report and a programming question specific to SO at the same time, though the latter is more intended as seeking context and exposition for the former.
    – BoltClock
    Jan 28, 2021 at 2:21
  • 2
    I presume you can just use [http://localhost](http://localhost) rather than relying on the auto detection? Jan 28, 2021 at 10:40
  • @MartinSmith: As Tom said, this is a bug report. It shows two different things in two different places when it should show the same thing. I could do <http://localhost>, but it should work without that. Jan 29, 2021 at 17:52
  • I think this is intentional beahviour; related: Why are localhost links disallowed? (which shows that in the past it wasn't even allowed) and [ Meta Stack Exchange Your post contains a link to the invalid host '192.168.1.1'](meta.stackexchange.com/questions/134212/…) and Why are localhost and 127.0.0.1 links blocked? Jan 30, 2021 at 15:23
  • I couldn't quickly find anything that indicated that this prohibition was changed to simply not rendering as a link, but it looks like it was. Jan 30, 2021 at 15:29

0

You must log in to answer this question.

Browse other questions tagged .