--- // FileExample.astro - Static file display component with syntax highlighting import Prism from 'prismjs'; import 'prismjs/components/prism-python'; import 'prismjs/components/prism-typescript'; import 'prismjs/components/prism-javascript'; import 'prismjs/components/prism-jsx'; import 'prismjs/components/prism-tsx'; import 'prismjs/components/prism-docker'; import 'prismjs/components/prism-yaml'; import 'prismjs/components/prism-json'; import 'prismjs/components/prism-markup'; import 'prismjs/components/prism-css'; import 'prismjs/components/prism-sql'; import 'prismjs/components/prism-bash'; import 'prismjs/components/prism-markdown'; interface Props { filename: string; content: string; language: string; description?: string; tags?: string[]; id: string; } const { filename, content, language, id } = Astro.props; const safeId = String(id).replace(/[^a-zA-Z0-9_-]/g, ''); const headerId = `file-example-header-${safeId}`; const contentId = `file-example-content-${safeId}`; const fileExtension = filename.split('.').pop() || language; const prismLanguageMap: Record = { py: 'python', ts: 'typescript', tsx: 'tsx', js: 'javascript', jsx: 'jsx', dockerfile: 'docker', docker: 'docker', yml: 'yaml', yaml: 'yaml', json: 'json', html: 'markup', css: 'css', sql: 'sql', sh: 'bash', bash: 'bash', md: 'markdown', }; const prismLanguage = prismLanguageMap[fileExtension] || 'markup'; const highlightedCode = Prism.highlight( content, Prism.languages[prismLanguage] || Prism.languages.markup, prismLanguage, ); ---