developit / snarkdown

:smirk_cat: A snarky 1kb Markdown parser written in JavaScript
http://jsfiddle.net/developit/828w6t1x/
MIT License
2.28k stars 110 forks source link

pre+code tag instead of just pre #84

Closed mesqueeb closed 4 years ago

mesqueeb commented 4 years ago

In order to make PrismJS syntax highlighting work, it requires all code blocks to be formatted like so:

<pre>
  <code>
// the code
  </code>
</pre>

But snarkdown only uses <pre> without <code>.

My request is that snarkdown uses <pre><code> by default OR via an option.

From the PrismJS docs:

Encourages good author practices. Other highlighters encourage or even force you to use elements that are semantically wrong, like <pre> (on its own) or <script>. Prism forces you to use the correct element for marking up code: <code>. On its own for inline code, or inside a <pre> for blocks of code. In addition, the language is defined through the way recommended in the HTML5 draft: through a language-xxxx class.

https://prismjs.com/#features-full

mesqueeb commented 4 years ago

↑ solved by this PR 😉