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 for parsing
  • 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 [24/24]

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

    Am I missing something? Please, let me know.

Common features [0/0]

  • [ ] Metadata collecting

Middle priority

  • [ ] Paragraph
  • [ ] Planning
  • [ ] attributes
  • [ ] Dynamic blocks
  • [ ] Filetags
  • [ ] Footnote
  • [ ] Subscripts
  • [ ] Latex fragment (partial)
  • [ ] Radioa targets

Low-priority features

  • [ ] Results block
  • [ ] Cross-links
  • [ ] Noweb support
  • [X] 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.

About

Abstract syntax tree via typescript for org mode

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages