mirror of
https://github.com/RSS-Bridge/rss-bridge.git
synced 2025-07-14 16:04:42 +02:00
[New Bridge] FiderBridge (#3378)
* [core] Add config parameter to markdownToHtml * [FiderBridge] New bridge
This commit is contained in:
parent
e99e026fa8
commit
d0f7f5e2d8
3 changed files with 158 additions and 2 deletions
14
lib/html.php
14
lib/html.php
|
@ -361,10 +361,22 @@ function stripRecursiveHTMLSection($string, $tag_name, $tag_start)
|
|||
* @link https://parsedown.org/ Parsedown
|
||||
*
|
||||
* @param string $string Input string in Markdown format
|
||||
* @param array $config Parsedown options to control output
|
||||
* @return string output string in HTML format
|
||||
*/
|
||||
function markdownToHtml($string)
|
||||
function markdownToHtml($string, $config = [])
|
||||
{
|
||||
$Parsedown = new Parsedown();
|
||||
foreach ($config as $option => $value) {
|
||||
if ($option === 'breaksEnabled') {
|
||||
$Parsedown->setBreaksEnabled($value);
|
||||
} elseif ($option === 'markupEscaped') {
|
||||
$Parsedown->setMarkupEscaped($value);
|
||||
} elseif ($option === 'urlsLinked') {
|
||||
$Parsedown->setUrlsLinked($value);
|
||||
} else {
|
||||
throw new \InvalidArgumentException("Invalid Parsedown option \"$option\"");
|
||||
}
|
||||
}
|
||||
return $Parsedown->text($string);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue