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

Different renderings comapared to original marked.js or github style #8

Open
doortts opened this issue Feb 28, 2016 · 7 comments
Open
Assignees
Labels

Comments

@doortts
Copy link

doortts commented Feb 28, 2016

Hi~ thank you for your markedj lib. : )

I'm trying to use it, but I have found some different rendering results.

Tested strings are

Message A
- list A
- List B

markedJ results is..

image

github or marked.js rendering is

Message A

  • list A
  • List B

Is it bug? or do I use it wrong?

@McFoggy
Copy link
Member

McFoggy commented Feb 28, 2016

Depending on the interpretation of markdown syntax ; It can be seen as corrrect.

StaackEdit editor also react like that
image

while Dillinger is more permissive

image

If you look at both default documents in each editor they have a blank line to separate a paragraph from the list.

@doortts
Copy link
Author

doortts commented Feb 29, 2016

@McFoggy Thanks for explanation. : )
But markedj author described at the README like this

JVM port of graceful markdown processor marked.js.

and rendered results is different from marked.js.
So, I left this issue.

@McFoggy
Copy link
Member

McFoggy commented Mar 1, 2016

@takezoe and what do you think about embedding marked.js inside a java wrapper.
Have a look at my fork branch issue-8 where I have indeed a Junit test demoing that this reported issue works with marked.js embedded in the JVM.

Now that nashorn (JRE javascipt engine) is very efficient and compete with V8, such solution become feasible.
Thus maintenance cost is very low, just follow marked.js releases.

For this specific problem in the java version, I think the Grammer#BLOCK_PARAGRAPH lacks somehow an exclusion for a BLOCK_LIST that could follow ; but modifying those regexp is not very easy.

@takezoe
Copy link
Member

takezoe commented Mar 1, 2016

@McFoggy markedj is not simply JVM port of marked.js. It is an extendable markdown processor for Java and other JVM based languages.
In fact, GitBucket is overriding some methods of markedj's Renderer:
https://github.com/gitbucket/gitbucket/blob/master/src/main/scala/gitbucket/core/view/Markdown.scala

And in my experience, Mustache.js on Nashorn has made memory leak. It was a troublesome problem which makes off-heap leak. So I would like to avoid to introduce Nashorn quickly.

I know that maintenance of markedj is much painful. However I think this cost is meaningful to pay for GitBucket and other applications on JVM.

@McFoggy
Copy link
Member

McFoggy commented Mar 1, 2016

It makes sense, was just an off proposition in case you did not thought about it. In the past with rhino especially embedding javascript was not a solution for real time but nashorn is far more better now.

@doortts
Copy link
Author

doortts commented Mar 3, 2016

Also, I had some test about nashorn with marked.js. I found that It has some problems compared to rhino. especially wrong translations of regex. And Nashhorn is fast for read but slower for hash input. So I had to back to rhino.

@takezoe takezoe added the bug label Mar 3, 2016
@takezoe takezoe self-assigned this Mar 3, 2016
@making
Copy link

making commented Mar 3, 2016

@McFoggy

what do you think about embedding marked.js inside a java wrapper.

Marked4j is a kind of your proposal lol
https://github.com/making/marked4j

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

No branches or pull requests

4 participants