• Type: Task
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 8.3
    • Fix Version/s: 8.4
    • Labels:
    • Similar issues:


      Pegdown is now officially dead. See See

      We need to move to to which was specifically designed as an AST API for Markdown syntax(es) and definitely looks interesting.

      Here is Vladimir's advertisement ():

      @tmortagne, for my project the effort of maintaining and supporting pegdown related issues became unbearable.

      I wound up rewriting commonmark-java to replace pegdown in my Markdown Navigator plugin for IntelliJ IDEs:

      The parser project is has very detailed source based AST with source offset for every part of the element. I need that for syntax highlighting and other plugin source reliant features.

      The AST is very regular, part of all the tests not just ones geared for AST testing and source offsets are free of idiosyncrasies and easily adjusted. It is fully modifiable unlike pegdown's with next, prev and parent links that you can walk, unlink and move around if needed. There are many ways to extend the parser including turning off core parsing features. I geared it for extensibility and made sure handling of AST nodes is uniform whether it is part of the core or part of an extension. So extensions can and do add their own nodes to the AST.

      It is CommonMark 0.27 (GitHub Comments) compliant but has parser configuration options to emulate list indentation rules used by:, MultiMarkdown (like pegdown 4 space indents) and kramdown (GitHub Docs). The only extensions that pegdown has that I did not yet implement are: typographic quotes, smarts and definition lists. The rest of the extensions are available, with some extra ones that pegdown does not have.

      As an added bonus and what motivated me to write my own parser: the parsing is 30-50x faster than pegdown on average documents and several thousand times faster on pegdown's pathological input like [[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[.

      Maintaining it is a walk in the park compared to what I had to do with pegdown. The tests are in a modified markdown format, actually CommonMark test spec format extended to include the AST. The AST generation is tested on every test not just some chosen few like it was on pegdown. I literally lost weeks debugging AST source offset errors in pegdown for cases that were not part of its AST tests.

      I also have code to convert from pegdown Extensions flags to my uniform configuration API that I used in the initial migration from pegdown to flexmark-java. So if you are ever on the lookout for a pegdown replacement let me know and I will give you a hand in your migration trial.


          Issue Links



              • Assignee:
                vmassol Vincent Massol
                tmortagne Thomas Mortagne
              • Votes:
                1 Vote for this issue
                2 Start watching this issue


                • Created:
                  Date of First Response: