From c56f80cc220a7567a9b94967b1dda0b6d8bd061a Mon Sep 17 00:00:00 2001 From: mpetrov Date: Tue, 24 Dec 2024 17:12:45 +0200 Subject: [PATCH] Usage of special HTML chars in mardown fix --- ui-ngx/src/app/shared/models/js-function.models.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/ui-ngx/src/app/shared/models/js-function.models.ts b/ui-ngx/src/app/shared/models/js-function.models.ts index 5bfa50de6f..c4b38777c2 100644 --- a/ui-ngx/src/app/shared/models/js-function.models.ts +++ b/ui-ngx/src/app/shared/models/js-function.models.ts @@ -98,7 +98,7 @@ export const loadModuleMarkdownDescription = (http: HttpClient, translate: Trans } else { propDescription += `

const ${propName}: ${type}`; if (type !== 'object') { - propDescription += ` = ${prop}`; + propDescription += ` = ${type === 'string' ? handleHtmlSpecialChars(prop) : prop}`; } propDescription += '

'; } @@ -133,6 +133,10 @@ export const loadModuleMarkdownDescription = (http: HttpClient, translate: Trans ); } +const handleHtmlSpecialChars = (text: string): string => { + return text.replace(/&/g, '&').replace(//g, '>'); +} + export const loadModuleMarkdownSourceCode = (http: HttpClient, translate: TranslateService, resource: ResourceInfo): Observable => { let sourceCode = `
${resource.title}
${translate.instant('js-func.source-code')}
\n\n`; return loadFunctionModuleSource(http, resource.link).pipe(