-
Notifications
You must be signed in to change notification settings - Fork 77
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
Replace pegdown with modern markdown parser #81
Comments
Any thought on Laika @sirthias ? I saw you played with it at one point. It's directive format is a big different, but it has a PDF renderer. Also it looks like flexmark-java requires Java 8. Right now Paradox only requires Java 7 AFAIK. |
@jonas, I am the author of flexmark-java and in discussion with @sirthias about pegdown end of life maintenance. Java 8 language level features will be removed from flexmark-java in the next few days since it also prevents flexmark-java from supporting android. So this is not going to be an issue. If you do decide to migrate to flexmark-java and are interested I can offer active help in the migration of paradox to flexmark-java since I had to make this trip for my plugin: https://github.com/vsch/idea-multimarkdown, which was intimately dependent on pegdown's every quirk and feature. |
Yes, I've played with Laika. It's not a bad project either, but it has a lot fewer users than For example, Also, quite importantly, |
@jonas, Java version matters for android which is a show stopper for some pegdown users who are experiencing issues with ASM dependency in pegdown. So I have to address this. Lamda use can be easily replaced with anonymous classes and in IntelliJ IDEA carries no extra cost in typing or source code real-estate since the IDE collapses them to lambda looking code for display. I haven't looked at difficulty of rendering PDF or Latex but don't see an issue since it is a matter of walking the AST and generating the required output. Flexmark AST is source based like pegdown, but unlike pegdown is a linked list based with parent link. If anything, doing it for flexmark will be an order of magnitude simpler plus it would be a very nice addition to its feature set. Are there any existing open source implementations for Markdown to PDF and Latex converters that I can use as a stepping stone since I have not worked with either format before? |
@sirthias, thanks, I will take a look at it. I am no expert in Scala but learned to be conversant with it out of necessity. |
I'd be interested in helping out with PDF support if Paradox makes the move. Laika uses https://xmlgraphics.apache.org/ which should in theory keep everything JVM-based although I've never had much luck with XML-FO. I know that @eed3si9n has used Pandoc to generate PDFs via Latex by simply concatenating all Markdown files together. This however requires that each file is written with this in mind. In any case I don't think PDF support is a blocker for moving to a more modern parser. @vsch One last question: I don't know if flexmark-java have support for custom directives, but in any case would it be possible to extend the parser to support the current directive syntax?
|
@jonas, any help will be greatly appreciated. It has been just me and the crickets behind me, working on this like mad, for the last year. 😄 flexmark does not have custom directives but has a very flexible extension API. I don't see it as being hard to add. If you can give me what you need with some constraints, if any exist for above elements then I can add it as an extension. I am assuming that the above examples are additions on top of markdown, not affecting markdown syntax processing then they can be easily added as a node-processor, an extension that walks the AST and: removes, adds, modifies, re-arranges or creates new nodes based on whatever the code decides to do. If the If you have any options you would like to see in the extension such as rendering options, parsing options, please let me know. My aim in flexmark is to offer up configuration options for every extension that eliminates the need to write code for 99% of use cases. |
Just FYI here: I have just added a deprecation note to pegdown's README officially recommending flexmark-java as the best replacement. |
@sirthias Thanks for starting this discussion. You're the markdown parsing expert, so if you're saying flexmark-java is the way to go, I'm all for it. |
@jonas, flexmark-java Java language level has been downgraded to 7. Convenience class to convert pegdown extension flags to flexmark-java config options added. It makes migration easier. https://github.com/vsch/flexmark-java#pegdown-migration-helper If you can give me the specs for custom directives I will add the extension to the next release. |
I'd just like to say, while I'm definitely not against migrating, I don't think the current scenario is that grim. We've been using pegdown for many years now serving documentation on playframework.com. All markdown is parsed and rendered on the fly on each request to the documentation. Performance has never been an issue for our needs, and issues such as hanging have never manifested as being a problem. Aside from the initial contribution I made to support extensions, I don't think we've ever had a need for upstream changes or bugfixes in pegdown that I'm aware of. Aside from support for custom extensions, whatever library we select will need to have the following features:
|
Switching to flexmark-java sounds good to me too. And the feature set sounds great: AST with post processing support, detailed source positions in the AST, extensible at multiple levels, faster parser. |
Switching to a parser that allows generating a PDF would solve #14. |
I'm also interested in using code fences (aka "verbatim") with scalafiddle out of the box by specifying it as "scala scalafiddle", which is something that should be available according to the commonmark spec: https://spec.commonmark.org/0.27/#example-111 See jrblevin/markdown-mode#184 for an example of this kind of usage. I am aware there's a
and add |
I will start looking at this over the coming weeks. Vladimir and I have discussed meeting in person if something blocks my progress. Thanks a lot @vsch for showing this level of support! |
Any updates? |
I suggest adopting Ornate's markdown handling |
paradox currently builds upon
pegdown
as the underlying markdown parser. Although pegdown has a number of serious issues it comes with quite a large feature-set and has long been one of the few "go-to" markdown-parsing solutions on the JVM.Unfortunately, pegdown is essentially unmaintained with crucial bugs not being fixed. Also its parsing performance is relatively bad. Parser runtime can sometimes even become exponential, which means that the parser either appears to "hang" completely or abort processing after a time-out.
These deficiencies, along with the availability of newer, more modern and better maintained alternatives, should be sufficient motivation to consider a switch to another underlying parser solution.
I'd recommend we look at
commonmark-java
andflexmark-java
and evaluate, which one works better.From his involvement with pegdown I know @vsch (the author of
flexmark-java
) as being very friendly and responsive, so I'd trust him with responsible maintenance for the foreseeable future.commonmark-java
on the other hand is maintained by Atlassian, which is certainly not bad either.My impression is that either alternative will provide a much better foundation for all future work on paradox than pegdown.
The text was updated successfully, but these errors were encountered: