diff --git a/system/src/Grav/Common/Page/Markdown/Excerpts.php b/system/src/Grav/Common/Page/Markdown/Excerpts.php
index f5dc274bf..63c4826ae 100644
--- a/system/src/Grav/Common/Page/Markdown/Excerpts.php
+++ b/system/src/Grav/Common/Page/Markdown/Excerpts.php
@@ -104,12 +104,16 @@ static function ($carry, $item) {
// Valid attributes supported.
$valid_attributes = Grav::instance()['config']->get('system.pages.markdown.valid_link_attributes');
+ $skip = [];
// Unless told to not process, go through actions.
if (array_key_exists('noprocess', $actions)) {
+ $skip = is_bool($actions['noprocess']) ? $actions : explode(',', $actions['noprocess']);
unset($actions['noprocess']);
- } else {
- // Loop through actions for the image and call them.
- foreach ($actions as $attrib => $value) {
+ }
+
+ // Loop through actions for the image and call them.
+ foreach ($actions as $attrib => $value) {
+ if (!in_array($attrib, $skip)) {
$key = $attrib;
if (in_array($attrib, $valid_attributes, true)) {
diff --git a/tests/unit/Grav/Common/Helpers/ExcerptsTest.php b/tests/unit/Grav/Common/Helpers/ExcerptsTest.php
index e344a8fdc..1d95f3c96 100644
--- a/tests/unit/Grav/Common/Helpers/ExcerptsTest.php
+++ b/tests/unit/Grav/Common/Helpers/ExcerptsTest.php
@@ -87,4 +87,34 @@ public function testProcessImageHtml()
Excerpts::processImageHtml('', $this->page)
);
}
+
+ public function testNoProcess()
+ {
+ $this->assertStringStartsWith(
+ 'regular process')
+ );
+
+ $this->assertStringStartsWith(
+ 'noprocess')
+ );
+
+ $this->assertStringStartsWith(
+ 'noprocess=id')
+ );
+ }
+
+ public function testTarget()
+ {
+ $this->assertStringStartsWith(
+ 'only target')
+ );
+ $this->assertStringStartsWith(
+ 'target and rel')
+ );
+ }
}