Skip to content

Commit

Permalink
feat(pygments): remove line-height (#86)
Browse files Browse the repository at this point in the history
  • Loading branch information
backwardspy authored Oct 11, 2024
1 parent c3a3fdf commit 368c755
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions scripts/build-gh-pages
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,17 @@ 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)
path.write_text(content)


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
Expand All @@ -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
Expand Down

0 comments on commit 368c755

Please sign in to comment.