-
Notifications
You must be signed in to change notification settings - Fork 34
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(atomic, quantic): broken HTML because of formatting in CRGA markdown heading #4553
Conversation
@coveo/[email protected] @coveo/[email protected] @coveo/[email protected] @coveo/[email protected] @coveo/[email protected] @coveo/[email protected] @coveo/[email protected] **/CHANGELOG.md **/package.json CHANGELOG.md package.json package-lock.json
Pull Request ReportPR Title✅ Title follows the conventional commit spec. Live demo linksBundle Size
SSR Progress
Detailed logssearch : buildInteractiveResultsearch : buildInteractiveInstantResult search : buildInteractiveRecentResult search : buildInteractiveCitation search : buildGeneratedAnswer recommendation : missing SSR support product-recommendation : missing SSR support product-listing : missing SSR support case-assist : missing SSR support insight : missing SSR support commerce : missing SSR support |
); | ||
}); | ||
|
||
it('should transform heading with nested formatting', () => { |
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.
should we also have this test for nested formatting in the quantic tests?
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.
Considering the test suite was simplified for Quantic, I went with a single test to cover the change. I don't think adding another test for nested formatting is necessary.
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.
Hi, because of the incident that occured last thursday/friday with the v2 release. It wrongfully updated the versions of all package.json in the ui-kit publish
commit. We removed that commit after this PR pulled it. Can you revert those changes ?
Creating a clean PR with the TIP of |
SVCC-4245
A CRGA model generally generates markdown headings like this:
However, in some cases, it can generate headings this way:
When it does, the HTML returned by the
generated-answer
component is broken and the heading reads like this:The core of the issue is in the custom Marked renderer. When the heading has formatting, the
text
parameter contains the HTML rendering of the heading content. Inserting non-escaped HTML into thearia-label
attribute then breaks thediv
element.This PR fixes the issue by affecting only the heading text content to the
aria-label
attribute. To do so, the HTML elements are removed from the heading content when settingaria-label
. The heading content HTML is kept intact when setting the heading inner HTML though in order to keep the heading formatting.For example:
Would generate this HTML