fletcher / peg-multimarkdown

An implementation of MultiMarkdown in C, using a PEG grammar - a fork of jgm's peg-markdown. No longer under active development - see MMD 5.
Other
525 stars 55 forks source link

Public API for accessing the generated AST #109

Open hydrixos opened 12 years ago

hydrixos commented 12 years ago

For several applications, it is useful to operate directly on the AST instead of only generating a string output.

I've created a fork that has an API "markdown_to_ast" that allows to access the generated AST. This API is accessible through a separate header "markdown_parser_lib.h" that exposes the AST data structures to the public. A further API "markdown_free_ast" can be used to clean up the operations. For compatibility reasons, I've left out the "typedef struct Link link", thus it becomes easier to use your library in UNIX systems.

I've also adapted "markdown_lib.c" such that "markdown_to_gstring" utilizes the "markdown_to_ast" function.

(I've also did some minor changes to remove warnings and updated the XCode project for XCode 4.3)

fletcher commented 12 years ago

I'll have to review this and see if I want to merge (at the risk of making it more difficult to stay in sync with the original peg-markdown), or leave this is a separate fork?

It's definitely a valuable feature for some developers

janrito commented 11 years ago

I would love to see this implemented.

Writing scientific papers with multimarkdown is fantastic, but there are some features that are desperately needed, like multiple images in a figure, or equation labeling. However, I understand that not enough people need them to be added to the standard language.

Recently Pandoc moved from exposing the AST to exporting a JSON document. Maybe this could be a simpler path for Multimarkdown as well.

fletcher commented 11 years ago

I suspect most of these things can be done via a latex-include file that redefines some of the standard commands.

Right now I'm working on an iOS version of Composer and a complete rewrite of the Mac version. Adding something this big to MMD, and doing the testing it would take is not something I'm going to have time to do for quite a while.

I'm not ruling it out entirely, but I've got too much else going on to do this right now.

fletcher commented 7 years ago

This project has been superseded by MMD-4, MMD-5, and now MMD-6. MMD-4 was released in 2013.

I'm not maintaining this one anymore and recommend anyone using MMD should upgrade to MMD-6, or at least v5 until you're ready to migrate to 6.