Remove empty <p> tags before and after accordions when paired together in shortcodes
This commit is contained in:
parent
f6aadf4b8e
commit
abe5e13898
|
@ -81,14 +81,13 @@ module.exports = function (eleventyConfig) {
|
||||||
|
|
||||||
// Paired shorcode: Spoiler accordion
|
// Paired shorcode: Spoiler accordion
|
||||||
eleventyConfig.addPairedShortcode('spoiler', (content, hint) => {
|
eleventyConfig.addPairedShortcode('spoiler', (content, hint) => {
|
||||||
|
content = content.trim();
|
||||||
const hintMarkUp = markdownLibrary.renderInline(hint);
|
const hintMarkUp = markdownLibrary.renderInline(hint);
|
||||||
const contentMarkup = markdownLibrary.render(content);
|
const contentMarkup = markdownLibrary.render(content);
|
||||||
return `
|
return `<details class="spoiler-accordion">
|
||||||
<details class="spoiler-accordion">
|
|
||||||
<summary class="spoiler-accordion__hint">${hintMarkUp}</summary>
|
<summary class="spoiler-accordion__hint">${hintMarkUp}</summary>
|
||||||
<div class="spoiler-accordion__spoiler">${contentMarkup}</div>
|
<div class="spoiler-accordion__spoiler">${contentMarkup}</div>
|
||||||
</details>
|
</details>`;
|
||||||
`;
|
|
||||||
});
|
});
|
||||||
|
|
||||||
/* This is the part that tells 11ty to swap to our custom config */
|
/* This is the part that tells 11ty to swap to our custom config */
|
||||||
|
|
Loading…
Reference in New Issue