feat(pygments): remove line-height (#86)

This commit is contained in:
backwardspy 2024-10-11 23:15:08 +01:00 committed by GitHub
parent c3a3fdf69b
commit 368c7552db
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -22,6 +22,8 @@ PYGMENTS_STYLES = {
PALETTE.mocha.identifier: MochaStyle,
}
BANNED_DECLARATIONS = {"padding", "line-height"}
def write(content: str, path: Path) -> None:
path.parent.mkdir(parents=True, exist_ok=True)
@ -29,7 +31,8 @@ def write(content: str, path: Path) -> None:
def postprocess_css(content: str, important: bool) -> str:
rules = tinycss2.parse_stylesheet(content, skip_comments=True, skip_whitespace=True)
rules = tinycss2.parse_stylesheet(
content, skip_comments=True, skip_whitespace=True)
for rule in rules:
declarations = tinycss2.parse_declaration_list(
rule.content, skip_comments=True, skip_whitespace=True
@ -39,7 +42,7 @@ def postprocess_css(content: str, important: bool) -> str:
declarations = [
declaration
for declaration in declarations
if "padding" not in declaration.lower_name
if all(decl not in declaration.lower_name for decl in BANNED_DECLARATIONS)
]
# add !important if needed