Title: Second code span not recognised after an unclosed backtick string and another code span · Issue #458 · commonmark/commonmark-java · GitHub
Open Graph Title: Second code span not recognised after an unclosed backtick string and another code span · Issue #458 · commonmark/commonmark-java
X Title: Second code span not recognised after an unclosed backtick string and another code span · Issue #458 · commonmark/commonmark-java
Description: Steps to reproduce the problem (provide example Markdown if applicable): `` `a` `c` The same through the API, with two neighbouring inputs that render correctly, to show the trigger: import org.commonmark.parser.Parser; import org.common...
Open Graph Description: Steps to reproduce the problem (provide example Markdown if applicable): `` `a` `c` The same through the API, with two neighbouring inputs that render correctly, to show the trigger: import org.com...
X Description: Steps to reproduce the problem (provide example Markdown if applicable): `` `a` `c` The same through the API, with two neighbouring inputs that render correctly, to show the trigger: import org.com...
Opengraph URL: https://github.com/commonmark/commonmark-java/issues/458
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Second code span not recognised after an unclosed backtick string and another code span","articleBody":"Steps to reproduce the problem (provide example Markdown if applicable):\n\n```\n`` `a` `c`\n```\n\nThe same through the API, with two neighbouring inputs that render correctly, to show the trigger:\n\n```java\nimport org.commonmark.parser.Parser;\nimport org.commonmark.renderer.html.HtmlRenderer;\n\npublic class Main {\n public static void main(String[] args) {\n Parser parser = Parser.builder().build();\n HtmlRenderer renderer = HtmlRenderer.builder().build();\n for (String md : new String[] {\"`` `a` `c`\", \"`` `a`\", \"`a` `c`\"}) {\n System.out.print(md + \" -> \" + renderer.render(parser.parse(md)));\n }\n }\n}\n```\n\nExpected behavior:\n\n```\n\u003cp>`` \u003ccode>a\u003c/code> \u003ccode>c\u003c/code>\u003c/p>\n```\n\nThis is what the reference implementation, commonmark.js 0.31.2, gives for all three inputs: the ``` `` ``` has no\nclosing double backtick and stays literal, and both `` `a` `` and `` `c` `` are code spans (spec 0.31.2, Code spans).\n\nActual behavior:\n\n```\n\u003cp>`` \u003ccode>a\u003c/code> `c`\u003c/p>\n```\n\nThe full output of the program above:\n\n```\n`` `a` `c` -> \u003cp>`` \u003ccode>a\u003c/code> `c`\u003c/p>\n`` `a` -> \u003cp>`` \u003ccode>a\u003c/code>\u003c/p>\n`a` `c` -> \u003cp>\u003ccode>a\u003c/code> \u003ccode>c\u003c/code>\u003c/p>\n```\n\nThe second code span, `` `c` ``, is left as text. It takes all three parts: with only the unclosed ``` `` ``` and one\ncode span, or with the two code spans and no unclosed string, the output is correct. Text between the parts changes\nnothing, and every further code span of the same length stays text too: `` `a` `c` `e` `` after the unclosed string\ngives `` \u003ccode>a\u003c/code> `c` `e` ``.\n\nTested on commonmark 0.30.0 from Maven Central and on current main (b89e72f).\n\nBTW, this was found by an automated program that writes property-based tests for various open source projects using [hegel](https://github.com/hegeldev/hegel-java) (but it has been reviewed by hand before reporting). We've also potentially found (but not yet hand validated) 51 other bugs in commonmark-java. You can see the tests at https://github.com/hegeldev/hegel-zoo/tree/main/targets/java/commonmark-java. Let us know if you would like us to file the other bugs found and/or contribute the tests. NB the tests are currently LLM generated and probably not yet suitable for inclusion as is, but we're happy to help get them into a better state if you want them.\n","author":{"url":"https://github.com/DRMacIver","@type":"Person","name":"DRMacIver"},"datePublished":"2026-09-22T09:56:08Z","url":"https://github.com/commonmark/commonmark-java/issues/458"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:a83c2569-d2b2-b760-40fa-75859c09db28 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | E124:322337:46AFA5:604DC3:6AFBBB0B |
| html-safe-nonce | 4bb73757fc5e10991b08941c48ddf9aa1429c09b7fdc36c1610c532ce060dcfe |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJFMTI0OjMyMjMzNzo0NkFGQTU6NjA0REMzOjZBRkJCQjBCIiwidmlzaXRvcl9pZCI6IjY5NTA5MzE4MDE4NDU3NzUxMTUiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 44f17cf1dcd009e2533c536b84866b3af64bdcd75a69452e7fe0f1e0410397d9 |
| hovercard-subject-tag | issue:5537966252 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/commonmark/commonmark-java/458/issue_layout |
| twitter:image | https://opengraph.githubassets.com/7f7454d88328bf1ef43f4bb6f1ef568920c9accf6d3b47cde62c1b86f0691c81/commonmark/commonmark-java/issues/458 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/7f7454d88328bf1ef43f4bb6f1ef568920c9accf6d3b47cde62c1b86f0691c81/commonmark/commonmark-java/issues/458 |
| og:image:alt | Steps to reproduce the problem (provide example Markdown if applicable): `` `a` `c` The same through the API, with two neighbouring inputs that render correctly, to show the trigger: import org.com... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | DRMacIver |
| hostname | github.com |
| expected-hostname | github.com |
| None | 2b2ef9c1578c18d8ed27027940544c958743213cf4461659f14d3ccdf51e162c |
| turbo-cache-control | no-preview |
| go-import | github.com/commonmark/commonmark-java git https://github.com/commonmark/commonmark-java.git |
| octolytics-dimension-user_id | 8661225 |
| octolytics-dimension-user_login | commonmark |
| octolytics-dimension-repository_id | 39477878 |
| octolytics-dimension-repository_nwo | commonmark/commonmark-java |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 39477878 |
| octolytics-dimension-repository_network_root_nwo | commonmark/commonmark-java |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | e4cce0e99cf61481a318ff12c2e8580153a6c7c6 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width