Skip to content

modules

Classes

RenderMarkdown

Bases: KiaraModule

Source code in /opt/hostedtoolcache/Python/3.11.4/x64/lib/python3.11/site-packages/kiara_plugin/html/modules/__init__.py
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
class RenderMarkdown(KiaraModule):

    _module_type_name = "render.markdown.to.html"

    def create_inputs_schema(
        self,
    ) -> ValueMapSchema:

        return {"markdown": {"type": "string", "doc": "The markdown string"}}

    def create_outputs_schema(
        self,
    ) -> ValueMapSchema:

        return {"html": {"type": "html", "doc": "The rendered html"}}

    def process(self, inputs: ValueMap, outputs: ValueMap):

        import markdown

        markdown_string = inputs.get_value_data("markdown")
        html = markdown.markdown(markdown_string)

        outputs.set_value("html", html)

Functions

create_inputs_schema() -> ValueMapSchema
Source code in /opt/hostedtoolcache/Python/3.11.4/x64/lib/python3.11/site-packages/kiara_plugin/html/modules/__init__.py
14
15
16
17
18
def create_inputs_schema(
    self,
) -> ValueMapSchema:

    return {"markdown": {"type": "string", "doc": "The markdown string"}}
create_outputs_schema() -> ValueMapSchema
Source code in /opt/hostedtoolcache/Python/3.11.4/x64/lib/python3.11/site-packages/kiara_plugin/html/modules/__init__.py
20
21
22
23
24
def create_outputs_schema(
    self,
) -> ValueMapSchema:

    return {"html": {"type": "html", "doc": "The rendered html"}}
process(inputs: ValueMap, outputs: ValueMap)
Source code in /opt/hostedtoolcache/Python/3.11.4/x64/lib/python3.11/site-packages/kiara_plugin/html/modules/__init__.py
26
27
28
29
30
31
32
33
def process(self, inputs: ValueMap, outputs: ValueMap):

    import markdown

    markdown_string = inputs.get_value_data("markdown")
    html = markdown.markdown(markdown_string)

    outputs.set_value("html", html)

PrettyPrintWebModule

Bases: PrettyPrintModule

Source code in /opt/hostedtoolcache/Python/3.11.4/x64/lib/python3.11/site-packages/kiara_plugin/html/modules/__init__.py
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
class PrettyPrintWebModule(PrettyPrintModule):

    _module_type_name = "pretty_print.html"

    def pretty_print__table__as__html(
        self, value: Value, render_config: Dict[str, Any]
    ):

        max_rows = render_config.get(
            "max_no_rows", DEFAULT_PRETTY_PRINT_CONFIG["max_no_rows"]
        )
        max_row_height = render_config.get(
            "max_row_height", DEFAULT_PRETTY_PRINT_CONFIG["max_row_height"]
        )
        max_cell_length = render_config.get(
            "max_cell_length", DEFAULT_PRETTY_PRINT_CONFIG["max_cell_length"]
        )

        half_lines: Union[None, int] = None
        if max_rows:
            half_lines = int(max_rows / 2)

        atw = ArrowTabularWrap(value.data.arrow_table)
        result = atw.as_html(
            rows_head=half_lines,
            rows_tail=half_lines,
            max_row_height=max_row_height,
            max_cell_length=max_cell_length,
        )
        return result

Functions

pretty_print__table__as__html(value: Value, render_config: Dict[str, Any])
Source code in /opt/hostedtoolcache/Python/3.11.4/x64/lib/python3.11/site-packages/kiara_plugin/html/modules/__init__.py
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
def pretty_print__table__as__html(
    self, value: Value, render_config: Dict[str, Any]
):

    max_rows = render_config.get(
        "max_no_rows", DEFAULT_PRETTY_PRINT_CONFIG["max_no_rows"]
    )
    max_row_height = render_config.get(
        "max_row_height", DEFAULT_PRETTY_PRINT_CONFIG["max_row_height"]
    )
    max_cell_length = render_config.get(
        "max_cell_length", DEFAULT_PRETTY_PRINT_CONFIG["max_cell_length"]
    )

    half_lines: Union[None, int] = None
    if max_rows:
        half_lines = int(max_rows / 2)

    atw = ArrowTabularWrap(value.data.arrow_table)
    result = atw.as_html(
        rows_head=half_lines,
        rows_tail=half_lines,
        max_row_height=max_row_height,
        max_cell_length=max_cell_length,
    )
    return result