From 7b53a4b316c74b16299b6c57cc6d92fdb111dbf4 Mon Sep 17 00:00:00 2001 From: shamoon <4887959+shamoon@users.noreply.github.com> Date: Mon, 19 Oct 2026 18:52:28 -0700 Subject: [PATCH] Enhancement: support markdown in AI chat (#14409) --- src-ui/jest.config.js | 2 +- src-ui/package.json | 1 + src-ui/pnpm-lock.yaml | 10 +++ .../components/chat/chat/chat.component.html | 10 ++- .../components/chat/chat/chat.component.scss | 20 ++++- .../chat/chat/chat.component.spec.ts | 29 ++++++ .../components/chat/chat/chat.component.ts | 2 + src-ui/src/app/pipes/markdown.pipe.spec.ts | 90 +++++++++++++++++++ src-ui/src/app/pipes/markdown.pipe.ts | 52 +++++++++++ 9 files changed, 207 insertions(+), 9 deletions(-) create mode 100644 src-ui/src/app/pipes/markdown.pipe.spec.ts create mode 100644 src-ui/src/app/pipes/markdown.pipe.ts diff --git a/src-ui/jest.config.js b/src-ui/jest.config.js index 8a15eeebe..89a334130 100644 --- a/src-ui/jest.config.js +++ b/src-ui/jest.config.js @@ -28,7 +28,7 @@ module.exports = { 'abstract-paperless-service', ], transformIgnorePatterns: [ - 'node_modules/(?!.*(\\.mjs$|tslib|lodash-es|normalize-diacritics|@angular/common/locales/.*\\.js$))', + 'node_modules/(?!.*(\\.mjs$|tslib|lodash-es|normalize-diacritics|marked|@angular/common/locales/.*\\.js$))', ], moduleNameMapper: { ...esmPreset.moduleNameMapper, diff --git a/src-ui/package.json b/src-ui/package.json index 0713b4c36..9f90985bc 100644 --- a/src-ui/package.json +++ b/src-ui/package.json @@ -30,6 +30,7 @@ "bootstrap": "^5.3.8", "file-saver": "^2.0.5", "lodash-es": "^4.18.1", + "marked": "~18.0.14", "mime-names": "^1.0.0", "ngx-bootstrap-icons": "^1.9.3", "ngx-color": "^10.1.0", diff --git a/src-ui/pnpm-lock.yaml b/src-ui/pnpm-lock.yaml index cb044387c..34c5c9c99 100644 --- a/src-ui/pnpm-lock.yaml +++ b/src-ui/pnpm-lock.yaml @@ -53,6 +53,9 @@ importers: lodash-es: specifier: ^4.18.1 version: 4.18.1 + marked: + specifier: ~18.0.14 + version: 18.0.14 mime-names: specifier: ^1.0.0 version: 1.0.0 @@ -3226,6 +3229,11 @@ packages: make-error@1.3.6: resolution: {integrity: sha512-s8UhlNe7vPKomQhC1qFelMokr/Sc3AgNbso3n74mVPA5LTZwkB9NlXf4XPamLxJE8h0gh73rM94xvwRT2CVInw==} + marked@18.0.14: + resolution: {integrity: sha512-mBHK6FBHuBAlhgRe88w9F0O1AbwwXJUcQibUbC/QcdTbVGAD7aWza+xt3N6oT/jCZx3/OMeS+8rnuiHZcQ9s7A==} + engines: {node: '>= 20'} + hasBin: true + material-colors@1.2.6: resolution: {integrity: sha512-6qE4B9deFBIa9YSpOc9O0Sgc43zTeVYbgDT5veRKSlB2+ZuHNoVVxA1L/ckMUayV9Ay9y7Z/SZCLcGteW9i7bg==} @@ -7409,6 +7417,8 @@ snapshots: make-error@1.3.6: {} + marked@18.0.14: {} + material-colors@1.2.6: {} merge-stream@2.0.0: {} diff --git a/src-ui/src/app/components/chat/chat/chat.component.html b/src-ui/src/app/components/chat/chat/chat.component.html index d8136fbaf..e8c5f4022 100644 --- a/src-ui/src/app/components/chat/chat/chat.component.html +++ b/src-ui/src/app/components/chat/chat/chat.component.html @@ -5,14 +5,16 @@