Quellcode durchsuchen

Merge pull request #2592 from zauberzeug/change-markdown-content

Add demo on how to change markdown content
Falko Schindler vor 1 Jahr
Ursprung
Commit
d78331391a
1 geänderte Dateien mit 8 neuen und 0 gelöschten Zeilen
  1. 8 0
      website/documentation/content/markdown_documentation.py

+ 8 - 0
website/documentation/content/markdown_documentation.py

@@ -55,4 +55,12 @@ def markdown_tables():
     ''', extras=['tables'])
 
 
+@doc.demo('Change Markdown content', '''
+    You can change the content of a Markdown element by setting its `content` property or calling `set_content`.
+''')
+def markdown_new_content():
+    markdown = ui.markdown('Sample content')
+    ui.button('Change Content', on_click=lambda: markdown.set_content('This is new content'))
+
+
 doc.reference(ui.markdown)