Skip to content

Commit

Permalink
Avoid repeated language- in info string.
Browse files Browse the repository at this point in the history
  • Loading branch information
jgm committed Jan 22, 2024
1 parent 0d77ca1 commit c1af25c
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/html.c
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,10 @@ static int S_render_node(cmark_node *node, cmark_event_type ev_type,

cmark_strbuf_puts(html, "<pre");
S_render_sourcepos(node, html, options);
cmark_strbuf_puts(html, "><code class=\"language-");
cmark_strbuf_puts(html, "><code class=\"");
if (strncmp((char *)node->as.code.info, "language-", 9) != 0) {
cmark_strbuf_puts(html, "language-");
}
escape_html(html, node->as.code.info, first_tag);
cmark_strbuf_puts(html, "\">");
}
Expand Down
15 changes: 15 additions & 0 deletions test/regression.txt
Original file line number Diff line number Diff line change
Expand Up @@ -241,3 +241,18 @@ _*xx-_-
<p><em>*xx-</em>-</p>
````````````````````````````````

commonmark.js #277:
```````````````````````````````` example
```language-r
x <- 1
```

```r
x <- 1
```
.
<pre><code class="language-r">x &lt;- 1
</code></pre>
<pre><code class="language-r">x &lt;- 1
</code></pre>
````````````````````````````````
Expand Down

0 comments on commit c1af25c

Please sign in to comment.