Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add foldable css class for codeblocks #1071

Merged
merged 2 commits into from
May 8, 2022
Merged

Conversation

ppwwyyxx
Copy link
Contributor

@ppwwyyxx ppwwyyxx commented May 7, 2022

This allows users to customize the styles of foldable blocks.

2022-05-07_15-26

This allows users to customize the styles of folded/unfolded blocks.
@ppoffice
Copy link
Owner

ppoffice commented May 7, 2022

@ppwwyyxx What can a user gain from adding the unfolded class? Can't the current folded class fulfill custom styling of folded and unfolded code blocks?

@ppwwyyxx
Copy link
Contributor Author

ppwwyyxx commented May 7, 2022

The existing behavior:
(1). For posts with config.article.fold = "", the class is neither "folded", nor "unfolded".
(2). For posts with config.article.fold != "", the class is "folded" when the code is folded.
(3). For posts with config.article.fold != "", the class is neither "folded" nor "unfolded", when the code is unfolded.

This means users cannot distinguish (1): code that cannot be folded and (3): code that is unfolded but can be folded in their CSS. I'd like to distinguish the two in my CSS.

After this change, (3) will have the class "unfolded" so users can distinguish (1) and (3).

#1072 shows an example use case where users can benefit from this feature.

@ppoffice
Copy link
Owner

ppoffice commented May 7, 2022

@ppwwyyxx How about adding a classname foldable to all code blocks if config.article.fold != ""? All folded blocks will have .foldable .folded in its classname and unfolded blocks will only have .foldable? Also, in this way you have one less classname to style.

@ppwwyyxx
Copy link
Contributor Author

ppwwyyxx commented May 7, 2022

Thanks for the suggestion I think foldable is a better idea. Updated the PR.

@ppwwyyxx ppwwyyxx changed the title Add folded/unfolded css class for codeblocks Add foldable css class for codeblocks May 7, 2022
@ppoffice ppoffice merged commit e8eef01 into ppoffice:master May 8, 2022
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.

2 participants