### Custom Container Examples (Markdown) Source: https://github.com/keiyoushi/keiyoushi.github.io/blob/main/website/sandbox/markdown-examples.md Illustrates the usage of custom container markdown syntax in VitePress. These containers allow for visually distinct blocks like info, tip, warning, danger, and details. They are defined using ::: followed by the type and content, ending with :::. ```markdown ::: info This is an info box. ::: ::: tip This is a tip. ::: ::: warning This is a warning. ::: ::: danger This is a dangerous warning. ::: ::: details This is a details block. ::: ``` -------------------------------- ### Access Site, Theme, and Page Data with useData() in Vue Source: https://github.com/keiyoushi/keiyoushi.github.io/blob/main/website/sandbox/api-examples.md This example demonstrates using the `useData()` hook within a Vue component to retrieve site, theme, page, and frontmatter data. It requires importing `useData` from 'vitepress'. The results are displayed in preformatted text tags. ```vue ## Results ### Theme Data
{{ theme }}
### Page Data
{{ page }}
### Page Frontmatter
{{ frontmatter }}
``` -------------------------------- ### Syntax Highlighting with Line Highlighting (JavaScript) Source: https://github.com/keiyoushi/keiyoushi.github.io/blob/main/website/sandbox/markdown-examples.md Demonstrates syntax highlighting for JavaScript code with a specific line highlighted. This feature is powered by Shikiji and integrated into VitePress. It takes markdown code blocks as input and renders them with specified line highlighting. ```javascript export default { data () { return { msg: 'Highlighted!' } } } ``` -------------------------------- ### Access Site, Theme, and Page Data with useData() in Markdown Source: https://github.com/keiyoushi/keiyoushi.github.io/blob/main/website/sandbox/api-examples.md This snippet shows how to use the `useData()` hook within a Markdown file to access theme, page, and frontmatter data. It requires importing `useData` from 'vitepress'. The output displays the retrieved data. ```markdown ## Results ### Theme Data
{{ theme }}
### Page Data
{{ page }}
### Page Frontmatter
{{ frontmatter }}
``` -------------------------------- ### Extension Repository Constants in TypeScript Source: https://context7.com/keiyoushi/keiyoushi.github.io/llms.txt Defines constants for GitHub repository URLs used to fetch extension data and APK files. These constants are crucial for constructing correct URLs for extension icons and APK downloads. The code includes usage examples for clarity. ```typescript export const GITHUB_EXTENSION_REPO = 'keiyoushi/extensions'; export const GITHUB_EXTENSION_BASE = `https://raw.githubusercontent.com/${GITHUB_EXTENSION_REPO}/repo`; export const GITHUB_EXTENSION_JSON = `${GITHUB_EXTENSION_BASE}/index.json`; export const GITHUB_EXTENSION_MIN_JSON = `${GITHUB_EXTENSION_BASE}/index.min.json`; export const JSDELIVR_EXTENSION_MIN_JSON = `https://cdn.jsdelivr.net/gh/${GITHUB_EXTENSION_REPO}@repo/index.min.json`; // Usage example - constructing URLs for extension assets: const extensionPkg = 'eu.kanade.tachiyomi.extension.en.mangadex'; const iconUrl = `${GITHUB_EXTENSION_BASE}/icon/${extensionPkg}.png`; // Result: https://raw.githubusercontent.com/keiyoushi/extensions/repo/icon/eu.kanade.tachiyomi.extension.en.mangadex.png const apkName = 'tachiyomi-en.mangadex-v1.4.2.apk'; const apkUrl = `${GITHUB_EXTENSION_BASE}/apk/${apkName}`; // Result: https://raw.githubusercontent.com/keiyoushi/extensions/repo/apk/tachiyomi-en.mangadex-v1.4.2.apk ``` -------------------------------- ### Add Repository Page with Deep Linking Source: https://context7.com/keiyoushi/keiyoushi.github.io/llms.txt Handles redirection for the 'add-repo' page. It detects Android users and redirects them to add an extension repository via a deep link to the Mihon/Tachiyomi app. Non-Android users are shown a message with a manual link. ```vue ``` -------------------------------- ### Vue.js Script for Adding Repository (TypeScript) Source: https://github.com/keiyoushi/keiyoushi.github.io/blob/main/website/add-repo.md This script, written in Vue.js with TypeScript, handles the logic for adding a repository. It checks for Android devices, constructs the appropriate URL, and attempts to redirect the user to the Mihon app. It also includes fallback mechanisms and validation for official repositories. ```typescript import { onMounted, ref } from "vue"; import { GITHUB_EXTENSION_MIN_JSON, JSDELIVR_EXTENSION_MIN_JSON } from "./.vitepress/config/constants"; const isAndroid = ref(true); const url = ref(GITHUB_EXTENSION_MIN_JSON); const officialRepos = [GITHUB_EXTENSION_MIN_JSON, JSDELIVR_EXTENSION_MIN_JSON] onMounted(() => { isAndroid.value = !!navigator.userAgent.match(/android/i); const urlParm = new URLSearchParams(window.location.search).get("url") || GITHUB_EXTENSION_MIN_JSON; const encodedUrl = encodeURIComponent(urlParm); if (!officialRepos.includes(urlParm)) { window.location.replace("/"); return; } url.value = urlParm if (isAndroid.value) { window.goatcounter?.count?.({ path: "/#add-to-tachiyomi", title: "Add extension repository", }); window.location.replace(`tachiyomi://add-repo?url=${encodedUrl}`); } }); ``` -------------------------------- ### VitePress Configuration for Keiyoushi Website Source: https://context7.com/keiyoushi/keiyoushi.github.io/llms.txt Configures the VitePress site, including theme settings, navigation, search, and markdown plugins. It utilizes Vue 3, TypeScript, and Element Plus components for a rich user experience. Dependencies include markdown-it plugins for enhanced markdown features. ```typescript import { defineConfig, loadEnv } from 'vitepress' import { attrs } from '@mdit/plugin-attrs'; import { figure } from '@mdit/plugin-figure'; import { imgSize } from '@mdit/plugin-img-size'; import { tabsMarkdownPlugin } from 'vitepress-plugin-tabs'; import shortcodePlugin from 'markdown-it-shortcode-tag'; import shortcodes from './config/shortcodes'; const env = loadEnv('', process.cwd()); const hostname: string = env.VITE_HOSTNAME || 'http://localhost:4173'; export default defineConfig({ title: "Keiyoushi", description: "An unofficial repository of extensions for Tachiyomi and variants.", cleanUrls: true, themeConfig: { nav: [ { text: 'Add repo', link: '/add-repo' }, { text: 'Guide', link: '/docs/guides/getting-started' }, { text: 'Extensions', link: '/extensions/' }, ], sidebar: { '/docs/': [ { text: 'Extensions', link: '/extensions/' }, { text: 'Guides', items: [ { text: 'Getting started', link: '/docs/guides/getting-started' }, { text: 'Troubleshooting', link: '/docs/guides/troubleshooting' }, ], }, ], }, search: { provider: 'local' }, socialLinks: [ { icon: 'github', link: 'https://github.com/keiyoushi/extensions' }, { icon: 'discord', link: 'https://discord.gg/3FbCpdKbdY' }, ], }, markdown: { config: (md) => { md.use(attrs) .use(figure) .use(imgSize) .use(tabsMarkdownPlugin) .use(shortcodePlugin, shortcodes); } }, }) ``` -------------------------------- ### TypeScript Navigation Shortcodes for Markdown Source: https://context7.com/keiyoushi/keiyoushi.github.io/llms.txt Custom markdown shortcodes implemented in TypeScript to render application navigation paths with icons. This allows documentation to intuitively reference in-app navigation structures. It uses a mapping of navigation keys to names, icons, and dependencies to build hierarchical paths. ```typescript // website/.vitepress/config/shortcodes.ts const navigationMappings: Record = { // Main navigation 'main_library': { name: 'Library', icon: bookmarkBoxOutline }, 'main_browse': { name: 'Browse', icon: compassOutline }, 'main_more': { name: 'More', icon: dotsHorizontal }, // Browse submenu 'extensions': { name: 'Extensions', dependsOn: 'main_browse' }, 'migrate': { name: 'Migrate', dependsOn: 'main_browse' }, // More > Settings submenu 'settings': { name: 'Settings', icon: cog, dependsOn: 'main_more' }, 'advanced': { name: 'Advanced', icon: codeTags, dependsOn: 'settings' }, 'browse': { name: 'Browse', icon: compassOutline, dependsOn: 'settings' }, 'extension-repos': { name: 'Extension repos / Edit repos', dependsOn: 'browse' }, } function generateNavigationHtml(navKey: string) { const navData = navigationMappings[navKey] if (!navData) return 'Unsupported Navigation!' const { name, icon, dependsOn } = navData let html = `${icon ?? ''}${name}` if (dependsOn) { html = `${generateNavigationHtml(dependsOn)} -> ${html}` } return html } const shortcodes = { nav: { render({ to }) { return generateNavigationHtml(to) }, }, } // Usage in markdown: // Navigate to