Closed ppwwyyxx closed 2 years ago
@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?
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).
https://github.com/ppoffice/hexo-theme-icarus/pull/1072 shows an example use case where users can benefit from this feature.
@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.
Thanks for the suggestion I think foldable
is a better idea. Updated the PR.
This allows users to customize the styles of foldable blocks.