If I am adding some comments to user post, how do I add like this Code
(preview in view, should appear within gray background) or if I add some link on their post link (preview as Hyperlink).
2 Answers
Comments can use a scaled back version of Markdown.
- To use code formatting in a comment, utilize the backticks (
`
) around the code you want to format
Example:
This is a block of `code`
formats to "This is a block of code
"
- To use links, you do this utilize the format
[display text](url)
Example:
[This is a link to comment help](https://stackoverflow.com/editing-help#comment-formatting)
displays as "This is a link to comment help"
-
2
-
@D.Jones Then it looks like this: [This is a link to comment help] Jul 1, 2020 at 8:15
-
1@D.Jones it can be included without any escaping e.g. This is a link (StackOverflow) to comment help Nov 1, 2021 at 3:03
-
-
-
long links won't fit but you can't use link shorteners? that one doesn't add Oct 29 at 16:32
I recently made a link out of a chunk of code that will show up as:
By typing the following:
<a href="http://api.jquery.com/filter/">`$(array1).filter(array2);`</a>
The same way
you just did or am I not understanding your question?`content`
for code, and the[link text](url)
for links like thisAdd Comment
button if you ever need to be reminded[text][1]
and at end of question/answer[1]: https://meta.stackoverflow.com/q/291214/5569922
. This is called a reference-style link in Markdown. It is quite useful to also know the format ryanyuyu points out[text](url)
, which is called inline-style links.