Backtick code block not recognized within <details> element
greghendershott opened this issue · 2 comments
Backtick code blocks aren't recognized inside a <details>
element. For example:
<details>
```racket
(define (sqr x)
(* x x))
```
</details>
Originally reported as greghendershott/frog#202
Although I'd need to reload my brain as it's been months (years?) since I worked on the markdown parser, my initial guess is that nothing in the details
element is being parsed as markdown -- possibly because details
isn't in the block-elements
set in html.rkt
?
My initial guess/memory was wrong.
As soon as you use some HTML open tag, you basically "escape" into an HTML parser -- which won't parse markdown -- until the matching closing tag.
So for instance <p>Some _text_ here</p>
will not parse the underlines around text as <em>
; you'll get the underlines as "raw text".
Generally this is the safe/smart thing to do -- as best I understand, and as best I remember from the days when I tried to keep this markdown parsing logic in my brain.
Having said all that, I notice many markdown parsers do handle <details>
. Maybe I should add that as a special case.
(On the one hand I don't love special cases. But on the other hand I'm very worried about touching how HTML is handled, generally -- and breaking many things, generally. I don't have time now to chase down a lot of breakage. (I barely have time to attempt this as a limited special case.))
I have a commit for this. I'm going to sleep on it.
Incidentally, here's how various markdown parsers handle this.