import type { RuntimeConfig } from '../../types.ts' import { editorClassName } from '../../utilities/editor-size.ts' import { renderFooterInfo, renderSocialList } from './chrome.ts' interface ShellOptions { body: string config: RuntimeConfig sidebarEnabled: boolean tocEnabled: boolean sidebar?: string mobileSidebar?: string } interface AsideOptions { config: RuntimeConfig toc: string } interface ShellContextOptions { config: RuntimeConfig sidebarEnabled: boolean tocEnabled: boolean header?: string headerDocNav?: string sidebar?: string mobileSidebar?: string prevNext?: string } function renderSidebar(sidebarEnabled: boolean, sidebar = ''): string { return sidebarEnabled && sidebar ? ` ` : '' } function renderToc(tocEnabled: boolean): string { return tocEnabled ? '
' : '' } function renderAside({ config, toc }: AsideOptions): string { return toc || config.aside?.html ? ` ` : '' } export function renderPageShell({ body, config, sidebarEnabled, tocEnabled, sidebar = '', mobileSidebar = '', }: ShellOptions): string { const sidebarHtml = renderSidebar(sidebarEnabled, sidebar) const toc = renderToc(tocEnabled) const aside = renderAside({ config, toc }) const hasAside = Boolean(aside) const editorClass = editorClassName(config) const footerInfo = renderFooterInfo(config) const socialList = renderSocialList(config) return `${mobileSidebar}