When we put a single URL in a block of code on Stack Overflow, by default everything after //
is treated as a comment, which doesn't look very good:
https://example.com/path1/?param1=A¶m2=B#id1
This can be improved by using some explicit language format before code block e.g. <!-- language: lang-html -->
, which gives this effect:
https://example.com/path1/?param1=A¶m2=B#id1
and it's better than the previous one.
But I wonder if there is a formatting (or if could be added some new one) that would highlight some essential characters in the URL or even all of the URL components such as schema, user name, host, port, path, query parammeters and hash id along with their constituent characters, such as: ://
, @
, :
, ?
, &
, =
, #
and possibly also encoded characters with %
as well.
Here is a poor visualization of what I mean (unfortunately outside the code block):
https
://
username:
password@
example.
com:
80/
path1/?
param1=
AA&
param2=
B%20B#
id1
Of course, it would be great if individual URL elements could be distinguished by different colors.
lang-none
.lang-none
.<!-- language: <whatever> -->
no longer works after the commonmark migration. If you want to specify code block language, you'll have to use ```lang-nonelang-none
.