ruricolist / spinneret

Common Lisp HTML5 generator
MIT License
369 stars 26 forks source link

<code> block inside <pre> block should be preformatted #41

Closed HenryS1 closed 4 years ago

HenryS1 commented 4 years ago

Many syntax highlighters (for instance highlight.js and prismjs) expect code to be in <pre><code> blocks. However, when I put code inside a code block the whitespace for formatting it disappears. Here's an example:

CL-USER> (spinneret:with-html-string (:pre (:code "(defun blah ()
    (+ 1 2))")))
"<pre>
 <code>(defun blah () (+ 1 2))</code></pre>"

I'd expect the result to be

"<pre><code>(defun blah ()
    (+ 1 2))</code></pre>"

Perhaps this could be resolved by adding :code to the *preformatted* list.