Use plugin to embed py doc string with markdown into documentation. Znai uses Pandas style doc string to parse description and parameters. Note: Plugin ignores parameters block and only includes the description text. Check next section to see how to include parameters include-python-doc my_var = "a variable" def my_func(p1, p2): """ text inside my *func* doc * list one * list two Parameters ---------- p1: String parameter one description p2: String parameter two description """ return 2 + 2 class Animal: """ animal top level class doc string ``` code block ``` """ def says(self): """ animal **talks** `code` """ print("hello") :include-python-doc: python/example.py {entry: "my_func"} text inside my *func* doc * list one * list two :include-python-doc: python/example.py {entry: "Animal"} animal top level class doc string ``` code block ``` :include-python-doc: python/example.py {entry: "Animal.says"} animal **talks** `code`
Use plugin to render parameters extracted from pydoc text Note: read more about API parameters for additional properties include-python-doc-params def my_func(label, price): """ text inside my *func* doc * list one * list two Parameters ---------- label : str label to use to *render* item in the store price : fin.money.Money price associated with the **item** Returns ------- str status of the operation `OK` for good """ return "OK" :include-python-doc-params: python/pydoc-params.py {entry: "my_func", title: "result and parameters"} text inside my *func* doc * list one * list two Parameters ---------- label : str label to use to *render* item in the store price : fin.money.Money price associated with the **item** Returns ------- str status of the operation `OK` for good
If you define Type Hints, you can omit types from PyDoc text and Znai will take the types from the signature import fin def my_func(label: str, price: fin.money.Money) -> str: """ text inside my *func* doc * list one * list two Parameters -------------- label : label to use to *render* item in the store price : price associated with the **item** Returns ------- status of the operation `OK` for good """ return "OK" :include-python-doc-params: python/pydoc-params-type-hints.py {entry: "my_func", title: "result and parameters"} text inside my *func* doc * list one * list two Parameters -------------- label : label to use to *render* item in the store price : price associated with the **item** Returns ------- status of the operation `OK` for good