iiif-prezi / iiif-prezi3

IIIF Presentation API 3 Python Library
https://iiif-prezi.github.io/iiif-prezi3/
Apache License 2.0
28 stars 14 forks source link

Embed cookbook .py files in mkdocs #138

Closed giacomomarchioro closed 1 year ago

giacomomarchioro commented 1 year ago

This should ease the process of reusing cookbook recipes.

We write the recipe in .py file and then we embed it using mkdocs-material extension snippets: https://squidfunk.github.io/mkdocs-material/reference/code-blocks/#embedding-external-files

Shall we keep the examples in the doc folder or create an examples folder at the root of the project?

I use this approach: https://github.com/giacomomarchioro/pyIIIFpres/blob/8486e0cb7d870788c23de5cf2da105bc602b0604/tests/integration/tests.py#L168

But maybe Mike can come up with something more clever.

digitaldogsbody commented 1 year ago

Had the chance to look at this today - looks great. I have updated all the existing recipes accordingly: https://github.com/iiif-prezi/iiif-prezi3/pull/149

I made a small change in omitting the title of the included snippet, since I don't think it adds anything to the docs (unless there is a way to make the snippet plugin also provide a "download this file" button, in which case it could be useful).

I also decided to keep all the scripts in their own folder, so that they don't get too clogged up with the markdown files, and because there can be more than one script per recipe e.g in the cases of either multiple methods to create the recipe with iiif_prezi3 (as in https://github.com/iiif-prezi/iiif-prezi3/blob/3e251bea35477214f746d5d3f7aa7786b2e4c5f8/docs/recipes/0001-mvm-image.md), or multiple examples/use cases in the recipe (as in https://iiif.io/api/cookbook/recipe/0011-book-3-behavior/).

I will crib from your existing work in pyIIIFpres to build a test script - thanks for the pointer :)

glenrobson commented 1 year ago

Discussed in call once we merge #138 this would need to be updated from Main as this contains a new recipe that isn't in the other one.

digitaldogsbody commented 1 year ago

This work is re-done in #165 using the new style