My requirement is to support interactive widgets in the rendering of the document, so that readers can understand the program in a more user-friendly way. But I find that it seems that mkdocs-jupyter does not support rendering ipywidgets widgets.
My .ipynb file is like:
import asyncio
import ipywidgets as widgets
from IPython.display import display
terminal_input = widgets.HBox([
widgets.Label("Input your next command:"),
(command_input := widgets.Text(placeholder="Type command...")),
(command_button := widgets.Button(description="Submit"))
])
terminal_output = widgets.Textarea(
value='',
layout=widgets.Layout(
border='1px solid #888',
color="#eee",
width="100%",
style={'textarea': {'background-color': '#2c3e50', 'color': '#ecf0f1'}},
)
)
async def on_button_click(b):
command_str = command_input.value.strip()
command_input.value = ''
terminal_output.value += f"> {command_str}\n"
command_input.focus()
# command_button.on_click(lambda b: asyncio.create_task(on_button_click(b)))
display(
widgets.VBox([
terminal_input,
terminal_output,
])
)
My requirement is to support interactive widgets in the rendering of the document, so that readers can understand the program in a more user-friendly way. But I find that it seems that
mkdocs-jupyterdoes not support renderingipywidgetswidgets.My .ipynb file is like: