Skip to content

Artawower/org-mode-ast

Repository files navigation

Org mode AST.

Buy Me A Coffee donate button Patreon donate button

Abstract syntax tree via typescript for org mode.

  • No regexp
  • Fast
  • Minimum dependencies as possible
  • Real tree structure
  • Idempotency, which means reverse operations lead to the original state

Why is there another org-mode parser?

Firstly, when i started building the org roam web implementation i faced with one big problem, there are no parsers which could satisfy all requirements that i need

Also, i figured out implementation a bit, and found that these very complex solutions, most of the time based on regexp, which are not good for parsing and readability, and also have poor performance.

This project completely ignore implementation from emacs data tree, cause i have been developing this code for my own purposes. I wanted to control every node and property which i have in my tree. Moreover, i wanted to have idempotency with converting from AST to text and vise versa. Right now, many parsers losing some characters, like newlines or extra spaces.

Of this requirements i want the following from this parser:

  1. Full testing all possible nodes.
  2. Development according to the TDD principles.
  3. Easy to read.
  4. There are small handlers for each node types
  5. The structure of tree is very similar to visible result (including nested folding)
  6. Each element of the tree has own range with begin and end positions.
  7. All operations with the tree, such as formatting, auto-insert, etc. must be implemented as a separate logic with its own class.

Progress

Org nodes

  • [X] Bold/italic/crossed out text
  • [X] Lists
  • [ ] List progress
  • [X] Headlines
  • [X] Inline code
  • [X] Inline quotes
  • [ ] Tables
  • [ ] Links
  • [X] Src blocs
  • [ ] Latex blocks
  • [ ] Html/quotes blocks
  • [ ] Inline html
  • [ ] Html attributes
  • [X] Comments
  • [ ] Properties
  • [ ] Date and time
  • [ ] Keywords
  • [ ] Cross links
  • [X] Tags

    Am i miss something? Please, let me know.

Common feature

  • [ ] Metadata collecting

Also see

Contribute

Buy Me A Coffee donate button Patreon donate button

Every help is greatly appreciated.

About

Abstract syntax tree via typescript for org mode

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages