Skip to content

Use hierarchical CSS styles in exported HTML#190

Closed
aryanjsingh wants to merge 1 commit intofrescobaldi:masterfrom
aryanjsingh:fix/issue-44-shouldnt-exported-css-use-hierarchical-s
Closed

Use hierarchical CSS styles in exported HTML#190
aryanjsingh wants to merge 1 commit intofrescobaldi:masterfrom
aryanjsingh:fix/issue-44-shouldnt-exported-css-use-hierarchical-s

Conversation

@aryanjsingh
Copy link
Copy Markdown

Summary

This change modifies the CSS generation for HTML export to use hierarchical styles. Instead of flat class names like .comment, styles are now nested under a parent selector (e.g., #document .comment), preventing potential conflicts with other CSS on a webpage.

Changes

  • ly/colorize.py: Modified format_stylesheet to accept a parent_selector argument and prepend it to generated CSS selectors. Updated HtmlWriter.html to pass the appropriate parent selector to format_stylesheet, ensuring that generated CSS styles are hierarchical and scoped to the document container.

Related Issue

Closes #44

@aryanjsingh aryanjsingh closed this Apr 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Shouldn't exported CSS use hierarchical styles?

1 participant