mirror of
https://github.com/MCCTeam/Minecraft-Console-Client
synced 2026-08-15 13:04:36 +00:00
Fix docs search indexing
Agent-Logs-Url: https://github.com/MCCTeam/Minecraft-Console-Client/sessions/d698c0ee-5e22-482e-a065-7cc71068340a Co-authored-by: milutinke <441903+milutinke@users.noreply.github.com>
This commit is contained in:
parent
858f88d9ec
commit
6456149d39
4 changed files with 1892 additions and 16554 deletions
|
|
@ -16,6 +16,25 @@ import { mainConfig, defaultThemeConfig } from './configs/locales_config.js'
|
|||
|
||||
const isProd = process.env.NODE_ENV === 'production'
|
||||
|
||||
const htmlEntityMap: Record<string, string> = {
|
||||
'&': '&',
|
||||
'<': '<',
|
||||
'>': '>',
|
||||
'"': '"',
|
||||
''': "'",
|
||||
' ': ' ',
|
||||
}
|
||||
|
||||
function normalizeSearchText(text: string): string {
|
||||
return text
|
||||
.replace(/<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi, ' ')
|
||||
.replace(/<style\b[^<]*(?:(?!<\/style>)<[^<]*)*<\/style>/gi, ' ')
|
||||
.replace(/<[^>]+>/g, ' ')
|
||||
.replace(/&(amp|lt|gt|quot|#39|nbsp);/g, (match) => htmlEntityMap[match] ?? ' ')
|
||||
.replace(/\s+/g, ' ')
|
||||
.trim()
|
||||
}
|
||||
|
||||
function vueTemplateTolerantPlugin(): Plugin {
|
||||
let compilerSfc: typeof import('@vue/compiler-sfc') | undefined
|
||||
return {
|
||||
|
|
@ -154,6 +173,10 @@ export default defineUserConfig({
|
|||
searchPlugin({
|
||||
maxSuggestions: 15,
|
||||
hotKeys: ['s', '/'],
|
||||
getExtraFields: (page) => {
|
||||
const content = normalizeSearchText(page.contentRendered)
|
||||
return content ? [content] : []
|
||||
},
|
||||
locales: {
|
||||
'/': {
|
||||
placeholder: 'Search',
|
||||
|
|
|
|||
|
|
@ -3432,7 +3432,7 @@ redirectFrom:
|
|||
|
||||
</div>
|
||||
|
||||
- **Available values:** [Item Type List](https://raw.githubusercontent.com/MCCTeam/Minecraft-Console-Client/master/MinecraftClient/Inventory/ItemType.cs)
|
||||
- **Available values:** [Item Type List](https://github.com/MCCTeam/Minecraft-Console-Client/blob/master/MinecraftClient/Inventory/ItemType.cs)
|
||||
|
||||
- **Type:** `array of strings with item names`
|
||||
|
||||
|
|
|
|||
15420
docs/package-lock.json
generated
15420
docs/package-lock.json
generated
File diff suppressed because it is too large
Load diff
3001
docs/yarn.lock
3001
docs/yarn.lock
File diff suppressed because it is too large
Load diff
Loading…
Add table
Add a link
Reference in a new issue