Skip to content
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

Closed
neongreen opened this issue Sep 14, 2014 · 4 comments
Closed

Tildes and backticks in info strings. #119

neongreen opened this issue Sep 14, 2014 · 4 comments
Labels
Milestone

Comments

@neongreen
Copy link
Contributor

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 jgm added the spec label Oct 24, 2014
@jgm
Copy link
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
Copy link
Member

jgm commented Feb 1, 2015

See also #197.

@Crissov
Copy link
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
Copy link
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
@jgm jgm closed this as completed in b7651e4 Oct 4, 2018
robinst added a commit to commonmark/commonmark-java that referenced this issue Apr 12, 2019
robinst added a commit to commonmark/commonmark-java that referenced this issue Apr 12, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants