-
Notifications
You must be signed in to change notification settings - Fork 394
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 details triggers that contain markup #1736
Conversation
Code quotes in headers are no longer auto-linked by `simpleLinker`, both for UX and bugfix purposes. Before, any markup like code quotes would break a header as only the first child had its text extracted. Now the trigger uses the whole children value of the header it's made from.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
it's fine to keep it disabled, looks like no one likes it |
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.
@rogermparent looks great, thanks! please take a look at the comments and address them as it makes sense.
This is unrelated to the PR, but while we're ts-linting we may as well
Now it just runs off the first (filtered) child. If that child is a header, it's assumed the last item of the heading is an auto-link and removed. Currently, every `details` first child is a heading, and all headings have auto-links.
This is mostly as an example of this PR's fix working.
Even if the element is a string, the regex test will return false from a non-string property.
All the feedback has been addressed, check out a live example of this working on the preview! The behavior now throws if the |
@@ -7,34 +7,6 @@ | |||
alone does. | |||
*/ | |||
|
|||
async function createStaticGithubDataNode(api, fieldData = {}) { |
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.
is it unused now?
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.
Yeah, it gets picked up by lint-ts
.
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.
hmm ... why didn't it pick it up earlier?
Before, as pointed out here by @jorgeorpinel, any markup like code quotes would break a header as only the first child
had its text extracted. Now, the
Collapsible
uses the wholechildren
value of theheader it's made from as the
trigger
text, so anything that can go in a heading can go in adetails
trigger
.simpleLinker
is also changed to not apply to code quotes within headings, partially because of this and also because auto-links in headers feels like it clutters the UX a bit since the same contents will very likely be linked in the following paragraph. I can re-enable this behavior if we find it desirable.