cosapp.tools.views.markdown

Mardown viewers for Module and Port.

Functions

port_to_md(port)

Returns the representation of port in Markdown format.

system_to_md(system)

Returns the representation of system in Markdown format.

upper_first(s)

Return a copy of the input string, with the first character in upper case.

with_final_dot(s)

Return a copy of the input string, ensuring it ends with a dot.

Classes

PortMarkdownFormatter(port)

Markdown table formatter for ports

class cosapp.tools.views.markdown.PortMarkdownFormatter(port: BasePort)[source]

Bases: object

Markdown table formatter for ports

content(contextual=True) list[str][source]

Returns the port representation in Markdown format, as a list of strings.

Parameters:

contextual (bool) – If True (default), uses port full name; if False, displays only port name.

Returns:

list of Markdown strings representing port variables as a table, with header.

Return type:

list[str]

classmethod div_header() str[source]

Div header used to override Jupyter Lab table CSS

markdown(contextual=True) str[source]

Returns the port representation in Markdown format.

Parameters:

contextual (bool) – If True (default), uses port full name; if False, displays only port name.

Returns:

Markdown formatted representation

Return type:

str

var_repr() list[str][source]

Returns the representation of port variables in Markdown format, as a list of strings (same as content, without name header).

Returns:

list of Markdown strings representing port variables as a table.

Return type:

list[str]

classmethod wrap(content: str | list[str]) list[str][source]
cosapp.tools.views.markdown.port_to_md(port: BasePort) str[source]

Returns the representation of port in Markdown format.

Parameters:

port (BasePort) – Port to describe

Returns:

Markdown formatted representation

Return type:

str

cosapp.tools.views.markdown.system_to_md(system: System) str[source]

Returns the representation of system in Markdown format.

Parameters:

system (System) – System to describe

Returns:

Markdown formatted representation

Return type:

str

cosapp.tools.views.markdown.upper_first(s: str) str[source]

Return a copy of the input string, with the first character in upper case.

cosapp.tools.views.markdown.with_final_dot(s: str) str[source]

Return a copy of the input string, ensuring it ends with a dot.