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
mimetypecannot be resolved, thenfallback_mimetypewill be used. If that cannot be resolved (or isNone), then the pygmentsClassNotFoundexception will be raised.