<%# --------------------------------------------------------------- # docmd : the zero-config documentation engine. # Site-wide announcement banner. # # Rendered when `config.layout.banner` is set. Sits above the menubar # (or above the sidebar's logo bar when menubar is in-header). The # banner is purely presentational — the inner content is rendered as # raw HTML so authors can include links and inline emphasis. # # Configuration: # { # "layout": { # "banner": { # "content": "**v0.9 ships Friday** — read the announcement.", # "type": "info", // "info" | "success" | "warning" | "danger" # "dismissible": true, // user can close per-session # "link": { "text": "Read more", "url": "/blog/v0-9" }, # "icon": "megaphone" // lucide icon name (optional) # } # } # } # # The `dismissible` choice is stored in `sessionStorage` so the banner # reappears on a fresh visit but stays dismissed for the current # browsing session. # --------------------------------------------------------------- %> <% const banner = (typeof config !== 'undefined' && config.layout && config.layout.banner) || null; %> <% if (banner && (banner.content || banner.link)) { %> <% const _bType = banner.type || 'info'; const _bDismissible = banner.dismissible !== false; const _bIcon = banner.icon || null; const _bLink = banner.link || null; // Lightweight inline-MD: only **bold** and `code` get a pass-through here. // For richer content, set banner.html to a raw HTML string. let _bInner = banner.html || banner.content || ''; if (!banner.html) { _bInner = _bInner .replace(/&/g, '&') .replace(//g, '>') .replace(/\*\*([^*]+)\*\*/g, '$1') .replace(/`([^`]+)`/g, '$1'); // Restore if user provided `link` — leave that to the template. } %>
<% if (_bIcon) { %> <% } %> <% if (_bDismissible) { %> <% } %>
<% } %>