From 9f1874345ad02af000e076a4e85f63ed1054fa19 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stefan=20Bj=C3=B6rk?= Date: Thu, 12 Dec 2019 15:52:42 +0100 Subject: [PATCH] Images with nonempty alt text, occurring by itself in a paragraph, will be rendered as figure with a caption, like pandoc's markdown (see ). This is controlled with a new configuration option `fig.captions`. --- system/includes/functions.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/system/includes/functions.php b/system/includes/functions.php index 1237111..a74df82 100644 --- a/system/includes/functions.php +++ b/system/includes/functions.php @@ -360,6 +360,11 @@ function get_posts($posts, $page = 1, $perpage = 0) // Get the contents and convert it to HTML $post->body = MarkdownExtra::defaultTransform(remove_html_comments($content)); + // Convert image tags to figures + if (config('fig.captions') == 'true') { + $post->body = preg_replace( '/

()<\/p>/', '

$1
$2
', $post->body ); + } + if (config('views.counter') == 'true') { $post->views = get_views($post->file); } else {