Skip to content

Next stage in the plugin architectureΒ #631

Open
@Michael-F-Bryan

Description

@Michael-F-Bryan

We merged a deliberately minimal Preprocessor phase in #532, so it might be time to start thinking of how the concept of a preprocessor can be extended.

After looking through @Byron's example preprocessor (#629) it's pretty obvious that the API for accessing a book's contents less than ideal, and making the Book API more ergonomic will probably go a long way in allowing third parties to create their own plugins.


This is more of a discussion thread so we can throw around ideas and opinions. @Byron, @sorin-davidoi, @azerupi and anyone else who's interested, feel free to chime in with ideas or suggestions 😁

To get the ball rolling I think a couple things we could do are:

  • Expose the sections item inside a Book so people can manually walk through a Book's contents
  • Allow people to provide their own preprocessor programs, similar to how alternate backends work
  • Possibly consider going from a tree-based structure for representing book chapters to a graph-based structure
    • The idea is a nested chapter can have links back to its parent (and maybe siblings?), making things like section numbers and breadcrumbs a lot easier to implement.
    • Parsing the SUMMARY.md file may become easier because we can avoid the ugly recursion needed to append items to a chapter.
    • To deal with ownership we'll probably want to use something like petgraph instead of rolling ourselves
    • Ensuring the entire thing is consistent after doing mutations may be interesting.
    • This breaks all current alternate backends (due to different JSON representations) and will probably make serializing/deserializing more tricky

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions