Second code span not recognised after an unclosed backtick string and another code span
Bewertung
- Schwierigkeit
- 3/5
- Geschätzter Aufwand
- 1-2 Tage
- Anfängerfreundlichkeit
- 68/100
Rechercherichtung
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.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Beschreibung
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.
- Vorherrschende Sprache
- Java
- Sterne
- 2.7k
- Forks
- 336
- PR-Merge-Kennzahlen
- Keine gemergten PRs in 30 T.
Entwicklungsumgebung
- Kein Dockerfile und keine Docker-Compose-Datei
- Keine Pull-Request-Vorlage
- Beitragsleitfaden lesen
Erste Schritte
- Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
- Forken Sie das Repository und arbeiten Sie in einem Branch.
- Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.
Mehr aus commonmark/commonmark-java
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 70/100
commonmark/commonmark-java#460 ·
-
Schwierigkeit 4/5 3-5 Tage Anfängerfreundlichkeit 74/100
commonmark/commonmark-java#457 ·
-
Schwierigkeit 3/5 1-2 Tage Anfängerfreundlichkeit 48/100
commonmark/commonmark-java#443 · 4 Kommentare ·
-
Option to define custom flanking/canOpen/canClose rules for delimitersEvtl. wieder frei @abhiramaab hat das vor 57 Tagen übernommen, und es ist kein Pull Request offen. Offenenhancement
Schwierigkeit 4/5 3-5 Tage Anfängerfreundlichkeit 45/100
commonmark/commonmark-java#428 · 4 Kommentare ·
-
enhancement
Schwierigkeit 5/5 Über eine Woche Anfängerfreundlichkeit 25/100
commonmark/commonmark-java#414 · 1 Kommentar · 1 Reaktion ·
Alle Issues in commonmark/commonmark-java
Ähnliche Issues
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 64/100
-
enhancement
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 65/100
liquid-java/liquidjava#373 ·
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 72/100
NationalSecurityAgency/ghidra#9748 ·
Maintainer antworten meist innerhalb von 1 Tag
-
enhancement
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 85/100
Maintainer antworten meist innerhalb von 1 Tag
-
spring-mcp-tools
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 85/100
explyt/spring-plugin#591 ·
Maintainer antworten meist innerhalb von 1 Tag