Skip to content

End the fenced code language at a tab, not only a space - #478

Open
bardrop wants to merge 1 commit into
commonmark:mainfrom
bardrop-oss:fix-fence-language-tab
Open

bardrop wants to merge 1 commit into
commonmark:mainfrom
bardrop-oss:fix-fence-language-tab

Conversation

@bardrop

@bardrop bardrop commented Nov 21, 2026

Copy link
Copy Markdown
Contributor

Follow-up to #477, as discussed there.

The HTML renderer took the language from the info string up to the first space only, so a tab stayed in the class:

```py	x
code
```
  • commonmark.js / cmark: <pre><code class="language-py">
  • commonmark-java: <pre><code class="language-py x">

CoreHtmlNodeRenderer now ends the language at the first space or tab (Characters.isSpaceOrTab). The new test FencedCodeBlockParserTest.languageEndsAtTab fails before and passes after. mvn test and mvn spotless:check pass.

```py<TAB>x rendered class="language-py<TAB>x"; cmark and commonmark.js
end the first word of the info string at any whitespace.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant