Browse Source

use `ui.restructured_text` for reference sections

Falko Schindler 1 year ago
parent
commit
d2f6cede43
1 changed files with 2 additions and 6 deletions
  1. 2 6
      website/documentation/reference.py

+ 2 - 6
website/documentation/reference.py

@@ -98,13 +98,9 @@ def _generate_method_signature_description(method: Callable) -> str:
     return description
 
 
-def _render_docstring(doc: str, with_params: bool = True) -> ui.html:
+def _render_docstring(doc: str) -> ui.restructured_text:
     doc = _remove_indentation_from_docstring(doc)
-    doc = doc.replace('param ', '')
-    html = docutils.core.publish_parts(doc, writer_name='html5_polyglot')['html_body']
-    if not with_params:
-        html = re.sub(r'<dl class=".* simple">.*?</dl>', '', html, flags=re.DOTALL)
-    return ui.html(html).classes('bold-links arrow-links nicegui-markdown')
+    return ui.restructured_text(doc).classes('bold-links arrow-links rst-param-tables')
 
 
 def _remove_indentation_from_docstring(text: str) -> str: