diff --git a/source/css/_common/components/post/post-body.styl b/source/css/_common/components/post/post-body.styl index 1b62c74..8e0eec2 100644 --- a/source/css/_common/components/post/post-body.styl +++ b/source/css/_common/components/post/post-body.styl @@ -45,7 +45,8 @@ margin-left: 4px; } - .image-caption, .figure .caption { + // For fancybox and pandoc + .image-caption, img + figcaption, .fancybox + figcaption { color: $grey-dark; font-size: $font-size-small; font-weight: bold; diff --git a/source/js/utils.js b/source/js/utils.js index 7567b76..63d72f9 100644 --- a/source/js/utils.js +++ b/source/js/utils.js @@ -49,7 +49,10 @@ NexT.utils = { const imageTitle = $image.attr('title') || $image.attr('alt'); if (imageTitle) { - $imageWrapLink.append(`

${imageTitle}

`); + // Do not append image-caption if pandoc has already created a figcaption + if (!$imageWrapLink.next('figcaption').length) { + $imageWrapLink.append(`

${imageTitle}

`); + } // Make sure img title tag will show correctly in fancybox $imageWrapLink.attr('title', imageTitle).attr('data-caption', imageTitle); }