diff --git a/GUI/package-lock.json b/GUI/package-lock.json index 078e19f60..d0e72656d 100644 --- a/GUI/package-lock.json +++ b/GUI/package-lock.json @@ -8,7 +8,7 @@ "name": "byk-training-module-gui", "version": "0.0.0", "dependencies": { - "@buerokratt-ria/common-gui-components": "^0.0.37", + "@buerokratt-ria/common-gui-components": "^0.0.42", "@buerokratt-ria/header": "^0.1.47", "@buerokratt-ria/menu": "^0.2.10", "@buerokratt-ria/styles": "^0.0.1", @@ -1821,9 +1821,9 @@ } }, "node_modules/@buerokratt-ria/common-gui-components": { - "version": "0.0.37", - "resolved": "https://registry.npmjs.org/@buerokratt-ria/common-gui-components/-/common-gui-components-0.0.37.tgz", - "integrity": "sha512-I8F/s+xflIH76mzbIzUVRH8MUgRifULQiEB7G7+Wre3lkWLncHGefUq9zyqfUU+SE/3Kmqgv4uMedOlu2/W7YQ==", + "version": "0.0.42", + "resolved": "https://registry.npmjs.org/@buerokratt-ria/common-gui-components/-/common-gui-components-0.0.42.tgz", + "integrity": "sha512-FOPZBhsbIw3Ii1wi21WzgyAWmaOi6X2/OFE4+bP46tRipe8bsuxK8ZSJ1V5tyWXh6HCCoU2ykXTpdEl9e546hQ==", "peerDependencies": { "@buerokratt-ria/header": "^0.1.20", "@fontsource/roboto": "^4.5.8", diff --git a/GUI/package.json b/GUI/package.json index 584010ddc..fff2df425 100644 --- a/GUI/package.json +++ b/GUI/package.json @@ -14,7 +14,7 @@ "@buerokratt-ria/header": "^0.1.47", "@buerokratt-ria/menu": "^0.2.10", "@buerokratt-ria/styles": "^0.0.1", - "@buerokratt-ria/common-gui-components": "^0.0.38", + "@buerokratt-ria/common-gui-components": "^0.0.42", "@fontsource/roboto": "^4.5.8", "@formkit/auto-animate": "^1.0.0-beta.5", "@radix-ui/react-accessible-icon": "^1.0.1", diff --git a/GUI/src/components/HistoricalChat/Markdownify.tsx b/GUI/src/components/HistoricalChat/Markdownify.tsx index 1ad46f1b1..9e23aaf3c 100644 --- a/GUI/src/components/HistoricalChat/Markdownify.tsx +++ b/GUI/src/components/HistoricalChat/Markdownify.tsx @@ -43,6 +43,12 @@ function formatMessage(message?: string): string { return filteredMessage .replaceAll(/&#x([0-9A-Fa-f]+);/g, (_, hex: string) => String.fromCharCode(parseInt(hex, 16))) + .replaceAll('&', '&') + .replaceAll('>', '>') + .replaceAll('<', '<') + .replaceAll('"', '"') + .replaceAll(''', "'") + .replaceAll(''', "'") .replaceAll(/(^|\n)(\d{4})\.\s/g, (match, prefix, year) => { const remainingText = filteredMessage.substring(filteredMessage.indexOf(match) + match.length); const sentenceEnd = remainingText.indexOf('\n\n'); @@ -54,7 +60,8 @@ function formatMessage(message?: string): string { } return `${prefix}${year}\\. `; }) - .replace(/(?<=\n)\d+\.\s/g, hasSpecialFormat(filteredMessage) ? '\n\n$&' : '$&'); + .replaceAll(/(?<=\n)\d+\.\s/g, hasSpecialFormat(filteredMessage) ? '\n\n$&' : '$&') + .replaceAll(/^(\s+)/g, (match) => match.replaceAll(' ', ' ')); } const Markdownify: React.FC = ({ message }) => (