Skip to content

Commit

Permalink
Fix bug with callout block rendering
Browse files Browse the repository at this point in the history
  • Loading branch information
Ole Eskild Steensen committed Apr 13, 2022
1 parent 43a42a7 commit ce3cbed
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions .eleventy.js
Original file line number Diff line number Diff line change
Expand Up @@ -151,10 +151,15 @@ module.exports = function(eleventyConfig) {


eleventyConfig.addTransform('callout-block', function(str) {
return str && str.replace(/<blockquote>((.|\n)*)<\/blockquote>/g, function(match, content) {
return str && str.replace(/<blockquote>((.|\n)*?)<\/blockquote>/g, function(match, content) {
let titleDiv = "";
let calloutType = "";
content = content.replace(/\[!(\w*)\](\s?.*)/g, function(metaInfoMatch, callout, title) {
const calloutMeta = /\[!(\w*)\](\s?.*)/g;
if(!content.match(calloutMeta)){
return match;
}

content = content.replace(calloutMeta, function(metaInfoMatch, callout, title) {
calloutType = callout;
titleDiv = title.replace("<br>", "") ?
`<div class="admonition-title">${title}</div>` :
Expand Down

0 comments on commit ce3cbed

Please sign in to comment.