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 one big problem, there are no parsers that could satisfy all requirements that I need

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

This project completely ignores implementation from the emacs data tree, cause I have been developing this code for my 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 vice versa. Right now, many parsers losing some characters, like newlines or extra spaces.

Of these requirements I want the following from this parser:

  1. Full testing of all possible nodes.
  2. Development according to the TDD principles.
  3. Easy to read.
  4. There are small handlers for each node type
  5. The structure of the tree is very similar to the visible result (including nested folding)
  6. Each element of the tree has its own range with beginning 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 [17/26]

  • [X] Bold/italic/crossed out text
  • [X] Lists
  • [X] List Progress
  • [ ] Headline tags
  • [ ] List item tags
  • [X] Headlines
  • [X] Inline code
  • [X] Inline quotes
  • [X] Links
  • [X] Src blocs
  • [X] Latex blocks
  • [ ] Latex fragment (partial)
  • [ ] Latex environment (next)
  • [X] Keywords
  • [X] Html/quotes blocks
  • [X] Verbatim
  • [ ] Fixed width value
  • [ ] Inline HTML
  • [ ] attributes
  • [X] Comments
  • [X] Properties
  • [X] Horizontal rule
  • [X] Date and time
  • [X] Tags
  • [ ] Tables
  • [ ] Float dates

    Am I missing something? Please, let me know.

Common features [0/0]

  • [ ] Metadata collecting

Low-priority features

  • [ ] Noweb support
  • [ ] Results block
  • [ ] Cross-links
  • [ ] Footnote
  • [ ] Entities
  • [ ] Inline source blocks

Autoformatting [0/3]

  • [ ] Auto-align tables
  • [ ] Calculate the progress of the list
  • [ ] Insert headline by level

Also see

Contribute

Buy Me A Coffee donate button Patreon donate button

Any help is greatly appreciated.

Fastnote?

  • Bulk tag editing

About

Abstract syntax tree via typescript for org mode

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages