Falko Schindler 2 rokov pred
rodič
commit
c661c46950
2 zmenil súbory, kde vykonal 14 pridanie a 0 odobranie
  1. 6 0
      nicegui/elements/mermaid.py
  2. 8 0
      website/reference.py

+ 6 - 0
nicegui/elements/mermaid.py

@@ -7,6 +7,12 @@ register_component('mermaid', __file__, 'mermaid.js', ['lib/mermaid.min.js'])
 class Mermaid(ContentElement):
 
     def __init__(self, content: str) -> None:
+        '''Mermaid Diagrams
+
+        Renders diagrams and charts written in the Markdown-inspired `Mermaid <https://mermaid.js.org/>`_ language.
+
+        :param content: the Mermaid content to be displayed
+        '''
         super().__init__(tag='mermaid', content=content)
 
     def on_content_change(self, content: str) -> None:

+ 8 - 0
website/reference.py

@@ -168,6 +168,14 @@ def create_full() -> None:
     def markdown_example():
         ui.markdown('''This is **Markdown**.''')
 
+    @example(ui.mermaid)
+    def mermaid_example():
+        ui.mermaid('''
+        graph LR;
+            A --> B;
+            A --> C;
+        ''')
+
     @example(ui.html)
     def html_example():
         ui.html('This is <strong>HTML</strong>.')