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
Fix external styles and script not hoisted #2414
Conversation
Co-authored-by: Chan Yu Cheng <77204346+yucheng11122017@users.noreply.github.com>
Update Documentation on Markdown in Presentation Components
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #2414 +/- ##
=======================================
Coverage 48.92% 48.92%
=======================================
Files 124 124
Lines 5245 5245
Branches 1110 1110
=======================================
Hits 2566 2566
+ Misses 2372 2371 -1
- Partials 307 308 +1 ☔ View full report in Codecov by Sentry. |
220cde2
to
a265c73
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just a preliminary look - do update this PR so that it can pass the checks!
Hi @yiwen101 could you also add functional test cases? You can add it to test_site :) |
Definitely. Thank you for pointing out to this. |
@kaixin-hc @yucheng11122017 @itsyme I think all in all looks okay to me from my testing. It seems that the style and script is hosited for Externals correctly. Feel free to chime in as I may have missed something!
|
Thanks for the comment; yes this is a very valid concern. How do you find the idea of adding a new attribute to allow the user to choose whether to hoist the css and script? Cause I feel a documentation warning is best when complemented with feature that providing user with more options. If you approve the idea, I will open a separate issue and work on adding the attribute in addition to documentation fix. Meanwhile, s commented in #2300, probably worth opening a new issue on "finding a more proper fix that retains the script element placement instead of hoisting it downward." as well? |
@yiwen101
For CSS wise, it is global because the styling is not unique to the element. For script wise, I am not super sure whether it matters whether element placment matters (I do see that maybe we want the script to trigger when the element is shown but I do not think that this is trivial to implement). |
I see; Regarding the usefulness of the attribute, if I am correct in my understanding, without this attribute, I will need to mention in documentation that: Point 2 does not look graceful. By adding a new attribute (not sure how long will take me though), we can replace point 2 with "If do not want this, add |
@yiwen101
|
@yiwen101 yep, just make this documentation change (you can also suggest that in the styles of the includes they could specifically target a class name that's not used globlly) and i think this PR is ready to go! |
I have updated the documentation required. Thank you for all your helps and comments throughout the process. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Minor nits on the documentation - but let me leave my approval here first : )
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! Thank you for all the changes.
@EltonGohJH you ok with this PR? If yes I think it can be merged!
Should it be considered a breaking change?
@yucheng11122017 |
OK sure sounds good! I was more concerned abt the global effect of script and css that was discussed here that made it sound like a breaking change but yeah I think bug fix sounds more appropriate. |
@all-contributors add @yiwen101 for code |
I've put up a pull request to add @yiwen101! 🎉 |
What is the purpose of this pull request?
Resolve issue: #2300
Overview of changes:
Widen the scope of styles and script hoisting to include external and external manager.
Anything you'd like to highlight/discuss:
Testing instructions:
Init a markbind sample project.
In contents/topic1.md, add:
In index.md, add
You should see the following.The styles in the contents/topic1.md is applied to the content in the panel successfully.
Proposed commit message: (wrap lines at 72 characters)
Hoist external's styles and script
Also add warning in documentation that styles in hoisted
external will also affect the rest of the page
Checklist: ☑️
Reviewer checklist:
Indicate the SEMVER impact of the PR:
At the end of the review, please label the PR with the appropriate label:
r.Major
,r.Minor
,r.Patch
.Breaking change release note preparation (if applicable):