-
Notifications
You must be signed in to change notification settings - Fork 19
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
DAH-1865 Handle Apostrophe Character Entity from Salesforce free text fields #2039
DAH-1865 Handle Apostrophe Character Entity from Salesforce free text fields #2039
Conversation
@@ -164,14 +164,18 @@ export const getSfGovUrl = (enLink: string, node?: number, path?: string) => { | |||
*/ | |||
export function renderMarkup(translatedString: string, allowedTags?: string) { |
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.
I grepped for the regex renderMarkup\([^t]
and found that this function is used for free text fields in some places.
@@ -164,14 +164,18 @@ export const getSfGovUrl = (enLink: string, node?: number, path?: string) => { | |||
*/ | |||
export function renderMarkup(translatedString: string, allowedTags?: string) { | |||
return ( | |||
<Markdown options={{ forceBlock: true }}> | |||
<Markdown options={{ forceBlock: true, namedCodesToUnicode: { "#39": "\u0027" } }}> | |||
{stripMostTags(translatedString, allowedTags)} | |||
</Markdown> | |||
) | |||
} | |||
|
|||
export function renderInlineMarkup(translatedString: string, allowedTags?: string) { |
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.
I grepped for the regex renderInlineMarkup\([^t]
and found that this function is used for free text fields in some places.
0e65082
to
fee11a9
Compare
@@ -25,7 +25,7 @@ | |||
"cssnano": "^6.0.1", | |||
"dayjs": "^1.10.7", | |||
"dotenv": "2.0.0", | |||
"markdown-to-jsx": "7.1.8", | |||
"markdown-to-jsx": "7.3.2", |
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.
Updated the library because the older version had a bug related to the namedCodesToUnicode
option.
The failing e2e test is the machine translation one, it's not related to the changes made here, and can be safely ignored. |
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.
One question but LGTM
@@ -89,7 +89,9 @@ export const getEventNote = (listingEvent: ListingEvent) => { | |||
<div className="flex flex-col"> | |||
{listingEvent.Venue && ( | |||
<span className="links-space translate"> | |||
<Markdown>{listingEvent.Venue}</Markdown> | |||
<Markdown options={{ namedCodesToUnicode: { "#39": "\u0027" } }}> |
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.
non-blocking: Curious at to why this does not use the renderMarkup
function defined below?
question: Should this options object, and the ones below, be extracted into some consts file so that we have better consistency?
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.
Curious at to why this does not use the renderMarkup function defined below?
I think it should, I've made an update to do that.
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 this options object, and the ones below, be extracted into some consts file so that we have better consistency?
I think we're okay for now, as long as we keep using the renderMarkup
functions instead of <Markdown>
directly. We may want to revisit this if we need to pass more options to <Markdown>
.
https://sfgovdt.jira.com/browse/DAH-1865
Docs explaining the markdown-to-jsx option: https://github.com/quantizor/markdown-to-jsx?tab=readme-ov-file#optionsnamedcodestounicode