Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incorrect processing of list and next block of code #146

Closed
amshkv opened this issue Sep 2, 2021 · 4 comments
Closed

Incorrect processing of list and next block of code #146

amshkv opened this issue Sep 2, 2021 · 4 comments

Comments

@amshkv
Copy link

amshkv commented Sep 2, 2021

Hi. i have next sample:

* simple list item
* simple list item

```java
import
```

and i get
=> " - simple list item\n - simple list item\n\n<!-- end list -->\n\n java\nimport\n\n"

image

if you insert any text or separator the problem goes away

* simple list item
* simple list item

asdf

```java
import
```

" - simple list item\n - simple list item\n\nasdf\n\n``` java\nimport\n```\n"

can be removed somehow <!-- end list --> coment without adding other blocks?

@gjtorikian
Copy link
Owner

I can't reproduce this at all:

irb(main):002:0" str = <<~DOC
irb(main):003:0" * simple list item
irb(main):004:0" * simple list item
irb(main):005:0" 
irb(main):006:0" ```java
irb(main):007:0" import
irb(main):008:0" ```
irb(main):009:0> DOC
irb(main):011:0> CommonMarker.render_html(str, :DEFAULT)
=> "<ul>\n<li>simple list item</li>\n<li>simple list item</li>\n</ul>\n<pre><code class=\"language-java\">import\n</code></pre>\n"

How are you calling Commonmarker?

@amshkv
Copy link
Author

amshkv commented Sep 2, 2021

CommonMarker.render_doc(str, :DEFAULT).to_commonmark
we use render_doc to preprocess images

test with CommonMarker.render_html(str, :DEFAULT) does not contain end list

@kivikakk
Copy link
Collaborator

kivikakk commented Sep 2, 2021

See here:

https://github.com/commonmark/cmark/blob/6fcf869337a125f784ee7bd4f1c50ac1af9d5715/src/commonmark.c#L217-L223

This is hard to avoid.

@gjtorikian
Copy link
Owner

Given that this is an issue in the core Commonmark, I would suggest you work with them to address it, @amshkv. Since this is only a Ruby wrapper to that C library there's not much we can do, as we don't want to deviate from their implementation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants