10 lines
721 B
Python
10 lines
721 B
Python
from rich.console import Console
|
|
from rich.highlighter import RegexHighlighter
|
|
from rich.theme import Theme
|
|
|
|
class HTML4_Highlighter(RegexHighlighter):
|
|
"""Apply style to anything that looks like an email."""
|
|
|
|
base_style = "html_tags"
|
|
highlights = [r"(<\/?)(?i:(?<element>a(bbr|cronym|ddress|pplet|rea)?|b(ase(font)?|do|ig|lockquote|ody|r|utton)?|c(aption|enter|ite|(o(de|l(group)?)))|d(d|el|fn|i(r|v)|l|t)|em|f(ieldset|o(nt|rm)|rame(set)?)|h([1-6]|ead|r|tml)|i(frame|mg|n(put|s)|sindex)?|kbd|l(abel|egend|i(nk)?)|m(ap|e(nu|ta))|no(frames|script)|o(bject|l|pt(group|ion))|p(aram|re)?|q|s(amp|cript|elect|mall|pan|t(r(ike|ong)|yle)|u(b|p))|t(able|body|d|extarea|foot|h|itle|r|t)|u(l)?|var))(\s(?<attr>.+?))*>"]
|