Closed bertBruynooghe closed 7 years ago
Please provide an example that doesn't render correctly as I don't understand the problem. Also: what do you mean by "iso."?
Rendering:
```test```
renders into:
<p><code>test</code></p>
(as we can see from http://kramdown.herokuapp.com)
While we need it to be:
<pre><code>test</code></pre>
for reveal.js to consider it as a valid code block and render the slides correctly. This is also the expected behaviour according to CommonMark, so it might be good if there was at least an option to render the html that way using kramdown.
A fenced codeblock consists of two separator lines between which the content is placed:
~~~
test
~~~
What you provided as an example doesn't have any separator line and therefore can't be a codeblock. But since backticks are used for inline code, your example is interpreted as a paragraph with a single code element, as it should be.
Can you provide the link to the CommonMark spec where it says otherwise? I could find anything and your first link was to the normal codeblock syntax (i.e. indented lines).
You are probably right, I was getting confused between different implementations of markdown. http://spec.commonmark.org/0.27/#fenced-code-blocks
That being said,
~~~
test
~~~
does render as expected, so we can use that as a workaround, but:
```
test
```
still does not.
Using backticks is not supported by kramdown but if you use the GFM parser it supports tildes as well as backticks (tildes should work everywhere though).
Thanks for clearing this up for me!
Using backticks is not supported by kramdown but if you use the GFM parser it supports tildes as well as backticks (tildes should work everywhere though).
Hi @gettalong! I'm working on a file and was surprised that backticks didn't work for fenced blocks in kramdown (I'm using kramdown-rfc to write a spec) and found this issue.
Is this by design or something that could be changed? (e.g. by submitting a PR that'd implement backticks support). I'm fine either way but I would like to clarify (I'm asking only for fenced code blocks using backticks in addition to tildes).
Thanks for your time! :wave:
@wiktor-k Fenced code blocks with the kramdown parser will only work with tildes and this won't be changed. If you need backticks you either need to extend the parser yourself or use the GFM parser.
Understood. Thanks!
Recently, I had an issue with reveal-ck where I thought it would be a good idea to use kramdown as rendering engine instead of redcarpet. However, it turned out we we had one important issue with code blocks rendering as
<p><code></code></p>
iso.<pre><code></code></pre>
as required by the underlying reveal.js framework.Since this is also the result as specified in the (preliminary) CommonMark syntax, it might be a good idea to have kramdown also rendering it this way (by default or based on some config).
Is this something you would consider? (I might be creating a PR if I have some spare time.)