mirror of
https://github.com/MCCTeam/Minecraft-Console-Client
synced 2026-08-15 13:04:36 +00:00
[skipci]Merge pull request #3110 from MCCTeam/copilot/fix-search-index-details-tag
Index collapsed docs content in site search and fix the ItemType source link
This commit is contained in:
commit
75f8f29d1a
2 changed files with 24 additions and 1 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`
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue