wallee94 / graphdoc

Autogenerate HTML docs for your GraphQL API
https://wallee94.github.io/graphdoc/
MIT License
14 stars 4 forks source link

How can I put dynamic content ? #5

Closed PriyatamNayak closed 3 years ago

PriyatamNayak commented 3 years ago

Want to display the count of rows available in my tables in the doc page Can I make it dynamic ? If yes then how?

wallee94 commented 3 years ago

Hi! Yes, this should be possible using a custom jinja template, like in this example: https://github.com/wallee94/graphdoc/tree/main/examples/custom_templates

You would have to copy paste and update some of the default templates depending on where you want to display the count. The default templates are here: https://github.com/wallee94/graphdoc/tree/main/graphdoc/templates

However, the to_doc method doesn't support sending custom context variables to the templates, and I agree this is very necessary. I'll work on a PR to add it 🙂

wallee94 commented 3 years ago

Hi @PriyatamNayak I added the context arg to pass custom variables to the templates and updated the readme explaining the changes. This should let you add what you need.