autonity / docs.autonity.org

Documentation for the Autonity Go Client (AGC)
https://docs.autonity.org
2 stars 5 forks source link

Take reference information out of markdown tables, put into JSON files instead #196

Open rmsams opened 3 months ago

rmsams commented 3 months ago

Description

There is a significant amount of structured reference information in the docs site that lives in markdown tables. To take but one example, see Protocol Parameters.

I propose that structured reference information is stored as json files in a _data/json directory. Tables in documentation can then rendered using python code embedded in the doc pages' .md files by leveraging quarto's executable code blocks capabilities (with echo flag set to false so the py code isn't rendered in the html).

Rationale

Implementation

I haven't considered in detail how this might work, but here's a sketch:

natspecJSON -> tabularJSON -> [html tables] 
  1. using solc --devdoc on source code outputs "natspecJSON" objects;
  2. a python script process those and outputs "tabularJSON" files containing reference information (mostly tables); these files live in _data/json inside this repo;
  3. python code inside page markdown source files generates the html tables (using tabulate or other libraries)

There is probably work that needs to get done with the natspec comments in the source code before the full pipleline is viable. But a PoC of the approach could be executed quickly by skipping 1 and writing some of the "tabularJSON" files by hand.