A Fennel Parser for IncDown
Find a file
2023-11-27 23:36:16 -08:00
flake.lock feat: init block tokenier 2023-11-27 23:36:16 -08:00
flake.nix feat: init block tokenier 2023-11-27 23:36:16 -08:00
main.fnl feat: init block tokenier 2023-11-27 23:36:16 -08:00
README.incd feat: init block tokenier 2023-11-27 23:36:16 -08:00

=== IncDown Parser ===

Turn IncDown into HTML. 
First attempt at a parser, written in [Fennel](https://fennel-lang.org/)

Input -> Block Tokenizer (Lexxing?) -> Inline Lexer -> Rendered?

I think that's how this will work

= Status =
Block Tokenizer currently working, except for the code fences

The code fence regex is wrong, since it looks for the entire block, instead of just the first line. Not quite sure how to use a different regex or "swap modes" into code fence mode such that everything until `}}}` is part of the codeblock. 

-----

= Blocks =
Each block is generally seperated by \n 
This means we require lookahead?

Block parser breaks the text up into blocks:
- Metadata
  - %attribute
- Paragraphs
  - Any character not claimed by the others?
- Lists
  - # or - started lines (any number of spaces)
- Headings
  - = start and ending
- Quotes
  - > start (any number of spaces)
- Images
  - ![Alt](Link)
- Foot notes
  - _[#] and then %footnote ??? need to think about this one
- Code blocks
  - {{{code hint\n code}}}
- Section breaks
  - 5 continuous - on a single line

= Inline =
- Decorations
- Links
- Images? Maybe images can't be inlined? 
- Footnotes

== Future Work ==

If this goes well may attempt to write:
- Blog engine in Fennel on top of this
- TreeSitter Grammar
- NVim Theme (does this come free with treesitter?)
- Pandoc Grammer? (Seems unlikely)