diff --git a/.eleventy.js b/.eleventy.js index 003b3ac..b04f10c 100644 --- a/.eleventy.js +++ b/.eleventy.js @@ -183,28 +183,30 @@ module.exports = function(eleventyConfig) { let titleDiv = ""; let calloutType = ""; - const calloutMeta = /\[!(\w*)\](\s?.*)/; + let isCollapsable; + let isCollapsed; + const calloutMeta = /\[!(\w*)\](\+|\-){0,1}(\s?.*)/; if (!content.match(calloutMeta)) { continue; } - content = content.replace(calloutMeta, function(metaInfoMatch, callout, title) { + content = content.replace(calloutMeta, function(metaInfoMatch, callout, collapse, title) { + isCollapsable = Boolean(collapse); + isCollapsed = collapse === "-" + const titleText = title.replace(/(<\/{0,1}\w+>)/, "") ? title : `${callout.charAt(0).toUpperCase()}${callout.substring(1).toLowerCase()}` + const fold = isCollapsable ? `
` : `` + calloutType = callout; - titleDiv = title.replace("
", "") ? - `
${title}
` : - `
${callout.charAt(0).toUpperCase()}${callout.substring(1).toLowerCase()}
`; + titleDiv = `
${titleText}
${fold}
` return ""; }); blockquote.tagName = "div"; - blockquote.classList.add( - `callout-${calloutType.toLowerCase()}`, - "admonition", - "admonition-example", - "admonition-plugin", - ); + blockquote.classList.add("callout"); + blockquote.classList.add(isCollapsable ? "is-collapsible" : "") + blockquote.classList.add(isCollapsed ? "is-collapsed" : "") blockquote.setAttribute("data-callout", calloutType.toLowerCase()); - blockquote.innerHTML = `${titleDiv}\n${content}`; + blockquote.innerHTML = `${titleDiv}\n
${content}
`; } } diff --git a/src/site/_includes/components/pageheader.njk b/src/site/_includes/components/pageheader.njk index 802ed4e..7e18f05 100644 --- a/src/site/_includes/components/pageheader.njk +++ b/src/site/_includes/components/pageheader.njk @@ -1,5 +1,42 @@ + +