@@ -16,8 +16,8 @@ import {
1616 VaccinePageSection ,
1717 VaccinePageSubsection ,
1818} from "@src/services/content-api/types" ;
19+ import { fixupHtmlFragment } from "@src/utils/html" ;
1920import sanitiseHtml from "@src/utils/sanitise-html" ;
20- import { load as loadHtml } from "cheerio" ;
2121import { InsetText , WarningCallout } from "nhsuk-react-components" ;
2222import React , { JSX } from "react" ;
2323
@@ -179,11 +179,14 @@ function styleCallout(callout: HeadingWithTypedContent | undefined): StyledPageS
179179 component : < MarkdownWithStyling content = { callout . content } delineator = { false } /> ,
180180 } ;
181181 case "html" :
182- const $ = loadHtml ( callout . content , null , false ) ;
183- $ ( "a" ) . attr ( "target" , "_blank" ) ;
184182 return {
185183 heading : callout . heading ,
186- component : < div data-testid = "callout-html" dangerouslySetInnerHTML = { { __html : $ . html ( ) || "" } } /> ,
184+ component : (
185+ < div
186+ data-testid = "callout-html"
187+ dangerouslySetInnerHTML = { { __html : fixupHtmlFragment ( callout . content ) || "" } }
188+ />
189+ ) ,
187190 } ;
188191 case "string" :
189192 return {
@@ -215,26 +218,28 @@ const getStyledContentForVaccine = async (
215218 fragile : boolean ,
216219) : Promise < StyledVaccineContent > => {
217220 const overview : Overview | undefined = filteredContent . overview ;
221+ const callout : StyledPageSection | undefined = styleCallout ( filteredContent . callout ) ;
222+ const recommendation : StyledPageSection | undefined = styleRecommendation ( filteredContent . recommendation ) ;
223+ const overviewConclusion : Overview | undefined = filteredContent . overviewConclusion ;
218224 let whatVaccineIsFor ;
219225 if ( filteredContent . whatVaccineIsFor ) {
220226 whatVaccineIsFor = styleSection ( filteredContent . whatVaccineIsFor ) ;
221227 }
222228 const whoVaccineIsFor : StyledPageSection = styleSection ( filteredContent . whoVaccineIsFor ) ;
223229 const howToGetVaccine : StyledPageSection = styleHowToGetSection ( vaccine , filteredContent . howToGetVaccine , fragile ) ;
224230 const vaccineSideEffects : StyledPageSection = styleSection ( filteredContent . vaccineSideEffects ) ;
225- const callout : StyledPageSection | undefined = styleCallout ( filteredContent . callout ) ;
226- const recommendation : StyledPageSection | undefined = styleRecommendation ( filteredContent . recommendation ) ;
227231 const webpageLink : URL = filteredContent . webpageLink ;
228232
229233 return {
230234 overview,
235+ callout,
236+ recommendation,
237+ overviewConclusion,
231238 whatVaccineIsFor,
232239 whoVaccineIsFor,
233240 howToGetVaccine,
234241 vaccineSideEffects,
235242 webpageLink,
236- callout,
237- recommendation,
238243 } ;
239244} ;
240245
0 commit comments