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, then fallback_mimetype will be used. If that cannot be resolved (or is None), then the pygments ClassNotFound exception will be raised.