in docs-sdk/markdown-renderer/src/MarkdownComponents/anchor.tsx [43:88]
function renderXView(
href,
checkHeadings,
scrollToAnchor: () => void,
resolveAppServePath?: (consoleOSId: string) => string,
resolveAppDeps?: (consoleOSId: string) => any,
resolveDemoOpts?: any
) {
let { consoleOSId, servePath: defaultServePath, entryKey } = getInfoFromURL(
href
);
if (!consoleOSId) consoleOSId = "xconsole-demos";
let servePath: string | undefined;
if (typeof resolveAppServePath === "function") {
// 从解析函数获取的servePath,优先级最高
servePath = resolveAppServePath(consoleOSId);
}
if (!servePath)
// fallback到用户在markdown link中手动指定的servePath
servePath =
defaultServePath || "https://dev.g.alicdn.com/xconsole/demos/0.1.1/";
return (
<DemoRoot className="XView-root">
<React.Suspense fallback="Loading...">
<EntryLoader
consoleOSId={consoleOSId}
servePath={servePath}
entryKey={entryKey}
onLoaded={() => {
if (typeof checkHeadings === "function") {
checkHeadings();
scrollToAnchor();
}
}}
markdownOpts={{ embedded: true }}
resolveAppServePath={resolveAppServePath}
resolveAppDeps={resolveAppDeps}
resolveDemoOpts={resolveDemoOpts}
/>
</React.Suspense>
</DemoRoot>
);
}