@n8n/chat 0.11.0 → 0.12.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@n8n/chat",
3
- "version": "0.11.0",
3
+ "version": "0.12.0",
4
4
  "main": "./chat.umd.js",
5
5
  "module": "./chat.es.js",
6
6
  "types": "./types/index.d.ts",
@@ -4,6 +4,8 @@ import type { PropType } from 'vue';
4
4
  import { computed, toRefs } from 'vue';
5
5
  import VueMarkdown from 'vue-markdown-render';
6
6
  import hljs from 'highlight.js/lib/core';
7
+ import markdownLink from 'markdown-it-link-attributes';
8
+ import type MarkdownIt from 'markdown-it';
7
9
  import type { ChatMessage } from '@n8n/chat/types';
8
10
 
9
11
  const props = defineProps({
@@ -26,6 +28,15 @@ const classes = computed(() => {
26
28
  };
27
29
  });
28
30
 
31
+ const linksNewTabPlugin = (vueMarkdownItInstance: MarkdownIt) => {
32
+ vueMarkdownItInstance.use(markdownLink, {
33
+ attrs: {
34
+ target: '_blank',
35
+ rel: 'noopener',
36
+ },
37
+ });
38
+ };
39
+
29
40
  const markdownOptions = {
30
41
  highlight(str: string, lang: string) {
31
42
  if (lang && hljs.getLanguage(lang)) {
@@ -41,7 +52,12 @@ const markdownOptions = {
41
52
  <template>
42
53
  <div class="chat-message" :class="classes">
43
54
  <slot>
44
- <VueMarkdown class="chat-message-markdown" :source="messageText" :options="markdownOptions" />
55
+ <VueMarkdown
56
+ class="chat-message-markdown"
57
+ :source="messageText"
58
+ :options="markdownOptions"
59
+ :plugins="[linksNewTabPlugin]"
60
+ />
45
61
  </slot>
46
62
  </div>
47
63
  </template>