squidfunk / mkdocs-material

Documentation that simply works
https://squidfunk.github.io/mkdocs-material/
MIT License
20.28k stars 3.48k forks source link

Interactive Examples #7419

Closed DanielHabenicht closed 1 month ago

DanielHabenicht commented 1 month ago

Context

I learned about webcontainers and wanted to integrate them into my existing mkdocs documentation to provide users with interactive examples, which can be changed by them. Unfortunately, there are no extensions for it yet. But I also saw PyScript which does the same for Python.

Description

Make the Documentation more interactive, e.g.:

For now this would probably be limited to node and python examples, but I am sure more web assembly versions of languages will follow.

Related links

Use Cases

As the Documentation Author, I can more easily create hands-on examples of how to work with what I am documenting.

As a user I don't need to install something locally to give it a try, there are fewer barriers.

Visuals

Extra Button for opening the example interactively (but not in the 3rd party service but on your own docs site): image Or even better if the output would be side-by-side with the example.

Before submitting

squidfunk commented 1 month ago

Thanks for the suggestion! There are already some similar solutions like Markdown Exec, albeit they might (?) not be interactive (tagging @pawamoy for visibility) – maybe it's worth exploring them ☺️ This, currently, goes beyond the scope of Material for MkDocs, as we're focusing on the rendered output, and interactivity is left to third-party integrations, but we may reconsider in the future.

Moving this into discussions for further input by other users.

pawamoy commented 1 month ago

We do support interactive Python code blocks, thanks to Pyodide. Definitely open to adding support for more languages 🙂