utilities.nbdev

Extra functionality for nbdev

Based on nbdev DocmentTbl.


MarkdownTable


def MarkdownTable(
    data, headers
):

Initialize self. See help(type(self)) for accurate signature.


DictTbl


def DictTbl(
    obj
):

Initialize self. See help(type(self)) for accurate signature.

def _test_dict(): 
    return {
        'foo': [1, 2], # First item description
        'bar': [3, 4], # Item description No. 2
        'baz': [5, 6], # The last description
    }
DictTbl(_test_dict)
Description
foo First item description
bar Item description No. 2
baz The last description
str(DictTbl(_test_dict))
'|   | **Description** |\n| - | --------------- |\n| foo | First item description |\n| bar | Item description No. 2 |\n| baz | The last description |'

AttributeTbl


def AttributeTbl(
    obj
):

Initialize self. See help(type(self)) for accurate signature.

class _test_class:
    """A test class for the AttributeTbl class."""
    
    class_variable = 'foo'
    
    def __init__(
        self, 
        bar:str, # bar parameter
        baz # baz parameter
    ):
        a = 3
        self.b = 4 # An attribute
        self.bing = 5 # Another attribute
        c = 6
AttributeTbl(_test_class)
Attribute Description
b An attribute
bing Another attribute
str(AttributeTbl(_test_class))
'| **Attribute** | **Description** |\n| ------------- | --------------- |\n| b | An attribute |\n| bing | Another attribute |'