MCPcopy
hub / github.com/shareAI-lab/learn-claude-code / DocRenderer

Function DocRenderer

web/src/components/docs/doc-renderer.tsx:65–95  ·  view source on GitHub ↗
({ version }: DocRendererProps)

Source from the content-addressed store, hash-verified

63}
64
65export function DocRenderer({ version }: DocRendererProps) {
66 const locale = useLocale();
67
68 const doc = useMemo(() => {
69 const match = docsData.find(
70 (d: { version: string; locale: string }) =>
71 d.version === version && d.locale === locale
72 );
73 if (match) return match;
74 return docsData.find(
75 (d: { version: string; locale: string }) =>
76 d.version === version && d.locale === "en"
77 );
78 }, [version, locale]);
79
80 if (!doc) return null;
81
82 const html = useMemo(() => {
83 const raw = renderMarkdown(doc.content);
84 return postProcessHtml(raw);
85 }, [doc.content]);
86
87 return (
88 <div className="py-4">
89 <div
90 className="prose-custom"
91 dangerouslySetInnerHTML={{ __html: html }}
92 />
93 </div>
94 );
95}

Callers

nothing calls this directly

Calls 3

useLocaleFunction · 0.90
renderMarkdownFunction · 0.85
postProcessHtmlFunction · 0.85

Tested by

no test coverage detected