mlange-42 / yarner

Literate Programming command line tool for Markdown
https://mlange-42.github.io/yarner
MIT License
32 stars 1 forks source link

[Feature] Provide a possibility to hook in pre- or post-processors #53

Closed mlange-42 closed 3 years ago

mlange-42 commented 3 years ago

An option to provide additional features while not overloading the main application would be to allow for pre- or post-processors, similar to how mdBook does.

A way to realize that would be to pipe the ASTs ("abstract syntax trees") of all involved documents to external programs via JSON, let them modify these representations, and pipe them back.

Examples for add-on features that could use this possibility:

Data exchange

A decision must be made in which state to transfer documents:

  1. Raw markdown text before transclusions
    • Pros:
      • processor can add transclusions
    • Cons:
      • processor must anticipate changes by later transclusion
  2. Raw markdown text after transclusions
    • Pros:
      • more easy for the preprocessor to create additional documents (comp. to 3.)
    • Cons:
      • processor may have to parse the document similar to Yarner
  3. Parsed Document before code extraction
    • Pros:
      • easy to analyze document
    • Cons:
      • harder for the preprocessor to create additional documents (comp. to 2.)
      • a lot of data (potentially uninteresting for the processor) must be tranfered forth and back to allow for the addition of documents
  4. Raw markdown of documentation output
    • Pros:
    • Cons:
      • only docs can be modified
mlange-42 commented 3 years ago

For a trial with version 3.) (parsed document), see #125 for the implementation, and yarner-block-links and yarner-fold-code an example pre-processors.

mlange-42 commented 3 years ago

Implemented in #127, #128, #129, #130.