Skip to content

Self-evolving Context Database for AI Agents. Unify Agent Memory, Knowledge RAG and Skills.

feat(docs): add VikingBot assistant (#3211)

yufeng6914f365ae28
diff --git a/docs/.vitepress/theme/LlmsTxtLink.vue b/docs/.vitepress/theme/LlmsTxtLink.vue
index 3108a2b16..7a8950e38 100644
--- a/docs/.vitepress/theme/LlmsTxtLink.vue
+++ b/docs/.vitepress/theme/LlmsTxtLink.vue
@@ -106,6 +106,7 @@ async function copyLlmsTxt() {
align-items: center;
gap: 12px;
margin-bottom: 8px;
+ white-space: nowrap;
}
.llms-link,
diff --git a/docs/.vitepress/theme/OpenVikingSearch.vue b/docs/.vitepress/theme/OpenVikingSearch.vue
index c68ad2d72..165d66c5d 100644
--- a/docs/.vitepress/theme/OpenVikingSearch.vue
+++ b/docs/.vitepress/theme/OpenVikingSearch.vue
@@ -126,11 +126,13 @@ function shouldIgnoreShortcut(event: KeyboardEvent) {
function handleKeydown(event: KeyboardEvent) {
if (event.key === 'Escape' && isModeMenuOpen.value) {
+ event.preventDefault()
isModeMenuOpen.value = false
return
}
if (event.key === 'Escape' && isOpen.value) {
+ event.preventDefault()
closeSearch()
return
}
diff --git a/docs/.vitepress/theme/VikingBotAssistant.vue b/docs/.vitepress/theme/VikingBotAssistant.vue
new file mode 100644
index 000000000..95cf71990
--- /dev/null
+++ b/docs/.vitepress/theme/VikingBotAssistant.vue
@@ -0,0 +1,357 @@
+<script setup lang="ts">
+import { computed, nextTick, onBeforeUnmount, onMounted, ref, watch } from 'vue'
+import { useData, withBase } from 'vitepress'
+import { chatWithVikingBot, VikingBotApiError } from './vikingbot-api'
+import { renderVikingBotMarkdown } from './vikingbot-markdown'
+
+type ChatMessage = {
+ id: string
+ role: 'user' | 'assistant'
+ content: string
+}
+
+const { lang } = useData()
+const isOpen = ref(false)
+const input = ref('')
+const loading = ref(false)
+const messages = ref<ChatMessage[]>([])
+const copiedMessageId = ref('')
+const scrollArea = ref<HTMLElement>()
+const inputArea = ref<HTMLTextAreaElement>()
+const triggerArea = ref<HTMLButtonElement>()
+const logoUrl = withBase('/ov-logo.png')
+const panelWidth = ref(368)
+const preferredPanelWidth = ref(368)
+const panelMaxWidth = ref(640)
+const isResizing = ref(false)
+const PANEL_WIDTH_KEY = 'openviking-vikingbot-panel-width'
+const MIN_PANEL_WIDTH = 320
+const MAX_PANEL_WIDTH = 640
+const MIN_COMPACT_DOC_WIDTH = 400
+const MIN_FULL_DOC_WIDTH = 760
+const RESIZE_STEP = 16
+
+const isZh = computed(() => lang.value.startsWith('zh'))
+const copy = computed(() => isZh.value ? {
+ trigger: '问问 VikingBot',
+ title: 'VikingBot',
+ subtitle: 'OpenViking 文档助手',
+ welcome: '你好!我是 VikingBot。你可以问我 OpenViking 的使用方式、核心概念或 API 集成问题。',
+ placeholder: '输入你的问题…',
+ send: '发送',
+ copy: '复制',
+ copied: '已复制',
+ thinking: '正在查找答案…',
+ close: '关闭 VikingBot',
+ empty: '请输入问题',
+ tooLong: '问题不能超过 500 个字符',
+ timeout: '请求超时,请稍后重试。',
+ invalid: 'VikingBot 返回了无法识别的响应。',
+ failed: '暂时无法连接 VikingBot,请稍后重试。',
+ resize: '调整 VikingBot 面板宽度'
+} : {
+ trigger: 'Ask VikingBot',
+ title: 'VikingBot',
+ subtitle: 'OpenViking docs assistant',
+ welcome: 'Hi! I’m VikingBot. Ask me about OpenViking concepts, usage, or API integration.',
+ placeholder: 'Ask a question…',
+ send: 'Send',
+ copy: 'Copy',
+ copied: 'Copied',
+ thinking: 'Looking for an answer…',
+ close: 'Close VikingBot',
+ empty: 'Please enter a question',
+ tooLong: 'Questions cannot exceed 500 characters',
+ timeout: 'The request timed out. Please try again.',
+ invalid: 'VikingBot returned an invalid response.',
+ failed: 'VikingBot is unavailable right now. Please try again later.',
+ resize: 'Resize VikingBot panel'
+})
+
+function openPanel() {
+ isOpen.value = true
+ nextTick(() => inputArea.value?.focus())
+}
+
+function closePanel() {
+ const shouldRestoreFocus = isOpen.value
+ isOpen.value = false
+ if (shouldRestoreFocus) nextTick(() => triggerArea.value?.focus())
+}
+
+function maxPanelWidthForViewport() {
+ if (window.innerWidth < 768) return MAX_PANEL_WIDTH
+ const reservedWidth = window.innerWidth < 1280 ? MIN_COMPACT_DOC_WIDTH : MIN_FULL_DOC_WIDTH
+ return Math.max(MIN_PANEL_WIDTH, Math.min(MAX_PANEL_WIDTH, window.innerWidth - reservedWidth))
+}
+
+function applyPanelWidth(width: number, remember = true) {
+ panelMaxWidth.value = maxPanelWidthForViewport()
+ panelWidth.value = Math.min(Math.max(width, MIN_PANEL_WIDTH), panelMaxWidth.value)
+ if (remember) preferredPanelWidth.value = panelWidth.value
+ document.documentElement.style.setProperty('--vikingbot-panel-width', `${panelWidth.value}px`)
+}
+
+function onResizeMove(event: PointerEvent) {
+ if (!isResizing.value) return
+ applyPanelWidth(window.innerWidth - event.clientX)
+}
+
+function stopResize() {
+ if (!isResizing.value) return
+ isResizing.value = false
+ document.documentElement.classList.remove('vikingbot-assistant-resizing')
+ window.removeEventListener('pointermove', onResizeMove)
+ window.removeEventListener('pointercancel', stopResize)
+ window.removeEventListener('blur', stopResize)
+ localStorage.setItem(PANEL_WIDTH_KEY, String(preferredPanelWidth.value))
+}
+
+function startResize(event: PointerEvent) {
+ if (window.innerWidth < 768) return
+ event.preventDefault()
+ isResizing.value = true
+ document.documentElement.classList.add('vikingbot-assistant-resizing')
+ window.addEventListener('pointermove', onResizeMove)
+ window.addEventListener('pointerup', stopResize, { once: true })
+ window.addEventListener('pointercancel', stopResize, { once: true })
+ window.addEventListener('blur', stopResize, { once: true })
+}
+
+function onResizeKeydown(event: KeyboardEvent) {
+ let nextWidth: number | undefined
+ if (event.key === 'ArrowLeft') nextWidth = panelWidth.value + RESIZE_STEP
+ if (event.key === 'ArrowRight') nextWidth = panelWidth.value - RESIZE_STEP
+ if (event.key === 'Home') nextWidth = MIN_PANEL_WIDTH
+ if (event.key === 'End') nextWidth = panelMaxWidth.value
+ if (nextWidth === undefined) return
+
+ event.preventDefault()
+ applyPanelWidth(nextWidth)
+ localStorage.setItem(PANEL_WIDTH_KEY, String(preferredPanelWidth.value))
+}
+
+function onWindowResize() {
+ if (window.innerWidth >= 768) applyPanelWidth(preferredPanelWidth.value, false)
+}
+
+function errorMessage(error: unknown) {
+ if (!(error instanceof VikingBotApiError)) return copy.value.failed
+ if (error.code === 'empty_query') return copy.value.empty
+ if (error.code === 'query_too_long') return copy.value.tooLong
+ if (error.code === 'request_timeout') return copy.value.timeout
+ if (error.code === 'invalid_response') return copy.value.invalid
+ return copy.value.failed
+}
+
+async function copyAnswer(message: ChatMessage) {
+ try {
+ await navigator.clipboard.writeText(message.content)
+ } catch {
+ const textarea = document.createElement('textarea')
+ textarea.value = message.content
+ textarea.style.position = 'fixed'
+ textarea.style.opacity = '0'
+ document.body.appendChild(textarea)
+ textarea.select()
+ document.execCommand('copy')
+ textarea.remove()
+ }
+
+ copiedMessageId.value = message.id
+ window.setTimeout(() => {
+ if (copiedMessageId.value === message.id) copiedMessageId.value = ''
+ }, 1600)
+}
+
+async function scrollToBottom() {
+ await nextTick()
+ scrollArea.value?.scrollTo({ top: scrollArea.value.scrollHeight, behavior: 'smooth' })
+}
+
+async function sendMessage() {
+ if (loading.value) return
+ const query = input.value.trim()
+ if (!query) return
+
+ const userMessage: ChatMessage = {
+ id: `${Date.now()}-user`,
+ role: 'user',
+ content: query
+ }
+ messages.value.push(userMessage)
+ input.value = ''
+ loading.value = true
+ await scrollToBottom()
+
+ try {
+ const result = await chatWithVikingBot(query)
+ messages.value.push({
+ id: `${Date.now()}-assistant`,
+ role: 'assistant',
+ content: result.text
+ })
+ } catch (error) {
+ messages.value.push({
+ id: `${Date.now()}-error`,
+ role: 'assistant',
+ content: errorMessage(error)
+ })
+ } finally {
+ loading.value = false
+ await scrollToBottom()
+ inputArea.value?.focus()
+ }
+}
+
+function onInputKeydown(event: KeyboardEvent) {
+ if (event.key !== 'Enter' || event.shiftKey || event.isComposing) return
+ event.preventDefault()
+ void sendMessage()
+}
+
+function onEscape(event: KeyboardEvent) {
+ if (event.key !== 'Escape' || event.defaultPrevented || !isOpen.value) return
+ event.preventDefault()
+ closePanel()
+}
+
+watch(isOpen, (open) => {
+ document.documentElement.classList.toggle('vikingbot-assistant-open', open)
+})
+
+onMounted(() => {
+ const storedWidth = Number(localStorage.getItem(PANEL_WIDTH_KEY))
+ preferredPanelWidth.value = Number.isFinite(storedWidth) && storedWidth > 0 ? storedWidth : 368
+ applyPanelWidth(preferredPanelWidth.value, false)
+ window.addEventListener('keydown', onEscape)
+ window.addEventListener('resize', onWindowResize)
+})
+
+onBeforeUnmount(() => {
+ document.documentElement.classList.remove('vikingbot-assistant-open')
+ document.documentElement.classList.remove('vikingbot-assistant-resizing')
+ document.documentElement.style.removeProperty('--vikingbot-panel-width')
+ window.removeEventListener('keydown', onEscape)
+ window.removeEventListener('resize', onWindowResize)
+ window.removeEventListener('pointermove', onResizeMove)
+ window.removeEventListener('pointerup', stopResize)
+ window.removeEventListener('pointercancel', stopResize)
+ window.removeEventListener('blur', stopResize)
+})
+</script>
+
+<template>
+ <button
+ ref="triggerArea"
+ class="vikingbot-trigger"
+ type="button"
+ :aria-label="copy.trigger"
+ :aria-expanded="isOpen"
+ aria-controls="vikingbot-assistant-panel"
+ @click="isOpen ? closePanel() : openPanel()"
+ >
+ <span class="vikingbot-spark" aria-hidden="true">✦</span>
+ <span class="vikingbot-trigger-label">{{ copy.trigger }}</span>
+ </button>
+
+ <Teleport to="body">
+ <Transition name="vikingbot-panel">
+ <aside
+ v-if="isOpen"
+ id="vikingbot-assistant-panel"
+ class="vikingbot-panel"
+ aria-label="VikingBot"
+ >
+ <div
+ class="vikingbot-resize-handle"
+ role="separator"
+ tabindex="0"
+ aria-orientation="vertical"
+ :aria-label="copy.resize"
+ :aria-valuemin="MIN_PANEL_WIDTH"
+ :aria-valuemax="panelMaxWidth"
+ :aria-valuenow="panelWidth"
+ @keydown="onResizeKeydown"
+ @pointerdown="startResize"
+ />
+ <header class="vikingbot-panel-header">
+ <div class="vikingbot-identity">
+ <span class="vikingbot-avatar" aria-hidden="true">
+ <img :src="logoUrl" alt="" />
+ </span>
+ <span>
+ <strong>{{ copy.title }}</strong>
+ <small>{{ copy.subtitle }}</small>
+ </span>
+ </div>
+ <button class="vikingbot-close" type="button" :aria-label="copy.close" @click="closePanel">
+ <span aria-hidden="true">×</span>
+ </button>
+ </header>
+
+ <div ref="scrollArea" class="vikingbot-messages" aria-live="polite">
+ <div class="vikingbot-message is-assistant">
+ <span class="vikingbot-message-mark" aria-hidden="true">
+ <img :src="logoUrl" alt="" />
+ </span>
+ <div class="vikingbot-markdown" v-html="renderVikingBotMarkdown(copy.welcome)" />
+ </div>
+ <div
+ v-for="message in messages"
+ :key="message.id"
+ class="vikingbot-message"
+ :class="`is-${message.role}`"
+ >
+ <span v-if="message.role === 'assistant'" class="vikingbot-message-mark" aria-hidden="true">
+ <img :src="logoUrl" alt="" />
+ </span>
+ <p v-if="message.role === 'user'">{{ message.content }}</p>
+ <div v-else class="vikingbot-answer">
+ <div
+ class="vikingbot-markdown"
+ v-html="renderVikingBotMarkdown(message.content)"
+ />
+ <button
+ class="vikingbot-copy-answer"
+ type="button"
+ @click="copyAnswer(message)"
+ >
+ <svg viewBox="0 0 24 24" aria-hidden="true">
+ <path d="M8 8h10v11H8z" />
+ <path d="M6 16H4V5h10v2" />
+ </svg>
+ {{ copiedMessageId === message.id ? copy.copied : copy.copy }}
+ </button>
+ </div>
+ </div>
+ <div
+ v-if="loading"
+ class="vikingbot-message is-loading"
+ role="status"
+ :aria-label="copy.thinking"
+ >
+ <span class="vikingbot-dots" aria-hidden="true"><i /><i /><i /></span>
+ </div>
+ </div>
+
+ <form class="vikingbot-composer" @submit.prevent="sendMessage">
+ <div class="vikingbot-input-shell">
+ <textarea
+ ref="inputArea"
+ v-model="input"
+ :placeholder="copy.placeholder"
+ :disabled="loading"
+ maxlength="500"
+ rows="3"
+ @keydown="onInputKeydown"
+ />
+ <button type="submit" :disabled="loading || !input.trim()" :aria-label="copy.send">
+ <svg viewBox="0 0 24 24" aria-hidden="true"><path d="m5 12 14-7-4.7 14-2.8-5.5L5 12Zm6.5 1.5 3-3" /></svg>
+ </button>
+ </div>
+ </form>
+ </aside>
+ </Transition>
+ </Teleport>
+</template>
diff --git a/docs/.vitepress/theme/custom.css b/docs/.vitepress/theme/custom.css
index 4ba356eef..993f993db 100644
--- a/docs/.vitepress/theme/custom.css
+++ b/docs/.vitepress/theme/custom.css
@@ -1,4 +1,5 @@
:root {
+ --vikingbot-panel-width: 368px;
--vp-layout-max-width: 100vw;
--vp-c-brand-1: #0f766e;
--vp-c-brand-2: #115e59;
@@ -76,6 +77,25 @@
}
@media (min-width: 960px) {
+ .VPNav {
+ box-sizing: border-box;
+ background-color: var(--vp-c-bg);
+ border-bottom: 1px solid var(--vp-c-divider);
+ }
+
+ .VPNavBar,
+ .VPNavBar.has-sidebar {
+ background-color: var(--vp-c-bg);
+ }
+
+ .VPNavBar .divider {
+ display: none;
+ }
+
+ .VPNav .VPNavBarTitle.has-sidebar .title {
+ border-bottom: 0 !important;
+ }
+
.VPNavBarTranslations {
display: flex !important;
}
@@ -96,6 +116,568 @@
margin-right: 12px;
}
+/* VikingBot docs assistant */
+.vikingbot-trigger {
+ display: inline-flex;
+ height: 40px;
+ flex: 0 0 auto;
+ align-items: center;
+ gap: 8px;
+ margin-right: 12px;
+ padding: 0 14px;
+ border: 1px solid color-mix(in srgb, var(--vp-c-brand-1) 32%, var(--vp-c-divider));
+ border-radius: 8px;
+ background: color-mix(in srgb, var(--vp-c-brand-soft) 45%, var(--vp-c-bg));
+ color: var(--vp-c-brand-1);
+ font: inherit;
+ font-size: 13px;
+ font-weight: 700;
+ cursor: pointer;
+ transition: border-color 0.2s, background-color 0.2s, transform 0.2s;
+}
+
+.vikingbot-trigger:hover {
+ border-color: var(--vp-c-brand-1);
+ background: var(--vp-c-brand-soft);
+ transform: translateY(-1px);
+}
+
+.vikingbot-spark {
+ font-size: 17px;
+ line-height: 1;
+}
+
+.vikingbot-panel {
+ position: fixed;
+ z-index: 90;
+ top: 0;
+ right: 0;
+ bottom: 0;
+ display: flex;
+ width: min(var(--vikingbot-panel-width), 100vw);
+ flex-direction: column;
+ border-left: 1px solid var(--vp-c-divider);
+ background:
+ radial-gradient(circle at 90% 0, color-mix(in srgb, var(--vp-c-brand-soft) 55%, transparent), transparent 230px),
+ var(--vp-c-bg);
+}
+
+.vikingbot-resize-handle {
+ position: absolute;
+ z-index: 2;
+ top: 0;
+ bottom: 0;
+ left: -6px;
+ width: 12px;
+ padding: 0;
+ border: 0;
+ background: transparent;
+ cursor: col-resize;
+ touch-action: none;
+}
+
+.vikingbot-resize-handle::before {
+ position: absolute;
+ top: 0;
+ bottom: 0;
+ left: 5px;
+ width: 1px;
+ background: var(--vp-c-divider);
+ content: '';
+ transition: width 0.15s, background-color 0.15s;
+}
+
+.vikingbot-resize-handle:hover::before,
+.vikingbot-resize-handle:focus-visible::before,
+.vikingbot-assistant-resizing .vikingbot-resize-handle::before {
+ width: 2px;
+ background: color-mix(in srgb, var(--vp-c-brand-1) 72%, var(--vp-c-divider));
+}
+
+.vikingbot-resize-handle:focus-visible {
+ outline: 0;
+}
+
+html.vikingbot-assistant-resizing,
+html.vikingbot-assistant-resizing * {
+ cursor: col-resize !important;
+ user-select: none !important;
+}
+
+.vikingbot-panel-header {
+ display: flex;
+ height: calc(var(--vp-nav-height) + 1px);
+ min-height: calc(var(--vp-nav-height) + 1px);
+ align-items: center;
+ justify-content: space-between;
+ padding: 7px 16px;
+ border-bottom: 1px solid var(--vp-c-divider);
+}
+
+.vikingbot-identity {
+ display: flex;
+ align-items: center;
+ gap: 11px;
+}
+
+.vikingbot-identity > span:last-child {
+ display: flex;
+ flex-direction: column;
+ gap: 2px;
+}
+
+.vikingbot-identity strong {
+ color: var(--vp-c-text-1);
+ font-size: 15px;
+}
+
+.vikingbot-identity small {
+ color: var(--vp-c-text-3);
+ font-size: 11px;
+}
+
+.vikingbot-avatar,
+.vikingbot-message-mark {
+ display: block;
+ flex: 0 0 auto;
+ overflow: hidden;
+ border-radius: 8px;
+ background: var(--vp-c-bg-soft);
+}
+
+.vikingbot-avatar img,
+.vikingbot-message-mark img {
+ display: block;
+ width: 100%;
+ height: 100%;
+ object-fit: cover;
+}
+
+.vikingbot-avatar {
+ width: 36px;
+ height: 36px;
+}
+
+.vikingbot-close {
+ display: grid;
+ width: 34px;
+ height: 34px;
+ place-items: center;
+ border: 0;
+ border-radius: 8px;
+ background: transparent;
+ color: var(--vp-c-text-2);
+ font-size: 24px;
+ cursor: pointer;
+}
+
+.vikingbot-close:hover {
+ background: var(--vp-c-bg-soft);
+ color: var(--vp-c-text-1);
+}
+
+.vikingbot-messages {
+ flex: 1 1 auto;
+ overflow-y: auto;
+ padding: 22px 16px;
+ overscroll-behavior: contain;
+}
+
+.vikingbot-message {
+ display: flex;
+ align-items: flex-start;
+ gap: 9px;
+ margin-bottom: 18px;
+}
+
+.vikingbot-message.is-user {
+ justify-content: flex-end;
+}
+
+.vikingbot-message-mark {
+ width: 25px;
+ height: 25px;
+ margin-top: 2px;
+ border-radius: 7px;
+ font-size: 11px;
+}
+
+.vikingbot-message > p,
+.vikingbot-markdown {
+ max-width: calc(100% - 36px);
+ margin: 0;
+ padding: 10px 12px;
+ border: 1px solid var(--vp-c-divider);
+ border-radius: 4px 14px 14px 14px;
+ background: var(--vp-c-bg-elv);
+ color: var(--vp-c-text-1);
+ font-size: 13px;
+ line-height: 1.65;
+ overflow-wrap: anywhere;
+}
+
+.vikingbot-answer {
+ display: flex;
+ width: calc(100% - 36px);
+ max-width: calc(100% - 36px);
+ flex-direction: column;
+ align-items: flex-end;
+}
+
+.vikingbot-answer .vikingbot-markdown {
+ width: 100%;
+ max-width: none;
+}
+
+.vikingbot-copy-answer {
+ display: inline-flex;
+ height: 28px;
+ align-items: center;
+ gap: 5px;
+ margin-top: 7px;
+ padding: 0 8px;
+ border: 0;
+ border-radius: 6px;
+ background: transparent;
+ color: var(--vp-c-text-3);
+ font: inherit;
+ font-size: 11px;
+ cursor: pointer;
+}
+
+.vikingbot-copy-answer:hover {
+ background: var(--vp-c-bg-soft);
+ color: var(--vp-c-text-1);
+}
+
+.vikingbot-copy-answer svg {
+ width: 14px;
+ height: 14px;
+ fill: none;
+ stroke: currentColor;
+ stroke-linecap: round;
+ stroke-linejoin: round;
+ stroke-width: 1.7;
+}
+
+.vikingbot-message > p { white-space: pre-wrap; }
+.vikingbot-markdown { white-space: normal; }
+
+.vikingbot-message.is-user > p {
+ border-color: transparent;
+ border-radius: 14px 4px 14px 14px;
+ background: var(--vp-c-brand-soft);
+}
+
+.vikingbot-message.is-loading {
+ align-items: center;
+ min-height: 24px;
+ margin: 2px 0 18px 3px;
+}
+
+.vikingbot-markdown > :first-child { margin-top: 0; }
+.vikingbot-markdown > :last-child { margin-bottom: 0; }
+
+.vikingbot-markdown p,
+.vikingbot-markdown ul,
+.vikingbot-markdown ol,
+.vikingbot-markdown pre,
+.vikingbot-markdown blockquote,
+.vikingbot-markdown table {
+ margin: 0 0 10px;
+}
+
+.vikingbot-markdown ul,
+.vikingbot-markdown ol {
+ padding-left: 18px;
+}
+
+.vikingbot-markdown li + li { margin-top: 4px; }
+
+.vikingbot-markdown h1,
+.vikingbot-markdown h2,
+.vikingbot-markdown h3,
+.vikingbot-markdown h4 {
+ margin: 14px 0 7px;
+ color: var(--vp-c-text-1);
+ font-weight: 750;
+ line-height: 1.35;
+}
+
+.vikingbot-markdown h1 { font-size: 17px; }
+.vikingbot-markdown h2 { font-size: 15px; }
+.vikingbot-markdown h3,
+.vikingbot-markdown h4 { font-size: 14px; }
+
+.vikingbot-markdown a {
+ color: var(--vp-c-brand-1);
+ font-weight: 600;
+ text-decoration: underline;
+ text-underline-offset: 2px;
+}
+
+.vikingbot-markdown code {
+ padding: 2px 4px;
+ border-radius: 4px;
+ background: var(--vp-c-bg-soft);
+ color: var(--vp-c-brand-1);
+ font-family: var(--vp-font-family-mono);
+ font-size: 0.9em;
+}
+
+.vikingbot-markdown pre {
+ overflow-x: auto;
+ padding: 10px;
+ border-radius: 8px;
+ background: var(--vp-code-block-bg);
+}
+
+.vikingbot-markdown pre code {
+ padding: 0;
+ background: transparent;
+ color: var(--vp-code-block-color);
+ white-space: pre;
+}
+
+.vikingbot-markdown blockquote {
+ padding-left: 10px;
+ border-left: 3px solid var(--vp-c-brand-1);
+ color: var(--vp-c-text-2);
+}
+
+.vikingbot-markdown table {
+ display: block;
+ width: 100%;
+ overflow-x: auto;
+ border-collapse: collapse;
+ font-size: 12px;
+}
+
+.vikingbot-markdown th,
+.vikingbot-markdown td {
+ padding: 6px 8px;
+ border: 1px solid var(--vp-c-divider);
+ text-align: left;
+}
+
+.vikingbot-markdown th { background: var(--vp-c-bg-soft); }
+
+.vikingbot-composer {
+ flex: 0 0 auto;
+ padding: 12px 14px 14px;
+ border-top: 1px solid var(--vp-c-divider);
+ background: color-mix(in srgb, var(--vp-c-bg) 94%, transparent);
+}
+
+.vikingbot-input-shell {
+ position: relative;
+ border: 1px solid var(--vp-c-divider);
+ border-radius: 12px;
+ background: var(--vp-c-bg-elv);
+ transition: border-color 0.2s, box-shadow 0.2s;
+}
+
+.vikingbot-input-shell:focus-within {
+ border-color: var(--vp-c-brand-1);
+ box-shadow: 0 0 0 3px var(--vp-c-brand-soft);
+}
+
+.vikingbot-input-shell textarea {
+ display: block;
+ width: 100%;
+ min-height: 86px;
+ resize: none;
+ border: 0;
+ outline: 0;
+ padding: 12px 48px 12px 12px;
+ background: transparent;
+ color: var(--vp-c-text-1);
+ font: inherit;
+ font-size: 13px;
+ line-height: 1.5;
+}
+
+.vikingbot-input-shell button {
+ position: absolute;
+ right: 9px;
+ bottom: 9px;
+ display: grid;
+ width: 32px;
+ height: 32px;
+ place-items: center;
+ border: 0;
+ border-radius: 8px;
+ background: var(--vp-c-brand-1);
+ color: var(--vp-c-bg);
+ cursor: pointer;
+}
+
+.vikingbot-input-shell button:disabled {
+ opacity: 0.35;
+ cursor: not-allowed;
+}
+
+.vikingbot-input-shell svg {
+ width: 17px;
+ fill: none;
+ stroke: currentColor;
+ stroke-linecap: round;
+ stroke-linejoin: round;
+ stroke-width: 1.8;
+}
+
+.vikingbot-dots {
+ display: inline-flex;
+ gap: 3px;
+}
+
+.vikingbot-dots i {
+ width: 4px;
+ height: 4px;
+ border-radius: 50%;
+ background: var(--vp-c-brand-1);
+ animation: vikingbot-pulse 1.1s infinite ease-in-out;
+}
+
+.vikingbot-dots i:nth-child(2) { animation-delay: 0.15s; }
+.vikingbot-dots i:nth-child(3) { animation-delay: 0.3s; }
+
+.vikingbot-panel-enter-active,
+.vikingbot-panel-leave-active { transition: transform 0.24s ease, opacity 0.2s ease; }
+.vikingbot-panel-enter-from,
+.vikingbot-panel-leave-to { opacity: 0; transform: translateX(24px); }
+
+@keyframes vikingbot-pulse {
+ 0%, 60%, 100% { opacity: 0.28; transform: translateY(0); }
+ 30% { opacity: 1; transform: translateY(-2px); }
+}
+
+@media (min-width: 768px) {
+ html.vikingbot-assistant-open {
+ --vp-layout-max-width: 100vw;
+ }
+
+ html.vikingbot-assistant-open .Layout,
+ html.vikingbot-assistant-open .VPNav {
+ padding-right: var(--vikingbot-panel-width);
+ }
+
+ html.vikingbot-assistant-open .VPNavBar.has-sidebar .wrapper {
+ padding-right: 16px;
+ padding-left: 16px;
+ }
+
+ html.vikingbot-assistant-open .VPNavBar.has-sidebar .container > .title {
+ position: relative;
+ top: auto;
+ left: auto;
+ width: auto;
+ flex: 0 0 auto;
+ padding: 0;
+ }
+
+ html.vikingbot-assistant-open .VPNavBar.has-sidebar .container > .content {
+ padding-right: 0;
+ padding-left: 24px;
+ }
+
+ html.vikingbot-assistant-open .VPNavBarTitle .logo {
+ display: block;
+ width: 28px;
+ height: 28px;
+ flex: 0 0 28px;
+ object-fit: cover;
+ }
+
+ html.vikingbot-assistant-open .VPContent .VPDoc {
+ padding-right: 60px;
+ padding-left: 60px;
+ }
+
+ html.vikingbot-assistant-open .VPContent .VPDoc.has-aside > .container > .content {
+ padding-right: 0;
+ padding-left: 0;
+ }
+
+ html.vikingbot-assistant-open .Layout,
+ html.vikingbot-assistant-open .VPNav,
+ html.vikingbot-assistant-open .VPSidebar {
+ transition: padding-right 0.24s ease, right 0.24s ease;
+ }
+}
+
+@media (min-width: 768px) and (max-width: 1279px) {
+ html.vikingbot-assistant-open .VPSidebar {
+ display: none;
+ }
+
+ html.vikingbot-assistant-open .VPContent.has-sidebar {
+ padding-left: 0;
+ }
+
+ html.vikingbot-assistant-open .VPContent .VPDoc > .container > .aside,
+ html.vikingbot-assistant-open .VPNavBar .menu,
+ html.vikingbot-assistant-open .VPNavBar .translations,
+ html.vikingbot-assistant-open .VPNavBar .appearance,
+ html.vikingbot-assistant-open .VPNavBar .social-links,
+ html.vikingbot-assistant-open .VPNavBar .extra {
+ display: none !important;
+ }
+
+ html.vikingbot-assistant-open .ov-docs-search-trigger {
+ width: 40px;
+ min-width: 40px;
+ justify-content: center;
+ padding: 0;
+ }
+
+ html.vikingbot-assistant-open .ov-docs-search-trigger-label,
+ html.vikingbot-assistant-open .ov-docs-search-trigger kbd {
+ display: none;
+ }
+
+ html.vikingbot-assistant-open .ov-docs-search-trigger-compact {
+ display: block;
+ }
+}
+
+@media (min-width: 768px) and (max-width: 1599px) {
+ html.vikingbot-assistant-open .VPContent .VPDoc {
+ padding-right: 32px;
+ padding-left: 32px;
+ }
+}
+
+@media (min-width: 1280px) {
+ html.vikingbot-assistant-open .VPSidebar {
+ width: var(--vp-sidebar-width);
+ padding-left: 60px;
+ }
+
+ html.vikingbot-assistant-open .VPContent .VPDoc > .container > .aside {
+ max-width: 240px;
+ padding-left: 16px;
+ }
+}
+
+@media (max-width: 1279px) {
+ .vikingbot-trigger-label { display: none; }
+ .vikingbot-trigger { width: 40px; justify-content: center; padding: 0; }
+}
+
+@media (max-width: 767px) {
+ .vikingbot-trigger { margin-right: 8px; }
+ .vikingbot-panel { z-index: 200; width: 100vw; }
+ .vikingbot-resize-handle { display: none; }
+}
+
+@media (prefers-reduced-motion: reduce) {
+ .vikingbot-trigger,
+ .vikingbot-panel-enter-active,
+ .vikingbot-panel-leave-active { transition: none; }
+ .vikingbot-dots i { animation: none; }
+}
+
.ov-docs-search-trigger {
display: inline-flex;
align-items: center;
@@ -355,19 +937,24 @@
display: flex;
align-items: flex-start;
justify-content: space-between;
+ flex-wrap: wrap;
gap: 16px;
margin-bottom: 16px;
}
.doc-page-actions > .llms-link-wrap,
.doc-page-actions > .copy-md-wrap {
+ flex: 0 0 auto;
margin-bottom: 0;
}
+.doc-page-actions > .copy-md-wrap {
+ margin-left: auto;
+}
+
@media (max-width: 640px) {
.doc-page-actions {
align-items: center;
- flex-wrap: wrap;
}
}
diff --git a/docs/.vitepress/theme/index.ts b/docs/.vitepress/theme/index.ts
index a29008625..5fc591f1a 100644
--- a/docs/.vitepress/theme/index.ts
+++ b/docs/.vitepress/theme/index.ts
@@ -5,6 +5,7 @@ import CopyMarkdownButton from './CopyMarkdownButton.vue'
import LlmsTxtLink from './LlmsTxtLink.vue'
import OpenVikingSearch from './OpenVikingSearch.vue'
import ApiExampleTabsEnhancer from './ApiExampleTabsEnhancer.vue'
+import VikingBotAssistant from './VikingBotAssistant.vue'
import { trackPageView } from './track'
import './custom.css'
@@ -308,7 +309,7 @@ export default {
h(CopyMarkdownButton)
]),
'doc-after': () => h(ApiExampleTabsEnhancer),
- 'nav-bar-content-before': () => h(OpenVikingSearch)
+ 'nav-bar-content-before': () => [h(OpenVikingSearch), h(VikingBotAssistant)]
})
},
enhanceApp({ router }: EnhanceAppContext) {
diff --git a/docs/.vitepress/theme/vikingbot-api.test.ts b/docs/.vitepress/theme/vikingbot-api.test.ts
new file mode 100644
index 000000000..b80498fc4
--- /dev/null
+++ b/docs/.vitepress/theme/vikingbot-api.test.ts
@@ -0,0 +1,31 @@
+import assert from 'node:assert/strict'
+import test from 'node:test'
+import { getVikingBotUserId, normalizeVikingBotQuery, VikingBotApiError } from './vikingbot-api.ts'
+
+test('normalizes VikingBot queries and enforces the UI limit', () => {
+ assert.equal(normalizeVikingBotQuery(' How does memory work? '), 'How does memory work?')
+
+ assert.throws(
+ () => normalizeVikingBotQuery(' '),
+ (error) => error instanceof VikingBotApiError && error.code === 'empty_query'
+ )
+ assert.throws(
+ () => normalizeVikingBotQuery('x'.repeat(501)),
+ (error) => error instanceof VikingBotApiError && error.code === 'query_too_long'
+ )
+})
+
+test('reuses the stable VikingBot user id from storage', () => {
+ const values = new Map<string, string>([['client_id', 'existing-user']])
+ const storage = {
+ getItem(key: string) {
+ return values.get(key) ?? null
+ },
+ setItem(key: string, value: string) {
+ values.set(key, value)
+ }
+ }
+
+ assert.equal(getVikingBotUserId(storage), 'existing-user')
+ assert.equal(values.size, 1)
+})
diff --git a/docs/.vitepress/theme/vikingbot-api.ts b/docs/.vitepress/theme/vikingbot-api.ts
new file mode 100644
index 000000000..9c94f9792
--- /dev/null
+++ b/docs/.vitepress/theme/vikingbot-api.ts
@@ -0,0 +1,122 @@
+const DEFAULT_API_BASE_URL =
+ 'https://sd7aepg2caqr3a7a3g870.apigateway-cn-shanghai.volceapi.com/api/v1'
+const VIKINGBOT_API_KEY = 'kjWSxIHxa0hRk9C/0gSFvA=='
+const REQUEST_TIMEOUT_MS = 60_000
+const CLIENT_ID_KEY = 'client_id'
+
+type ApiResponse<T> = {
+ status: string
+ err_code: string
+ err_msg: string
+ result: T
+}
+
+export type VikingBotApiErrorCode =
+ | 'api_error'
+ | 'empty_query'
+ | 'http_error'
+ | 'invalid_response'
+ | 'network_error'
+ | 'query_too_long'
+ | 'request_timeout'
+
+export type VikingBotChatResult = {
+ text: string
+}
+
+export class VikingBotApiError extends Error {
+ readonly code: VikingBotApiErrorCode
+ readonly apiCode: string
+ readonly httpStatus?: number
+
+ constructor(
+ code: VikingBotApiErrorCode,
+ apiCode = '',
+ httpStatus?: number
+ ) {
+ super(code)
+ this.name = 'VikingBotApiError'
+ this.code = code
+ this.apiCode = apiCode
+ this.httpStatus = httpStatus
+ }
+}
+
+export function getVikingBotUserId(storage: Pick<Storage, 'getItem' | 'setItem'> = localStorage) {
+ let id = storage.getItem(CLIENT_ID_KEY)
+ if (!id) {
+ id = crypto.randomUUID()
+ storage.setItem(CLIENT_ID_KEY, id)
+ }
+ return id
+}
+
+export function normalizeVikingBotQuery(query: string) {
+ const normalized = query.trim()
+ if (!normalized) throw new VikingBotApiError('empty_query')
+ if (normalized.length > 500) throw new VikingBotApiError('query_too_long')
+ return normalized
+}
+
+export async function chatWithVikingBot(query: string): Promise<VikingBotChatResult> {
+ const normalizedQuery = normalizeVikingBotQuery(query)
+
+ const controller = new AbortController()
+ const timeout = window.setTimeout(() => controller.abort(), REQUEST_TIMEOUT_MS)
+
+ try {
+ const response = await fetch(`${DEFAULT_API_BASE_URL}/bot/chat`, {
+ method: 'POST',
+ headers: {
+ 'Content-Type': 'application/json',
+ 'X-OpenViking-Bot-Key': VIKINGBOT_API_KEY
+ },
+ body: JSON.stringify({
+ user_id: getVikingBotUserId(),
+ query: normalizedQuery
+ }),
+ signal: controller.signal
+ })
+
+ let data: ApiResponse<VikingBotChatResult>
+ try {
+ data = (await response.json()) as ApiResponse<VikingBotChatResult>
+ } catch {
+ throw new VikingBotApiError(
+ response.ok ? 'invalid_response' : 'http_error',
+ '',
+ response.status
+ )
+ }
+
+ if (!response.ok) {
+ throw new VikingBotApiError(
+ 'http_error',
+ data.err_code,
+ response.status
+ )
+ }
+
+ if (data.status !== 'ok') {
+ throw new VikingBotApiError(
+ 'api_error',
+ data.err_code,
+ response.status
+ )
+ }
+
+ if (!data.result || typeof data.result.text !== 'string') {
+ throw new VikingBotApiError('invalid_response', '', response.status)
+ }
+
+ return data.result
+ } catch (error) {
+ if (error instanceof DOMException && error.name === 'AbortError') {
+ throw new VikingBotApiError('request_timeout')
+ }
+ if (error instanceof VikingBotApiError) throw error
+ throw new VikingBotApiError('network_error')
+ } finally {
+ window.clearTimeout(timeout)
+ }
+}
diff --git a/docs/.vitepress/theme/vikingbot-markdown.test.ts b/docs/.vitepress/theme/vikingbot-markdown.test.ts
new file mode 100644
index 000000000..86e4e0235
--- /dev/null
+++ b/docs/.vitepress/theme/vikingbot-markdown.test.ts
@@ -0,0 +1,24 @@
+import assert from 'node:assert/strict'
+import test from 'node:test'
+import { renderVikingBotMarkdown } from './vikingbot-markdown.ts'
+
+test('renders supported VikingBot Markdown', () => {
+ const result = renderVikingBotMarkdown('## Install\n\n```bash\nnpm install openviking\n```')
+
+ assert.match(result, /<h2>Install<\/h2>/)
+ assert.match(result, /<code class="language-bash">/)
+})
+
+test('sanitizes VikingBot Markdown output', () => {
+ const result = renderVikingBotMarkdown([
+ '<img src=x onerror=alert(1)>',
+ '[unsafe](javascript:alert(1))',
+ '[safe](https://openviking.ai)'
+ ].join('\n\n'))
+
+ assert.doesNotMatch(result, /<img/i)
+ assert.doesNotMatch(result, /href="javascript:/i)
+ assert.match(result, /href="https:\/\/openviking\.ai"/)
+ assert.match(result, /target="_blank"/)
+ assert.match(result, /rel="noopener noreferrer"/)
+})
diff --git a/docs/.vitepress/theme/vikingbot-markdown.ts b/docs/.vitepress/theme/vikingbot-markdown.ts
new file mode 100644
index 000000000..9b275d500
--- /dev/null
+++ b/docs/.vitepress/theme/vikingbot-markdown.ts
@@ -0,0 +1,50 @@
+import MarkdownIt from 'markdown-it'
+import { FilterXSS } from 'xss'
+
+const markdown = new MarkdownIt({
+ html: false,
+ breaks: true,
+ linkify: true,
+ typographer: true
+})
+
+const defaultLinkOpen = markdown.renderer.rules.link_open
+markdown.renderer.rules.link_open = (tokens, index, options, env, self) => {
+ tokens[index].attrSet('target', '_blank')
+ tokens[index].attrSet('rel', 'noopener noreferrer')
+ return defaultLinkOpen
+ ? defaultLinkOpen(tokens, index, options, env, self)
+ : self.renderToken(tokens, index, options)
+}
+
+const sanitizer = new FilterXSS({
+ whiteList: {
+ a: ['href', 'title', 'target', 'rel'],
+ blockquote: [],
+ br: [],
+ code: ['class'],
+ em: [],
+ h1: [],
+ h2: [],
+ h3: [],
+ h4: [],
+ li: [],
+ ol: [],
+ p: [],
+ pre: [],
+ strong: [],
+ table: [],
+ tbody: [],
+ td: [],
+ th: [],
+ thead: [],
+ tr: [],
+ ul: []
+ },
+ stripIgnoreTag: true,
+ stripIgnoreTagBody: ['script', 'style']
+})
+
+export function renderVikingBotMarkdown(content: string) {
+ return sanitizer.process(markdown.render(content))
+}
diff --git a/docs/package-lock.json b/docs/package-lock.json
index 2e13d6de4..1ec087404 100644
--- a/docs/package-lock.json
+++ b/docs/package-lock.json
@@ -8,7 +8,9 @@
"name": "openviking-docs",
"version": "0.0.0",
"devDependencies": {
- "vitepress": "1.6.4"
+ "markdown-it": "^14.3.0",
+ "vitepress": "1.6.4",
+ "xss": "^1.0.15"
}
},
"node_modules/@algolia/abtesting": {
@@ -877,9 +879,6 @@
"arm"
],
"dev": true,
- "libc": [
- "glibc"
- ],
"license": "MIT",
"optional": true,
"os": [
@@ -894,9 +893,6 @@
"arm"
],
"dev": true,
- "libc": [
- "musl"
- ],
"license": "MIT",
"optional": true,
"os": [
@@ -911,9 +907,6 @@
"arm64"
],
"dev": true,
- "libc": [
- "glibc"
- ],
"license": "MIT",
"optional": true,
"os": [
@@ -928,9 +921,6 @@
"arm64"
],
"dev": true,
- "libc": [
- "musl"
- ],
"license": "MIT",
"optional": true,
"os": [
@@ -945,9 +935,6 @@
"loong64"
],
"dev": true,
- "libc": [
- "glibc"
- ],
"license": "MIT",
"optional": true,
"os": [
@@ -962,9 +949,6 @@
"loong64"
],
"dev": true,
- "libc": [
- "musl"
- ],
"license": "MIT",
"optional": true,
"os": [
@@ -979,9 +963,6 @@
"ppc64"
],
"dev": true,
- "libc": [
- "glibc"
- ],
"license": "MIT",
"optional": true,
"os": [
@@ -996,9 +977,6 @@
"ppc64"
],
"dev": true,
- "libc": [
- "musl"
- ],
"license": "MIT",
"optional": true,
"os": [
@@ -1013,9 +991,6 @@
"riscv64"
],
"dev": true,
- "libc": [
- "glibc"
- ],
"license": "MIT",
"optional": true,
"os": [
@@ -1030,9 +1005,6 @@
"riscv64"
],
"dev": true,
- "libc": [
- "musl"
- ],
"license": "MIT",
"optional": true,
"os": [
@@ -1047,9 +1019,6 @@
"s390x"
],
"dev": true,
- "libc": [
- "glibc"
- ],
"license": "MIT",
"optional": true,
"os": [
@@ -1064,9 +1033,6 @@
"x64"
],
"dev": true,
- "libc": [
- "glibc"
- ],
"license": "MIT",
"optional": true,
"os": [
@@ -1081,9 +1047,6 @@
"x64"
],
"dev": true,
- "libc": [
- "musl"
- ],
"license": "MIT",
"optional": true,
"os": [
@@ -1625,6 +1588,13 @@
"node": ">= 14.0.0"
}
},
+ "node_modules/argparse": {
+ "version": "2.0.1",
+ "resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz",
+ "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==",
+ "dev": true,
+ "license": "Python-2.0"
+ },
"node_modules/birpc": {
"version": "2.9.0",
"resolved": "https://registry.npmjs.org/birpc/-/birpc-2.9.0.tgz",
@@ -1679,6 +1649,13 @@
"url": "https://github.com/sponsors/wooorm"
}
},
+ "node_modules/commander": {
+ "version": "2.20.3",
+ "resolved": "https://registry.npmjs.org/commander/-/commander-2.20.3.tgz",
+ "integrity": "sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==",
+ "dev": true,
+ "license": "MIT"
+ },
"node_modules/copy-anything": {
"version": "4.0.5",
"resolved": "https://registry.npmjs.org/copy-anything/-/copy-anything-4.0.5.tgz",
@@ -1695,6 +1672,13 @@
"url": "https://github.com/sponsors/mesqueeb"
}
},
+ "node_modules/cssfilter": {
+ "version": "0.0.10",
+ "resolved": "https://registry.npmjs.org/cssfilter/-/cssfilter-0.0.10.tgz",
+ "integrity": "sha512-FAaLDaplstoRsDR8XGYH51znUN0UY7nMc6Z9/fvE8EXGwvJE9hu7W2vHwx1+bd6gCYnln9nLbzxFTrcO9YQDZw==",
+ "dev": true,
+ "license": "MIT"
+ },
"node_modules/csstype": {
"version": "3.2.3",
"resolved": "https://registry.npmjs.org/csstype/-/csstype-3.2.3.tgz",
@@ -1886,6 +1870,26 @@
"url": "https://github.com/sponsors/mesqueeb"
}
},
+ "node_modules/linkify-it": {
+ "version": "5.0.2",
+ "resolved": "https://registry.npmjs.org/linkify-it/-/linkify-it-5.0.2.tgz",
+ "integrity": "sha512-ONTm2jCMAVZjgQa/Fy1kScXsuOoF5NPTsoFBdE1KVIZ2vAh/r9+Bqo+0jINCBYnavTPQZz38QzFTme79ENoN3Q==",
+ "dev": true,
+ "funding": [
+ {
+ "type": "github",
+ "url": "https://github.com/sponsors/puzrin"
+ },
+ {
+ "type": "github",
+ "url": "https://github.com/sponsors/markdown-it"
+ }
+ ],
+ "license": "MIT",
+ "dependencies": {
+ "uc.micro": "^2.0.0"
+ }
+ },
"node_modules/magic-string": {
"version": "0.30.21",
"resolved": "https://registry.npmjs.org/magic-string/-/magic-string-0.30.21.tgz",
@@ -1903,6 +1907,47 @@
"dev": true,
"license": "MIT"
},
+ "node_modules/markdown-it": {
+ "version": "14.3.0",
+ "resolved": "https://registry.npmjs.org/markdown-it/-/markdown-it-14.3.0.tgz",
+ "integrity": "sha512-RCEsPjR+sr0x+AuYp601tKTkgFG4YEPLCzHST3cQ/fhlJkqAkz1L2/Qbp1j9qw5SBwQHFBoW8+hoN5xssOF0Tw==",
+ "dev": true,
+ "funding": [
+ {
+ "type": "github",
+ "url": "https://github.com/sponsors/puzrin"
+ },
+ {
+ "type": "github",
+ "url": "https://github.com/sponsors/markdown-it"
+ }
+ ],
+ "license": "MIT",
+ "dependencies": {
+ "argparse": "^2.0.1",
+ "entities": "^4.5.0",
+ "linkify-it": "^5.0.2",
+ "mdurl": "^2.0.0",
+ "punycode.js": "^2.3.1",
+ "uc.micro": "^2.1.0"
+ },
+ "bin": {
+ "markdown-it": "bin/markdown-it.mjs"
+ }
+ },
+ "node_modules/markdown-it/node_modules/entities": {
+ "version": "4.5.0",
+ "resolved": "https://registry.npmjs.org/entities/-/entities-4.5.0.tgz",
+ "integrity": "sha512-V0hjH4dGPh9Ao5p0MoRY6BVqtwCjhz6vI5LT8AJ55H+4g9/4vbHx1I54fS0XuclLhDHArPQCiMjDxjaL8fPxhw==",
+ "dev": true,
+ "license": "BSD-2-Clause",
+ "engines": {
+ "node": ">=0.12"
+ },
+ "funding": {
+ "url": "https://github.com/fb55/entities?sponsor=1"
+ }
+ },
"node_modules/mdast-util-to-hast": {
"version": "13.2.1",
"resolved": "https://registry.npmjs.org/mdast-util-to-hast/-/mdast-util-to-hast-13.2.1.tgz",
@@ -1925,6 +1970,13 @@
"url": "https://opencollective.com/unified"
}
},
+ "node_modules/mdurl": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/mdurl/-/mdurl-2.0.0.tgz",
+ "integrity": "sha512-Lf+9+2r+Tdp5wXDXC4PcIBjTDtq4UKjCPMQhKIuzpJNW0b96kVqSwW0bT7FhRSfmAiFYgP+SCRvdrDozfh0U5w==",
+ "dev": true,
+ "license": "MIT"
+ },
"node_modules/micromark-util-character": {
"version": "2.1.1",
"resolved": "https://registry.npmjs.org/micromark-util-character/-/micromark-util-character-2.1.1.tgz",
@@ -2129,6 +2181,16 @@
"url": "https://github.com/sponsors/wooorm"
}
},
+ "node_modules/punycode.js": {
+ "version": "2.3.1",
+ "resolved": "https://registry.npmjs.org/punycode.js/-/punycode.js-2.3.1.tgz",
+ "integrity": "sha512-uxFIHU0YlHYhDQtV4R9J6a52SLx28BCjT+4ieh7IGbgwVJWO+km431c4yRlREUAsAmt/uMjQUyQHNEPf0M39CA==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=6"
+ }
+ },
"node_modules/regex": {
"version": "6.1.0",
"resolved": "https://registry.npmjs.org/regex/-/regex-6.1.0.tgz",
@@ -2310,6 +2372,13 @@
"url": "https://github.com/sponsors/wooorm"
}
},
+ "node_modules/uc.micro": {
+ "version": "2.1.0",
+ "resolved": "https://registry.npmjs.org/uc.micro/-/uc.micro-2.1.0.tgz",
+ "integrity": "sha512-ARDJmphmdvUk6Glw7y9DQ2bFkKBHwQHLi2lsaH6PPmz/Ka9sFOBsBluozhDltWmnv9u/cF6Rt87znRTPV+yp/A==",
+ "dev": true,
+ "license": "MIT"
+ },
"node_modules/unist-util-is": {
"version": "6.0.1",
"resolved": "https://registry.npmjs.org/unist-util-is/-/unist-util-is-6.0.1.tgz",
@@ -2537,6 +2606,23 @@
}
}
},
+ "node_modules/xss": {
+ "version": "1.0.15",
+ "resolved": "https://registry.npmjs.org/xss/-/xss-1.0.15.tgz",
+ "integrity": "sha512-FVdlVVC67WOIPvfOwhoMETV72f6GbW7aOabBC3WxN/oUdoEMDyLz4OgRv5/gck2ZeNqEQu+Tb0kloovXOfpYVg==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "commander": "^2.20.3",
+ "cssfilter": "0.0.10"
+ },
+ "bin": {
+ "xss": "bin/xss"
+ },
+ "engines": {
+ "node": ">= 0.10.0"
+ }
+ },
"node_modules/zwitch": {
"version": "2.0.4",
"resolved": "https://registry.npmjs.org/zwitch/-/zwitch-2.0.4.tgz",
diff --git a/docs/package.json b/docs/package.json
index 3ca1b3e32..bb0d78671 100644
--- a/docs/package.json
+++ b/docs/package.json
@@ -12,6 +12,8 @@
"test:search": "node --experimental-strip-types --test .vitepress/theme/openviking-search-*.test.ts"
},
"devDependencies": {
- "vitepress": "1.6.4"
+ "markdown-it": "^14.3.0",
+ "vitepress": "1.6.4",
+ "xss": "^1.0.15"
}
}