mirror of
https://github.com/next-theme/hexo-theme-next.git
synced 2026-01-19 18:42:34 +00:00
Fix image caption generated by pandoc with fancybox enabled
This commit is contained in:
parent
e410399aac
commit
c377515fd7
@ -45,7 +45,8 @@
|
|||||||
margin-left: 4px;
|
margin-left: 4px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.image-caption, .figure .caption {
|
// For fancybox and pandoc
|
||||||
|
.image-caption, img + figcaption, .fancybox + figcaption {
|
||||||
color: $grey-dark;
|
color: $grey-dark;
|
||||||
font-size: $font-size-small;
|
font-size: $font-size-small;
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
|
|||||||
@ -49,7 +49,10 @@ NexT.utils = {
|
|||||||
|
|
||||||
const imageTitle = $image.attr('title') || $image.attr('alt');
|
const imageTitle = $image.attr('title') || $image.attr('alt');
|
||||||
if (imageTitle) {
|
if (imageTitle) {
|
||||||
$imageWrapLink.append(`<p class="image-caption">${imageTitle}</p>`);
|
// Do not append image-caption if pandoc has already created a figcaption
|
||||||
|
if (!$imageWrapLink.next('figcaption').length) {
|
||||||
|
$imageWrapLink.append(`<p class="image-caption">${imageTitle}</p>`);
|
||||||
|
}
|
||||||
// Make sure img title tag will show correctly in fancybox
|
// Make sure img title tag will show correctly in fancybox
|
||||||
$imageWrapLink.attr('title', imageTitle).attr('data-caption', imageTitle);
|
$imageWrapLink.attr('title', imageTitle).attr('data-caption', imageTitle);
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user