Skip to content

pygment

highlight_json(text)

Highlight a json string.

Parameters:

Name Type Description Default
text str

The json string to highlight.

required

Returns:

Type Description
str

A colorized json string.

Source code in m/color/pygment.py
def highlight_json(text: str) -> str:
    """Highlight a json string.

    Args:
        text: The json string to highlight.

    Returns:
        A colorized json string.
    """
    return _highlight(text, JsonLexer())

highlight_yaml(text)

Highlight a yaml string.

Parameters:

Name Type Description Default
text str

The yaml string to highlight.

required

Returns:

Type Description
str

A colorized yaml string.

Source code in m/color/pygment.py
def highlight_yaml(text: str) -> str:
    """Highlight a yaml string.

    Args:
        text: The yaml string to highlight.

    Returns:
        A colorized yaml string.
    """
    return _highlight(text, YamlLexer())