Second code span not recognised after an unclosed backtick string and another code span
Avaliação
- Dificuldade
- 3/5
- Tempo estimado
- 1-2 dias
- Facilidade para iniciantes
- 68/100
Direção de pesquisa
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.
Escrita pelo modelo de indexação a partir do texto da issue.
Descrição
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.
- Linguagem predominante
- Java
- Estrelas
- 2.7k
- Forks
- 336
- Métricas de merge de PRs
- Nenhum PR com merge em 30d
Preparar o ambiente
- Sem Dockerfile nem arquivo Docker Compose
- Sem modelo de pull request
- Ler o guia de contribuição
Primeiros passos
- Leia a issue inteira e depois o guia de contribuição do projeto.
- Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
- Faça um fork do repositório e trabalhe em uma branch.
- Abra um pull request que referencie o número da issue.
Mais de commonmark/commonmark-java
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 70/100
commonmark/commonmark-java#460 ·
-
Dificuldade 4/5 3-5 dias Facilidade para iniciantes 74/100
commonmark/commonmark-java#457 ·
-
Dificuldade 3/5 1-2 dias Facilidade para iniciantes 48/100
commonmark/commonmark-java#443 · 4 comentários ·
-
Option to define custom flanking/canOpen/canClose rules for delimitersTalvez livre de novo @abhiramaab assumiu há 56 dias e não há nenhum pull request aberto. Abertaenhancement
Dificuldade 4/5 3-5 dias Facilidade para iniciantes 45/100
commonmark/commonmark-java#428 · 4 comentários ·
-
enhancement
Dificuldade 5/5 Mais de uma semana Facilidade para iniciantes 25/100
commonmark/commonmark-java#414 · 1 comentário · 1 reação ·
Todas as issues de commonmark/commonmark-java
Issues semelhantes
-
Add ZammadTalvez já em andamento @Arslan-TR assumiu hoje. Abertarequest
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 66/100
endoflife-date/endoflife.date#11298 · 1 comentário ·
Mantenedores costumam responder em até 1 dia
-
bug documentation
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 67/100
Mantenedores costumam responder em até 1 dia
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 88/100
java-native-access/jna#1740 ·
-
Upgrade org.apache.felix.utils to 1.11.10Talvez já em andamento @stataru8 assumiu hoje. Aberta
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 72/100
apache/karaf#2982 · 1 comentário ·
Mantenedores costumam responder em até 1 dia
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 70/100
objectionary/eo#9329 ·
Mantenedores costumam responder em até 1 dia