diff --git a/app/Helpers/BBCodeConverter.php b/app/Helpers/BBCodeConverter.php index e3d78e3a0d..35dbf1af6b 100644 --- a/app/Helpers/BBCodeConverter.php +++ b/app/Helpers/BBCodeConverter.php @@ -316,9 +316,22 @@ function ($matches) { */ protected function replaceSpoilers() { - $this->text = \preg_replace_callback('#\[spoiler\]([\W\D\w\s]*?)\[/spoiler\]#iu', + $this->text = \preg_replace_callback('#\[spoiler\](.*?)\[\/spoiler\]#ius', - fn ($matches) => '
Spoiler!
'.\trim($matches[1], ' ').'
', + fn ($matches) => '

Spoiler
'.\trim($matches[1]).'

', + + $this->text + ); + } + + /** + * @brief Replace BBCode named spoiler. + */ + protected function replaceNamedSpoilers() + { + $this->text = \preg_replace_callback('#\[spoiler\=(.*?)\](.*?)\[\/spoiler\]#ius', + + fn ($matches) => '

'.\trim($matches[1]).'
'.\trim($matches[2]).'

', $this->text ); @@ -408,6 +421,7 @@ public function toMarkdown() $this->replaceQuotes(); $this->replaceSnippets(); $this->replaceSpoilers(); + $this->replaceNamedSpoilers(); $this->replaceColor(); $this->replaceVideo(); $this->replaceYoutube(); diff --git a/resources/sass/main/_custom.scss b/resources/sass/main/_custom.scss index d57149c7bb..20278682c9 100644 --- a/resources/sass/main/_custom.scss +++ b/resources/sass/main/_custom.scss @@ -9411,11 +9411,16 @@ section.recommendations div.scroller div.item span.glyphicons { font-size: 1.2em; } -.page-content p { +.page-content p, +.page-content details { margin-top: 0.5em; margin-bottom: 0.5em; } +.page-content details { + text-align: left; +} + .page-content>blockquote { color: #555; border-color: #555; @@ -9424,7 +9429,7 @@ section.recommendations div.scroller div.item span.glyphicons { } .page-content code, -pre { +.page-content pre { color: #555; background-color: #f5f5f5; border: 1px solid #ccc; @@ -9435,7 +9440,7 @@ pre { word-break: normal; } -.page-content>pre>code { +.page-content pre>code { border: none; }