@@ -20,7 +20,10 @@ import { UnfoldableCard as UnfoldableCard2 } from "../../components/UnfoldableCa
20
20
import { parseOperatingSystem } from "../../hook/helpers/getOperatingSystem" ;
21
21
import { I18N_CONTENT_SERVICE_NS_PREFIX } from "../../i18n" ;
22
22
import { DOWNLOAD_OPTIONS_SERVICE } from "./ContentService" ;
23
- import { isArray } from "./helpers/isArray" ;
23
+ import {
24
+ isArray ,
25
+ isArrayOf ,
26
+ } from "./helpers/isArray" ;
24
27
import { isString } from "./helpers/isString" ;
25
28
import { RendererContext } from "./RendererContextImpl" ;
26
29
import { isBaseContent } from "./types/BaseContent" ;
@@ -35,7 +38,9 @@ import {
35
38
} from "./types/CardContent" ;
36
39
import { isComponentContent } from "./types/ComponentContent" ;
37
40
import { Content } from "./types/Content" ;
38
- import { ContentType } from "./types/ContentType" ;
41
+ import {
42
+ ContentType ,
43
+ } from "./types/ContentType" ;
39
44
import { isDropdownOsSelectorContent } from "./types/DropdownOsSelectorContent" ;
40
45
import { isFoldableCardContent } from "./types/FoldableCardContent" ;
41
46
import {
@@ -224,6 +229,8 @@ export class ProductContentRenderer {
224
229
h3 : < h3 /> ,
225
230
h4 : < h4 /> ,
226
231
h5 : < h5 /> ,
232
+ code : < code /> ,
233
+ pre : < pre /> ,
227
234
h6 : < h6 /> ,
228
235
a : < a /> ,
229
236
span : < span /> ,
@@ -470,6 +477,23 @@ export class ProductContentRenderer {
470
477
}
471
478
472
479
if ( content ?. type === ContentType . CODE ) {
480
+ const body = content . body ;
481
+ if ( isArrayOf < Content > ( body ) ) {
482
+ return (
483
+ < code className = { this . prepareClassName ( content . classes , context ) } >
484
+ { body . map ( ( item : Content ) : ReactNode => {
485
+ if ( isString ( item ) ) {
486
+ return < > { item } </ > ;
487
+ }
488
+ return < > { this . render ( item , context ) } </ > ;
489
+ } ) }
490
+ </ code >
491
+ )
492
+ }
493
+
494
+ if ( isString ( content ?. body ) ) {
495
+ return < code className = { this . prepareClassName ( content . classes , context ) } > { content ?. body } </ code >
496
+ }
473
497
return < code className = { this . prepareClassName ( content . classes , context ) } > { this . render ( content ?. body , context ) } </ code >
474
498
}
475
499
0 commit comments