euporie.core.convert.formats.ft

Contain functions which convert data to formatted text.

Functions

ansi_to_ft(datum[, cols, rows, fg, bg, ...])

Convert ANSI text to formatted text, lexing & formatting automatically.

detect_lexer([text, path, language])

Detect the pygments lexer for a file.

html_to_ft(datum[, cols, rows, fg, bg, extend])

Convert HTML to formatted text.

register(from_, to[, filter_, weight])

Add a converter to the centralized format conversion system.

strip_one_trailing_newline(ft)

Remove up to one trailing new-line character from formatted text.

to_formatted_text(value[, style, auto_convert])

Convert the given value (which can be formatted text) into a list of text fragments.

Classes

ANSI(value[, tab_size])

Convert ANSI text into formatted text, preserving all control sequences.

SimpleCache([maxsize])

Very simple cache that discards the oldest item when the cache size is exceeded.

partial

partial(func, *args, **keywords) - new function with partial application of the given arguments and keywords.

async euporie.core.convert.formats.ft.ansi_to_ft(datum: Datum, cols: int | None = None, rows: int | None = None, fg: str | None = None, bg: str | None = None, extend: bool = True, lex: bool = False) StyleAndTextTuples

Convert ANSI text to formatted text, lexing & formatting automatically.

async euporie.core.convert.formats.ft.html_to_ft(datum: Datum, cols: int | None = None, rows: int | None = None, fg: str | None = None, bg: str | None = None, extend: bool = True) StyleAndTextTuples

Convert HTML to formatted text.