parser-parsedown: add markdown support to image captions

This commit is contained in:
Starbeamrainbowlabs 2020-04-21 21:56:31 +01:00
parent a1b962a7b5
commit 8278cd052b
Signed by: sbrl
GPG Key ID: 1BE5172E637709C2
2 changed files with 6 additions and 4 deletions

View File

@ -21,6 +21,7 @@ This file holds the changelog for Pepperminty Wiki. This is the master list of t
- A command-line interface!
- Wiki administrators with terminal/console access can now make use of a brand-new CLI by executing `php ./index.php` (warning: strange things will happen if the current working directory is not the directory that contains index.php and peppermint.json)
- Added new `anoncomments` setting to control whether anonymous users are allowed to make comments (disabled by default) - thanks to @SeanFromIT for suggesting it in #181
- Added markdown support for media captions (#184)
### Fixed
- Fixed weighted word support on search query analysis debug page

View File

@ -1,7 +1,7 @@
<?php
register_module([
"name" => "Parsedown",
"version" => "0.10.1",
"version" => "0.10.2",
"author" => "Emanuil Rusev & Starbeamrainbowlabs",
"description" => "An upgraded (now default!) parser based on Emanuil Rusev's Parsedown Extra PHP library (https://github.com/erusev/parsedown-extra), which is licensed MIT. Please be careful, as this module adds some weight to your installation.",
"extra_data" => [
@ -893,8 +893,8 @@ class PeppermintParsedown extends ParsedownExtreme
if($param1 !== false && strtolower(trim($param1)) == "caption")
$imageCaption = true;
if($param2 !== false && strtolower(trim($param2)) == "caption")
$imageCaption = true;
if($param2 !== false && strtolower(trim($param2)) == "caption")
$imageCaption = true;
if($param3 !== false && strtolower(trim($param3)) == "caption")
$imageCaption = true;
@ -993,7 +993,8 @@ class PeppermintParsedown extends ParsedownExtreme
$result["element"],
[
"name" => "figcaption",
"text" => $altText
// rawHtml is fine here 'cause we're using the output of $this->text(), which is safe
"rawHtml" => $this->text($altText),
],
],
"handler" => "elements"