🐛 Stamp sd-card-text on direct paragraphs only, never replace classes#278
Merged
Conversation
39dda57 to
dc77a46
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #278 +/- ##
==========================================
+ Coverage 90.40% 90.42% +0.01%
==========================================
Files 13 13
Lines 1147 1149 +2
==========================================
+ Hits 1037 1039 +2
Misses 110 110
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
The dropdown HTML transform had an inverted conditional that replaced, rather than appended to, each body paragraph's classes, silently destroying user-authored classes. Both cards and dropdowns also stamped sd-card-text on every descendant paragraph via findall, applying card typography to content nested inside admonitions, lists and nested components (#40). Both sites now stamp direct child paragraphs only.
dc77a46 to
525cda2
Compare
19 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes two related bugs in how
sd-card-textis applied to paragraphs in cards and dropdowns.Changes
[] if "classes" in para else para["classes"]— always true for docutils elements) meant every paragraph in every dropdown body had its existing classes replaced by["sd-card-text"]. Any user class (e.g. viarst-classor MyST attrs) was silently destroyed. Now appends.CardDirective.add_card_child_classes: previously all descendant paragraphs (inside nested admonitions, lists, nested tab-sets, …) were stamped, causing the spacing artefacts in Multi-line content in dropdown has extra spacing on first line #40. Nested content now renders with its natural spacing, consistent with the same content outside a card.Verification
tests/test_card_text.py(rst + myst): user-class preservation, direct-vs-nested stamping forcard,dropdown, andgrid-item-card(the delegated path), and the Multi-line content in dropdown has extra spacing on first line #40 two-paragraph reproduction. The regression cases were verified failing against the unfixed code.sd-card-textparagraphs (which is why Multi-line content in dropdown has extra spacing on first line #40 went undetected)..sd-tab-content>:last-child{margin-bottom:0 !important}already forces the same margin either way.Closes #40