diff --git a/app/index.html b/app/index.html index 0c47c25..1cb851f 100644 --- a/app/index.html +++ b/app/index.html @@ -956,7 +956,8 @@ body { const svg = getIcon(name); const span = document.createElement('span'); span.className = 'mdcms-icon' + (className ? ' ' + className : ''); - span.innerHTML = svg || ''; + const filename = normaliseIconName(name); + span.innerHTML = svg || '[missing: ' + filename + ']'; return span; } @@ -1815,7 +1816,6 @@ function fmtDatetime(dtStr) { }; function renderCalloutTag(container, tag) { - console.log('[mdcms callout] tag:', tag.tagName, '| options:', JSON.stringify(tag.options), '| body:', (tag.body || '').slice(0, 60)); var typeMatch = tag.tagName.match(/^callout-(info|warning|success|error)$/); var calloutType = typeMatch ? typeMatch[1] : 'info'; @@ -1824,7 +1824,6 @@ function fmtDatetime(dtStr) { var title = opts.title || null; var iconName = opts.icon || null; var bodyMd = tag.body || ''; - console.log('[mdcms callout] title =', JSON.stringify(title), '| msgKey =', msgKey); // Resolve message: key — config.yml callouts block if (msgKey) { @@ -1863,17 +1862,14 @@ function fmtDatetime(dtStr) { container.style.setProperty('--callout-bg', hexToRgba(bgColour, 0.08)); if (title) { - console.log('[mdcms callout] creating title row:', title); var titleRow = document.createElement('div'); titleRow.className = 'mdcms-callout-title'; - titleRow.style.color = primaryColour; // bypass CSS var cascade + titleRow.style.color = primaryColour; titleRow.appendChild(iconEl(iconName)); var titleText = document.createElement('span'); titleText.textContent = title; titleRow.appendChild(titleText); container.appendChild(titleRow); - } else { - console.log('[mdcms callout] no title — skipping title row'); } if (bodyMd) { diff --git a/app/pages/home.md b/app/pages/home.md index d076ea1..3ed6b63 100644 --- a/app/pages/home.md +++ b/app/pages/home.md @@ -68,10 +68,36 @@ This info callout uses the warning icon instead of the default info icon. ## Config-defined message (message: key) -```mdcms callout-warning +The callout below uses `message: aitranslation` to pull its title and body from the `callouts:` block in `config.yml`. The type (`warning`) also comes from the config entry, not the tag name. + +```mdcms callout-info message: aitranslation ``` --- +## message: overrides inline content + +When `message:` is present, any inline `title:` or body text is ignored. A warning should appear in the browser console. + +```mdcms callout-info +message: aitranslation +title: This title should be ignored +This body text should also be ignored. Check the console for a warning. +``` + +--- + +## Missing icon + +This callout uses a non-existent icon name. A broken image should appear where the icon would be. + +```mdcms callout-info +title: Custom icon that does not exist +icon: nonexistent_icon +The icon to the left of this title should show as a broken image. +``` + +--- + Toggle dark mode and check all four callout types still look correct.