4
\$\begingroup\$

If you still don't know this, you can create an inline version of the code block, by using backticks (`), it's a great thing if you want to post golf ideas in the comments, but this is also one of it's flaw.

Javascript is a pretty popular golfing language on this site, multiple people use it (for example Neil or Conor O' Brien). There's a feature in javascript ES6, wich allows you to leave out parentheses on the functions, wich take in a string as a parameter by doing:

functionName`String comes here`

The back tick also allows you, to use literal new lines, instead of \n-s.

The problem with this though, that whenever we want to post a new better golfed code in the comments, the back ticks of the program interfere with the in-line code blocks, creating something like this:

Array(100).fillabc.join|``

(This is a worst case example)

I don't want to change the markup for the in-line code-block, I only want to have an alternative for it.

\$\endgroup\$
5
  • \$\begingroup\$ You can also use 2 backticks, ``foo``, around the code. \$\endgroup\$
    – Riker
    Commented Jun 10, 2016 at 14:40
  • 1
    \$\begingroup\$ @EᴀsᴛᴇʀʟʏIʀᴋ That doesn't work in comments. \$\endgroup\$
    – Doorknob
    Commented Jun 10, 2016 at 14:42
  • \$\begingroup\$ @EᴀsᴛᴇʀʟʏIʀᴋ ``join˙˙.split`|``` \$\endgroup\$
    – Bálint
    Commented Jun 10, 2016 at 14:44
  • \$\begingroup\$ @Doorknob except for \ for some weird reason... \$\endgroup\$ Commented Jun 10, 2016 at 15:26
  • \$\begingroup\$ Ooops.. Just read the comments. Let's check: ``` Array(100).fillabc.join`` ``` Really, not working :( \$\endgroup\$
    – Qwertiy
    Commented Jun 14, 2016 at 17:30

2 Answers 2

7
\$\begingroup\$

Comment markdown allows you to escape backticks in inline code. So,

`Array(100).fill\`abc\`.join\`|\``

results in

Array(100).fill`abc`.join`|`

\$\endgroup\$
0
0
\$\begingroup\$

Markdown allows multiple ` to be used for inline code. It also trims spaces at the end. So

``` Array(100).fill`abc`.join`` ```

becomes Array(100).fill`abc`.join``.

\$\endgroup\$
7
  • \$\begingroup\$ Not in comments (which is what the question is asking), except for the special case of ``\`` \$\endgroup\$ Commented Jun 14, 2016 at 17:30
  • \$\begingroup\$ @MartinEnder, yep.. It's sad... \$\endgroup\$
    – Qwertiy
    Commented Jun 14, 2016 at 17:30
  • \$\begingroup\$ Is it really a special case? .`. \$\endgroup\$
    – jimmy23013
    Commented Jun 15, 2016 at 5:50
  • \$\begingroup\$ It seems to me ` cannot be the first or last character in `` ``. \$\endgroup\$
    – jimmy23013
    Commented Jun 15, 2016 at 5:53
  • \$\begingroup\$ Let's check: - ` ...``.... @jimmy23013, seems like trimming doesn't work in comments, so if you code starts from or ends by ` you have to use escaping, otherwise you can yse multiple `. \$\endgroup\$
    – Qwertiy
    Commented Jun 15, 2016 at 6:20
  • \$\begingroup\$ Yet another `` test. 1 `` 2 3 4 5 6` 7 Array(100).fill`abc`.join`|` \$\endgroup\$
    – jimmy23013
    Commented Jun 15, 2016 at 6:34
  • \$\begingroup\$ A trailing space seemed working, but not a leading one. \$\endgroup\$
    – jimmy23013
    Commented Jun 15, 2016 at 6:38

You must log in to answer this question.

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