Second code span not recognised after an unclosed backtick string and another code span
評估
研究方向
Start with the Java Parser and HtmlRenderer example in the issue and reproduce the three input strings against current main. Add regression coverage for the unclosed double-backtick input alongside the neighbouring code spans, and verify that the rendered HTML matches the expected output.
由索引模型根據 Issue 內容生成。
描述
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.commonmark.renderer.html.HtmlRenderer;
public class Main {
public static void main(String[] args) {
Parser parser = Parser.builder().build();
HtmlRenderer renderer = HtmlRenderer.builder().build();
for (String md : new String[] {"`` `a` `c`", "`` `a`", "`a` `c`"}) {
System.out.print(md + " -> " + renderer.render(parser.parse(md)));
}
}
}
Expected behavior:
<p>`` <code>a</code> <code>c</code></p>
This is what the reference implementation, commonmark.js 0.31.2, gives for all three inputs: the `` has no
closing double backtick and stays literal, and both `a` and `c` are code spans (spec 0.31.2, Code spans).
Actual behavior:
<p>`` <code>a</code> `c`</p>
The full output of the program above:
`` `a` `c` -> <p>`` <code>a</code> `c`</p>
`` `a` -> <p>`` <code>a</code></p>
`a` `c` -> <p><code>a</code> <code>c</code></p>
The second code span, `c`, is left as text. It takes all three parts: with only the unclosed `` and one
code span, or with the two code spans and no unclosed string, the output is correct. Text between the parts changes
nothing, and every further code span of the same length stays text too: `a` `c` `e` after the unclosed string
gives <code>a</code> `c` `e`.
Tested on commonmark 0.30.0 from Maven Central and on current main (b89e72f).
BTW, this was found by an automated program that writes property-based tests for various open source projects using hegel (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.
- 主要語言
- Java
- 星號
- 2.7k
- 分支
- 336
- PR 合併指標
- 30 天內沒有已合併 PR
環境準備
- 沒有 Dockerfile 或 Docker Compose 檔案
- 沒有 Pull Request 範本
- 閱讀貢獻指南
從這裡開始
- 先讀完整個 Issue,再讀專案的貢獻指南。
- 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
- Fork 儲存庫,在一個分支上完成修改。
- 送出 Pull Request,並在描述裡引用這個 Issue 編號。
commonmark/commonmark-java 的其他 Issue
-
難度 2/5 1-3 小時 新手友好度 70/100
commonmark/commonmark-java#460 ·
-
難度 4/5 3-5 天 新手友好度 74/100
commonmark/commonmark-java#457 ·
-
難度 3/5 1-2 天 新手友好度 48/100
commonmark/commonmark-java#443 · 4 則留言 ·
-
Option to define custom flanking/canOpen/canClose rules for delimiters可能重新可做 @abhiramaab 於 56 天前認領,目前沒有進行中的 PR。 未關閉enhancement
難度 4/5 3-5 天 新手友好度 45/100
commonmark/commonmark-java#428 · 4 則留言 ·
-
enhancement
難度 5/5 一週以上 新手友好度 25/100
commonmark/commonmark-java#414 · 1 則留言 · 1 個 reaction ·
查看 commonmark/commonmark-java 的全部 Issue
相似的 Issue
-
難度 1/5 1 小時以內 新手友好度 88/100
portfolio-performance/portfolio#6119 ·
維護者通常 8 天內回覆
-
難度 2/5 1-3 小時 新手友好度 68/100
jenkinsci/ec2-plugin#2041 ·
-
L: github:actions L: php:composer
難度 2/5 1-3 小時 新手友好度 88/100
dependabot/dependabot-core#16493 ·
維護者通常 1 天內回覆
-
SHOW EDIT of a subclass for an object of its superclass: the form fails to open with AssertionError未關閉
難度 2/5 1-3 小時 新手友好度 74/100
-
難度 1/5 1 小時以內 新手友好度 72/100