-
Notifications
You must be signed in to change notification settings - Fork 335
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
194 additions
and
169 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
import { defineConfig } from 'vitepress' | ||
|
||
// https://vitepress.dev/reference/site-config | ||
export default defineConfig({ | ||
locales: { | ||
root: { | ||
label: '简体中文', | ||
lang: 'zh-CN', | ||
title: 'Twikoo 文档', | ||
description: 'Twikoo 文档', | ||
themeConfig: { | ||
sidebar: [ | ||
{ text: '简介', link: '/' }, | ||
{ text: '快速上手', link: '/quick-start' }, | ||
{ text: '常见问题', link: '/faq' }, | ||
{ text: 'API 文档', link: '/api' }, | ||
{ text: '相关文档', link: '/link' } | ||
] | ||
} | ||
}, | ||
en: { | ||
label: 'English (US)', | ||
lang: 'en', | ||
link: '/en/', | ||
title: 'Twikoo Docs', | ||
description: 'Twikoo Docs', | ||
themeConfig: { | ||
sidebar: [ | ||
{ text: 'Introduction', link: '/en/' }, | ||
{ text: 'Quick start', link: '/en/quick-start' }, | ||
{ text: 'FAQ', link: '/en/faq' }, | ||
{ text: 'API', link: '/en/api' } | ||
] | ||
} | ||
} | ||
}, | ||
themeConfig: { | ||
search: { | ||
provider: 'algolia', | ||
options: { | ||
appId: 'TM627WNO90', | ||
apiKey: 'f81194a47bc4be7984df25fc480c60a7', | ||
indexName: 'twikoo' | ||
} | ||
}, | ||
socialLinks: [ | ||
{ icon: 'github', link: 'https://github.com/imaegoo/twikoo' } | ||
], | ||
editLink: { | ||
pattern: 'https://github.com/imaegoo/twikoo/edit/main/docs/:path' | ||
} | ||
}, | ||
lastUpdated: true | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
<script setup> | ||
import { ref, onMounted } from 'vue' | ||
import { useRouter } from 'vitepress' | ||
import DefaultTheme from 'vitepress/theme' | ||
const { Layout } = DefaultTheme | ||
const envId = 'https://twikoo.vercel.app' | ||
const twikooJs = ref(null) | ||
const router = useRouter() | ||
function initTwikoo () { | ||
try { | ||
twikoo.init({ | ||
envId, | ||
onCommentLoaded: initLightGallery | ||
}) | ||
} catch (e) {} | ||
} | ||
function initLightGallery () { | ||
// This function is compiled to ES5 | ||
var commentContents = document.getElementsByClassName('tk-content'); | ||
for (var i = 0; i < commentContents.length; i++) { | ||
var commentItem = commentContents[i]; | ||
var imgEls = commentItem.getElementsByTagName('img'); | ||
if (imgEls.length > 0) { | ||
for (var j = 0; j < imgEls.length; j++) { | ||
var imgEl = imgEls[j]; | ||
var aEl = document.createElement('a'); | ||
aEl.setAttribute('class', 'tk-lg-link'); | ||
aEl.setAttribute('href', imgEl.getAttribute('src')); | ||
aEl.setAttribute('data-src', imgEl.getAttribute('src')); | ||
aEl.appendChild(imgEl.cloneNode(false)); | ||
imgEl.parentNode.insertBefore(aEl, imgEl.nextSibling); | ||
imgEl.remove(); | ||
} | ||
lightGallery(commentItem, { | ||
selector: '.tk-lg-link', | ||
share: false | ||
}) | ||
} | ||
} | ||
} | ||
function initJs () { | ||
if (twikooJs.value) { | ||
twikooJs.value.onload = initTwikoo | ||
router.onAfterRouteChanged = onRoute | ||
} | ||
} | ||
function onRoute (to) { | ||
if (to) setTimeout(initTwikoo, 1000) | ||
} | ||
onMounted(() => { | ||
initTwikoo() | ||
initJs() | ||
}) | ||
</script> | ||
|
||
<template> | ||
<Layout> | ||
<template #doc-after> | ||
<div class="comment-container"> | ||
<!-- KaTeX --> | ||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/dist/katex.min.css" integrity="sha384-AfEj0r4/OFrOo5t7NnNe46zW/tFgW6x/bCJG8FqQCEo3+Aro6EYUG4+cU+KJWu/X" crossorigin="anonymous"> | ||
<component :is="'script'" defer src="https://cdn.jsdelivr.net/npm/[email protected]/dist/katex.min.js" integrity="sha384-g7c+Jr9ZivxKLnZTDUhnkOnsh30B4H0rpLUpJ4jAIKs4fnJI+sEnkvrMWph2EDg4" crossorigin="anonymous"></component> | ||
<component :is="'script'" defer src="https://cdn.jsdelivr.net/npm/[email protected]/dist/contrib/auto-render.min.js" integrity="sha384-mll67QQFJfxn0IYznZYonOWZ644AWYC+Pt2cHqMaRhXVrursRwvLnLaebdGIlYNa" crossorigin="anonymous"></component> | ||
|
||
<!-- lightGallery --> | ||
<link rel="stylesheet" href="https://cdn.staticfile.org/lightgallery/2.1.8/css/lightgallery.css"> | ||
<component :is="'script'" src="https://cdn.staticfile.org/lightgallery/2.1.8/lightgallery.min.js"></component> | ||
|
||
<!-- Twikoo --> | ||
<div id="twikoo"></div> | ||
<component :is="'script'" src="https://cdn.jsdelivr.net/npm/[email protected]/dist/twikoo.all.min.js" ref="twikooJs"></component> | ||
</div> | ||
</template> | ||
</Layout> | ||
</template> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import DefaultTheme from 'vitepress/theme' | ||
import Layout from './Layout.vue' | ||
|
||
export default { | ||
...DefaultTheme, | ||
// override the Layout with a wrapper component that | ||
// injects the slots | ||
Layout | ||
} |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.