almanac.style
¶
-
highlight_for_mimetype
(text: str, mimetype: str, *, fallback_mimetype: Optional[str] = 'text/plain', formatter_cls: Type[pygments.formatter.Formatter] = <class 'pygments.formatters.terminal.TerminalFormatter'>) → str[source]¶ Return ANSI-escaped highlighted text, as per the .
If
mimetype
cannot be resolved, thenfallback_mimetype
will be used. If that cannot be resolved (or isNone
), then the pygmentsClassNotFound
exception will be raised.