Skip to content

Commit

Permalink
fix(parser): code block language class
Browse files Browse the repository at this point in the history
previously the code block had a class with the name found in the markdown code notation:

```js
console.log(test);
```
<pre>
 <code class=js>
console.log(test);
 </code>
</pre>

now the parser generates the output according to https://html.spec.whatwg.org/multipage/text-level-semantics.html#the-code-element

<pre>
 <code class=language-js>
console.log(test);
 </code>
</pre>
  • Loading branch information
xNaCly committed Apr 19, 2023
1 parent 0d5e9af commit 356fc76
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion parser/tags.go
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ type CodeBlock struct {
}

func (p CodeBlock) String() string {
return fmt.Sprintf("<pre class=\"%s\"><code>%s</code></pre>", p.language, p.text)
return fmt.Sprintf("<pre class=\"language-%s\"><code>%s</code></pre>", p.language, p.text)
}

// <code></code>, inline code element, contains plain text
Expand Down

0 comments on commit 356fc76

Please sign in to comment.