5

When using markdown you can enter a space at the beginning to get a nice block around your text. The following without a space would present a link:

some link

but the same syntax with a space in front removed the link and presents it as text instead.

[some link](http://www.someurl.com)

Is there a way to have a clickable link added inside the block instead of it showing the link as text? I'd like that 2nd example to be in the box, but presented like the first example where you see the link.

migrated from stackoverflow.com Nov 29 '11 at 21:28

This question came from our site for professional and enthusiast programmers.

  • Thanks for letting me know. – Green Nov 29 '11 at 17:54
4

Prefixing a line by four spaces (8 in a list) causes the text to not be formatted in markdown. Additionally, the text is shown in a monospace font, and its syntax is highlighted.

If you want to use markdown inside a block of code, use <code></code>, as shown below. Some HTML tags (such as <br /> are supported. If you don't want to parse HTML, surround the code by a backtick character (```).

[SO](http://s.tk/) - Prefixed by four spaces
Monospace
111111111

SO - <code></code> Abi
Monospace
111111111

SO - Default environment.
Monospace
111111111 (not a monospace font)

  • It seems you don't need <br/> in code tag on SE, newlines are preserved (hence the empty lines seen in middle example). Also, can you add indentation in your example so we see if it's preserved? IIUC this is due to code { white-space: pre-wrap; } in StackExchange css, not guaranteed by standard which recommends wrapping <code> within <pre> – Beni Cherniavsky-Paskin Mar 8 '18 at 7:32
1
Markdown and HTML are turned off in code blocks:
<i>This is not italic</i>, and [this is not a link](http://example.com)

It's in the tooltip when you click on the "Code" button above the text field.

You must log in to answer this question.