From aed892a5f87798a951ff0e530e999dba1c3e62c2 Mon Sep 17 00:00:00 2001 From: aftercase <74765798+aftercase@users.noreply.github.com> Date: Fri, 27 Aug 2021 00:59:54 +0100 Subject: [PATCH] Added better greentext function to parsedown Greentext and redtext meme arrows now show using css. --- theme/bulma/css/bulma.min.css | 26 +++++++++++++- vendor/erusev/parsedown/Parsedown.php | 52 ++++++++++++++++----------- 2 files changed, 56 insertions(+), 22 deletions(-) diff --git a/theme/bulma/css/bulma.min.css b/theme/bulma/css/bulma.min.css index 6bd0cee..da5fd35 100644 --- a/theme/bulma/css/bulma.min.css +++ b/theme/bulma/css/bulma.min.css @@ -1,4 +1,28 @@ -.btn1 { +greentext:before { + content:">"; + float: left; +} +redtext:before { + content:"<"; + float: left; +} +purpletext:before { + content:"@"; + float: left; +} + + +.content greentext { + color: #789922; + content: ">"; +} + +.content redtext { + color: #d12222; +} + +.content purpletext { + color: #9f14ae; } html { diff --git a/vendor/erusev/parsedown/Parsedown.php b/vendor/erusev/parsedown/Parsedown.php index 1b9d6d5..077a5e0 100644 --- a/vendor/erusev/parsedown/Parsedown.php +++ b/vendor/erusev/parsedown/Parsedown.php @@ -121,14 +121,15 @@ class Parsedown '8' => array('List'), '9' => array('List'), ':' => array('Table'), - '<' => array('Comment', 'Markup'), + '<' => array('Comment', 'Markup','Redtext'), '=' => array('SetextHeader'), - '>' => array('Quote'), + '>' => array('Greentext'), '[' => array('Reference'), '_' => array('Rule'), '`' => array('FencedCode'), '|' => array('Table'), '~' => array('FencedCode'), + '@' => array('Purpletext'), ); # ~ @@ -652,13 +653,13 @@ class Parsedown # # Quote - protected function blockQuote($Line) + protected function blockGreentext($Line) { if (preg_match('/^>[ ]?(.*)/', $Line['text'], $matches)) { $Block = array( 'element' => array( - 'name' => 'blockquote', + 'name' => 'greentext', 'handler' => 'lines', 'text' => (array) $matches[1], ), @@ -668,29 +669,38 @@ class Parsedown } } - protected function blockQuoteContinue($Line, array $Block) + protected function blockRedtext($Line) { - if ($Line['text'][0] === '>' and preg_match('/^>[ ]?(.*)/', $Line['text'], $matches)) + if (preg_match('/^<[ ]?(.*)/', $Line['text'], $matches)) { - if (isset($Block['interrupted'])) - { - $Block['element']['text'] []= ''; - - unset($Block['interrupted']); - } - - $Block['element']['text'] []= $matches[1]; - - return $Block; - } - - if ( ! isset($Block['interrupted'])) - { - $Block['element']['text'] []= $Line['text']; + $Block = array( + 'element' => array( + 'name' => 'Redtext', + 'handler' => 'lines', + 'text' => (array) $matches[1], + ), + ); return $Block; } } + + protected function blockPurpletext($Line) + { + if (preg_match('/^@[ ]?(.*)/', $Line['text'], $matches)) + { + $Block = array( + 'element' => array( + 'name' => 'purpletext', + 'handler' => 'lines', + 'text' => (array) $matches[1], + ), + ); + + return $Block; + } + } + # # Rule