From 517b62359506d3d5b4720aa335d38cc8ada2db49 Mon Sep 17 00:00:00 2001 From: Awilum Date: Tue, 13 Sep 2022 10:12:34 +0300 Subject: [PATCH] feat(directives): add ability to disable markdown using `!markdown` --- src/flextype/core/Entries/Directives/MarkdownDirective.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/flextype/core/Entries/Directives/MarkdownDirective.php b/src/flextype/core/Entries/Directives/MarkdownDirective.php index 7b03ba8a..b8fbeb47 100644 --- a/src/flextype/core/Entries/Directives/MarkdownDirective.php +++ b/src/flextype/core/Entries/Directives/MarkdownDirective.php @@ -36,6 +36,10 @@ emitter()->addListener('onEntriesFetchSingleField', static function (): void { $field = entries()->registry()->get('methods.fetch.field'); + if (is_string($field['value']) && strings($field['value'])->contains('!markdown')) { + return; + } + if (is_string($field['value'])) { if (strings($field['value'])->contains('@markdown')) { $field['value'] = strings(parsers()->markdown()->parse($field['value']))->replace('@markdown', '')->trim()->toString();