Second code span not recognised after an unclosed backtick string and another code span
Évaluation
- Difficulté
- 3/5
- Temps estimé
- 1-2 jours
- Accessibilité débutants
- 68/100
Piste de recherche
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.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
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.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.
- Langage dominant
- Java
- Étoiles
- 2.7k
- Forks
- 336
- Métriques de merge des PR
- Aucune PR mergée en 30 j
Préparer son environnement
- Aucun Dockerfile ni fichier Docker Compose
- Aucun modèle de pull request
- Lire le guide de contribution
Par où commencer
- Lisez l'issue en entier, puis le guide de contribution du projet.
- Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
- Forkez le dépôt et travaillez sur une branche.
- Ouvrez une pull request qui référence le numéro de l'issue.
Autres issues de commonmark/commonmark-java
-
Difficulté 2/5 1-3 heures Accessibilité débutants 70/100
commonmark/commonmark-java#460 ·
-
Difficulté 4/5 3-5 jours Accessibilité débutants 74/100
commonmark/commonmark-java#457 ·
-
Difficulté 3/5 1-2 jours Accessibilité débutants 48/100
commonmark/commonmark-java#443 · 4 commentaires ·
-
Option to define custom flanking/canOpen/canClose rules for delimitersPeut-être à nouveau libre @abhiramaab l’a pris il y a 58 jours, et aucune pull request n’est ouverte. Ouverteenhancement
Difficulté 4/5 3-5 jours Accessibilité débutants 45/100
commonmark/commonmark-java#428 · 4 commentaires ·
-
enhancement
Difficulté 5/5 Plus d'une semaine Accessibilité débutants 25/100
commonmark/commonmark-java#414 · 1 commentaire · 1 réaction ·
Toutes les issues de commonmark/commonmark-java
Issues similaires
-
Difficulté 2/5 1-3 heures Accessibilité débutants 72/100
floci-io/floci#5369 · 1 commentaire ·
Les mainteneurs répondent en général sous 1 jour
-
Difficulté 2/5 1-3 heures Accessibilité débutants 72/100
sqlcipher/sqlcipher-android#97 · 1 commentaire ·
-
bug IIIF interoperability
Difficulté 2/5 1-3 heures Accessibilité débutants 72/100
-
Difficulté 2/5 1-3 heures Accessibilité débutants 72/100
-
Difficulté 2/5 1-3 heures Accessibilité débutants 68/100
Netcracker/qubership-integration-platform#1046 ·
Les mainteneurs répondent en général sous 2 jours