ploomber / mkdocs-thebe

Apache License 2.0
0 stars 0 forks source link

allowing to activate/deactivate runnable examples #1

Open edublancas opened 6 months ago

edublancas commented 6 months ago

for more context on this, see: https://github.com/ploomber/ploomber.io/issues/164

we are going to deploy interactive docs for mirascope

This codebase works, but there is one feature we're missing: deactivating runnable examples. currently, when configuring this plugin, all pages will have runnable examples, but there might be cases where we want to deactivate them for specific pages.

I started doing the work, this is how I think we can achieve it: pages can set arbitrary values by editing the front matter: https://raw.githubusercontent.com/ploomber/mkdocs-thebe/main/sample-mkdocs-project/docs/index.md

---
runnable_examples: false
---

then, we can read those values in the main template: https://github.com/ploomber/mkdocs-thebe/blob/main/src/mkdocs_thebe/assets/main.html and use that to determine whether we activate examples or not.

currently, the logic to activate the examples is on a separate file: https://github.com/ploomber/mkdocs-thebe/blob/main/src/mkdocs_thebe/assets/mkdocs-thebe.js

the easiest option is to move the content from mkddocs-thebe.js into main.html

and remove the file from here: https://github.com/ploomber/mkdocs-thebe/blob/3f4f35d1dc1c10463644f42f0e24054b8659eb0b/src/mkdocs_thebe/plugin.py#L23

edublancas commented 6 months ago

@bryannho let's put this on hold