Faire / mjml-react

React component library to generate the HTML emails on the fly
https://www.npmjs.com/package/@faire/mjml-react
MIT License
376 stars 16 forks source link

Generate docs for components from mjml.io #9

Open IanEdington opened 1 year ago

IanEdington commented 1 year ago

Idea from @psugihara:

The biggest pain point I see with the package is documentation. My process is looking at mjml docs then kind of guessing on props or looking at the source code for each component. I think there’s a good argument for keeping mjml docs as the source of truth but I wonder if there’s some way of generating docs for the components or even adding.

IanEdington commented 1 year ago

generated from this workflow: https://github.com/mjmlio/mjml/blob/master/.github/workflows/build-documentation.yml

Collects all the package readme.mds and concatenates them.

2 options I see

  1. Move the parsing work upstream by adding jsDocs to the components and writing a pre-processing step that generates the readme from the component documentation.
    • Benefit:
      • easier to manage documentation in mjmlio/mjml (adding a prop and updating docs happen at the same place)
      • less fragile than a script to read from the readme.md files
    • cons:
      • probably more work
      • requires upstream collaboration
  2. Parse the readme files to extract the prop values.
    • Pros:
      • relatively easy to get 80% completion
    • Cons:
      • most likely brittle
      • getting to 100% completion will be very difficult

@emmclaughlin (and other) any thoughts on these or other options you would propose?

@iRyusa I'd be interested in hearing your thoughts on this as the upstream library maintainer