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

Encode, decode, and manipulate AST #58

Merged
merged 1 commit into from
Aug 23, 2024
Merged

Encode, decode, and manipulate AST #58

merged 1 commit into from
Aug 23, 2024

Conversation

leandrocp
Copy link
Owner

@leandrocp leandrocp commented Aug 22, 2024

With this code is now possible to convert markdown to an AST data structure to inspect and manipulate using regular Elixir APIs based on Floki since we're using the exact same format as {node, attrs, children}.

Two examples are available to show how that works:

Mermaid

https://github.com/leandrocp/mdex/blob/lp-encode-decode-ast/examples/mermaid.exs

mermaid

Alerts

https://github.com/leandrocp/mdex/blob/lp-encode-decode-ast/examples/alerts.exs

alerts

Those functions are pretty low-level at the moment but we'll provide a more high-level API to manipulate the AST and also to attach plugins.

@leandrocp leandrocp mentioned this pull request Aug 22, 2024
@leandrocp leandrocp merged commit cc77db9 into main Aug 23, 2024
4 checks passed
@leandrocp leandrocp deleted the lp-encode-decode-ast branch August 23, 2024 17:36
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.

1 participant