fix: 修复相对路径 @see 链接跳转

This commit is contained in:
2026-03-18 13:46:17 +08:00
parent c5649b3eba
commit d5290c3cfc
2 changed files with 3 additions and 3 deletions

View File

@@ -46,7 +46,7 @@ export const ApiDocViewer = () => {
}, [])
const handleReferenceClick = useCallback((ref: string) => {
const normalizedRef = ref.replace('.md', '')
const normalizedRef = ref.replace('.md', '').replace(/^\.\.\//, '')
const allFiles = Object.keys(DOCS_FILES)
const match = allFiles.find(f => f.replace('.md', '') === normalizedRef)
if (match) {

View File

@@ -116,9 +116,9 @@ const Section = ({ section, onReferenceClick }: SectionProps) => {
const TextContent = ({ text, onReferenceClick }: { text: string; onReferenceClick: (ref: string) => void }) => {
const renderText = () => {
const parts = text.split(/(@see\s+\S+)/g)
const parts = text.split(/(@see\s+[^\s]+)/g)
return parts.map((part, idx) => {
const match = part.match(/@see\s+(\S+)/)
const match = part.match(/@see\s+([^\s]+)/)
if (match) {
return (
<button