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

Public API for accessing the generated AST #109

Open
wants to merge 111 commits into
base: master
Choose a base branch
from

Conversation

hydrixos
Copy link

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
Copy link
Owner

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
Copy link

janrito commented Sep 27, 2012

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
Copy link
Owner

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.

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

Successfully merging this pull request may close these issues.

7 participants