New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tildes and backticks in info strings. #119

Open
neongreen opened this Issue Sep 14, 2014 · 4 comments

Comments

Projects
None yet
4 participants
@neongreen
Contributor

neongreen commented Sep 14, 2014

The spec says:

Code fences (opening and closing) cannot contain internal spaces

Info strings for backtick code blocks cannot contain backticks

So:

  • Both ~~~ ~~ and ```` ``` are not allowed as an opening code fence.
  • aa isn't allowed either.
  • Is ~~~ aa ~~~ allowed? stmd.js doesn't accept it, but it's not clear from the spec.
  • For clarity, it should probably be mentioned that ~~~ ``` and ```` ~~ are allowed.
@jgm

This comment has been minimized.

Show comment
Hide comment
@jgm

jgm Feb 1, 2015

Member

Some thoughts on this:

The only good reason for disallowing backticks in the info string is to allow the use of 3+ backticks for inline code, e.g.

``` hello ```

Of course, the solution is only partial; backtick style fenced code blocks mean that you can't hard-wrap this kind of inline code span; the closing backticks must be on the same line as the opener. This is an argument against using backticks for fenced code blocks, but it's probably too well established in Markdown to change that.

Anyway, this reason for disallowing backticks doesn't apply to tildes, so perhaps tildes should be allowed in the info string. A nice advantage of allowing them would be that you could write stuff like this:

~~~~~~ haskell ~~~~~~~
f a >>= g >=> h
~~~~~~~~~~~~~~~~~~~~

which looks rather nice!

Member

jgm commented Feb 1, 2015

Some thoughts on this:

The only good reason for disallowing backticks in the info string is to allow the use of 3+ backticks for inline code, e.g.

``` hello ```

Of course, the solution is only partial; backtick style fenced code blocks mean that you can't hard-wrap this kind of inline code span; the closing backticks must be on the same line as the opener. This is an argument against using backticks for fenced code blocks, but it's probably too well established in Markdown to change that.

Anyway, this reason for disallowing backticks doesn't apply to tildes, so perhaps tildes should be allowed in the info string. A nice advantage of allowing them would be that you could write stuff like this:

~~~~~~ haskell ~~~~~~~
f a >>= g >=> h
~~~~~~~~~~~~~~~~~~~~

which looks rather nice!

@jgm

This comment has been minimized.

Show comment
Hide comment
@jgm

jgm Feb 1, 2015

Member

See also #197.

Member

jgm commented Feb 1, 2015

See also #197.

@Crissov

This comment has been minimized.

Show comment
Hide comment
@Crissov

Crissov Sep 29, 2017

Contributor

0.28 says:

The [info string] may not contain any backtick
characters. (The reason for this restriction is that otherwise
some inline code would be incorrectly interpreted as the
beginning of a fenced code block.)

This disallows ~~~ info ` string etc. which seems unintentional given example 114:

[Info strings] for backtick code blocks cannot contain backticks:

```````````````````````````````` example
``` aa ```
foo
.
<p><code>aa</code>
foo</p>
````````````````````````````````
Contributor

Crissov commented Sep 29, 2017

0.28 says:

The [info string] may not contain any backtick
characters. (The reason for this restriction is that otherwise
some inline code would be incorrectly interpreted as the
beginning of a fenced code block.)

This disallows ~~~ info ` string etc. which seems unintentional given example 114:

[Info strings] for backtick code blocks cannot contain backticks:

```````````````````````````````` example
``` aa ```
foo
.
<p><code>aa</code>
foo</p>
````````````````````````````````
@robinst

This comment has been minimized.

Show comment
Hide comment
@robinst

robinst Aug 13, 2018

Contributor

Ping. At the moment, the following results in a code block in commonmark.js (dingus link):

~~~ info ` string
test
~~~

But according to the spec it's not allowed:

The info string may not contain any backtick characters.

Contributor

robinst commented Aug 13, 2018

Ping. At the moment, the following results in a code block in commonmark.js (dingus link):

~~~ info ` string
test
~~~

But according to the spec it's not allowed:

The info string may not contain any backtick characters.

@jgm jgm added this to the 0.29 milestone Aug 25, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment