docs.cell_docs

render_cell_doc

render_cell_doc(cell_code, title_level)

Takes a cell code, extracts all top-level function and class definitions,

and returns formatted Markdown documentation for each.


print(render_cell_doc(code_str))
## foo

```python
foo(a: int, b: Union[str, None], c, *args, **kwargs) -> str
```

Processes input.

**Arguments:**
- `a` (*int*): The first number.
- `b` (*Union[str, None]*): Optional label.
- `c`: Unannotated parameter.

**Returns:** *bool*: True if processed correctly.

---


## bar

```python
bar()
```

A docstring

---


## baz *(async)*

```python
baz()
```

---


## MyClass

*Inherits from*: `BaseClass1, BaseClass2`

---

<h3>Methods</h3>

#### __init__

```python
__init__(self, a: int, b: str, c)
```

Constructs a new instance of MyClass.

**Arguments:**
- `a` (*int*): The first number.
- `b` (*str*): The second number.
- `c`: Unannotated parameter.

---

#### baz

```python
baz(self, d: float, e: bool)
```

---

#### async_method *(async)*

```python
async_method(self, f: float, g: bool)
```

---

show_doc

show_doc(obj, title_level)

def foo(a, b, c:str, *args, **kwargs):
    "A docstring"
    pass

show_doc(foo).data
'## foo\n\n```python\nfoo(a, b, c: str, *args, **kwargs)\n```\n\nA docstring\n\n---\n'
class FooClass:
    def __init__(self, a, b, c:str):
        "A docstring"
        pass

show_doc(FooClass).data
'## FooClass\n\n---\n\n<h3>Methods</h3>\n\n#### __init__\n\n```python\n__init__(self, a, b, c: str)\n```\n\nA docstring\n\n---\n'