Using MarkdownSnippets to generate the example in README. The way it works is by having comments on tests (which usually are run in CI, guaranteeing they will work and not get outdated) and a placeholder comment on the README file that identifies where the snippet of code will be.
An example of it being used in another repository can be found here.
I'm including a workflow that runs on all push on the master branch, keeping it updated even if the test changes.
If you like this idea, I can move other examples to tests, which will allow the reuse of the code in the README file too :)
Using MarkdownSnippets to generate the example in README. The way it works is by having comments on tests (which usually are run in CI, guaranteeing they will work and not get outdated) and a placeholder comment on the README file that identifies where the snippet of code will be. An example of it being used in another repository can be found here.
I'm including a workflow that runs on all push on the master branch, keeping it updated even if the test changes.
If you like this idea, I can move other examples to tests, which will allow the reuse of the code in the README file too :)