Considering the following 2 snippets:
<script>
Foo
Bar
</script>
<div>
<script>
Foo
Bar
</script>
</div>
Which are rendered respectively as:
<script>
Foo
Bar
</script>
<div>
<script>
Foo
<pre><code>Bar
</code></pre>
</script>
</div>
I’d say that the script
tag isn’t detected properly.
The first rule for detecting HTML blocks, here, seems designed explicitly for supporting the case where empty new lines are found inside pre, style and script tags.
But it breaks down as soon as we wrap that script in any another tag that is not a pre, style or script tag.
Since no human nor any HTML parser would not properly parse the script tag in the second snippet I posted I propose to fix this.
Maybe a good enough rule to fix this would be that if we are inside pre, style and script tags then their specific exit condition rule takes precedence over any other rules.
What do you think?
Here’s the original issue: https://github.com/commonmark/commonmark-spec/issues/597