-
-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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: Removed extra double quotes from computed style in shiki code component #8035
Conversation
🦋 Changeset detectedLatest commit: d4e9f16 The changes in this PR will be included in the next version bump. Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
Not sure what that CI error means |
In what case does this create malformed HTML? Can you post an example? |
I would say in all cases, but I guess technically if you pass null to the wrap prop then it wouldn't cause malformed html. Not sure the purpose of wrap == null.
These should all add an extra double quote in html. But I guess the following would lead to valid html:
The code surrounding adding extra styling depending on the wrap prop value adds a double quote at the end of the appended style string. Then in the return statement, the style string variable is inserted between two double quotes. So if wrap != null, then there is always an extra double quote at the end of the style attribute. If you check out the commit, the It's pretty obvious there is an erroneous double quote at the end of those two lines. I was looking at the outputted html when I discovered the issue then backtracked it to the code fixed by this commit. |
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.
Looks like a simple fix to me. Thanks for catching this!
No problem. This might be my first non-documentation open source contribution :D Glad to help improve Astro in my small way. It's a great project. |
Changes
Removed an invalid extra double quote that is added to the shiki wrapper component called Code.
Testing
Sorry, I don't have the time to learn how to properly create unit tests for this within your ecosystem. Sorry if this is unacceptable. The test I would add I guess would be whether the style attribute is properly formed without the extra double quote. I am not sure how to do that.
Docs
I would assume no document changes should be needed for this. It currently creates malformed html, but at least Chrome still renders properly even with the malformed HTML. This should not affect the functionality other than possibly make stricter browsers (if they exist) work properly.