6

While answering questions that involve URLs, sometimes you just want to demonstrate something. For example if I write in my answer:

If you want to extract Strings that begin with http://example.blah.com/, you should...

The "http://example.blah.com/" String is automatically hyperlinked. That's not good because the link doesn't exist, I'm not really referring a real link. One workaround is using:

"[http://example.blah.com/][1]"
[1]: http://

Now it looks fine: "http://example.blah.com/".

Is there a better way of disabling it? Or maybe not thinking about not making it default?

Edit: I'm aware that I can code block it, but I need it as is, it's not really a code.

5
  • 2
    your solution is brilliant, so use it.
    – totten
    Sep 29, 2015 at 11:21
  • IMHO input/output should be in a code block. Sep 29, 2015 at 11:57
  • 1
    I find it ugly to code block URLs, specially when they're not part of a code.
    – Maroun
    Sep 29, 2015 at 13:19
  • 2
    On a tangent to this- blah.example.com would be a safer example site, since it can't be bought by anyone. example.com/blah would be even better, since IANA has a page at the root domain identifying the site as an example domain.
    – theB
    Oct 1, 2015 at 10:40
  • I just asked a similar question where @Cerbrus gave a neat answer. Jan 22, 2016 at 17:31

2 Answers 2

2

Semantically correct would be to insert a Zero Width Non-Joiner (U+200C) anywhere inside the magic prefix http://.

When placed between two characters that would otherwise be connected into a ligature, a ZWNJ causes them to be printed in their final and initial forms, respectively. This is also an effect of a space character, but a ZWNJ is used when it is desirable to keep the words closer together or to connect a word with its morpheme. (https://en.wikipedia.org/wiki/Zero-width_non-joiner)

The Zero Width Non-joiner is 'semantically correct' because it does not add any further information, other than 'please do not join these two characters'. Apparently, the Markdown script to highlight URLs does not ignore it, as it should be doing when parsing 'purely textual content'.

If you want to extract Strings that begin with http:‌//example.blah.com/, you should...

... which we can test by inserting it in between some other Markdown markup sequences:

> this is a test to see what happens to *[ZWNJ]*bolded*[ZWNJ]* text

renders as

this is a test to see what happens to *‌bolded‌* text

0

Use a code block to avoid a text hyperlink like http://example.com to become a link.

1
  • I know that I can do that. But it's not really a code block. I prefer to display it as is.
    – Maroun
    Sep 29, 2015 at 10:00

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .