diff --git a/packages/guides-restructured-text/src/RestructuredText/Directives/ConfvalDirective.php b/packages/guides-restructured-text/src/RestructuredText/Directives/ConfvalDirective.php
index 9c978f6d4..b157d290f 100644
--- a/packages/guides-restructured-text/src/RestructuredText/Directives/ConfvalDirective.php
+++ b/packages/guides-restructured-text/src/RestructuredText/Directives/ConfvalDirective.php
@@ -83,6 +83,8 @@ protected function processSub(
$type = $this->inlineParser->parse($directive->getOption('default')->toString(), $blockContext);
}
+ $noindex = $directive->hasOption('noindex');
+
foreach ($directive->getOptions() as $option) {
if (in_array($option->getName(), ['type', 'required', 'default', 'noindex', 'name'], true)) {
continue;
@@ -91,6 +93,6 @@ protected function processSub(
$additionalOptions[$option->getName()] = $this->inlineParser->parse($option->toString(), $blockContext);
}
- return new ConfvalNode($id, $directive->getData(), $type, $required, $default, $additionalOptions, $collectionNode->getChildren());
+ return new ConfvalNode($id, $directive->getData(), $type, $required, $default, $additionalOptions, $collectionNode->getChildren(), $noindex);
}
}
diff --git a/packages/guides-restructured-text/src/RestructuredText/Nodes/ConfvalNode.php b/packages/guides-restructured-text/src/RestructuredText/Nodes/ConfvalNode.php
index c092dfc07..7045d7476 100644
--- a/packages/guides-restructured-text/src/RestructuredText/Nodes/ConfvalNode.php
+++ b/packages/guides-restructured-text/src/RestructuredText/Nodes/ConfvalNode.php
@@ -17,6 +17,7 @@
use phpDocumentor\Guides\Nodes\InlineCompoundNode;
use phpDocumentor\Guides\Nodes\LinkTargetNode;
use phpDocumentor\Guides\Nodes\Node;
+use phpDocumentor\Guides\Nodes\OptionalLinkTargetsNode;
/**
* The confval directive configuration values.
@@ -25,7 +26,7 @@
*
* @extends CompoundNode
*/
-final class ConfvalNode extends CompoundNode implements LinkTargetNode
+final class ConfvalNode extends CompoundNode implements LinkTargetNode, OptionalLinkTargetsNode
{
public const LINK_TYPE = 'std:confval';
@@ -41,6 +42,7 @@ public function __construct(
private readonly InlineCompoundNode|null $default = null,
private readonly array $additionalOptions = [],
array $value = [],
+ private readonly bool $noindex = false,
) {
parent::__construct($value);
}
@@ -85,4 +87,9 @@ public function getAdditionalOptions(): array
{
return $this->additionalOptions;
}
+
+ public function isNoindex(): bool
+ {
+ return $this->noindex;
+ }
}
diff --git a/packages/guides/src/Compiler/NodeTransformers/CollectLinkTargetsTransformer.php b/packages/guides/src/Compiler/NodeTransformers/CollectLinkTargetsTransformer.php
index 86a5187ca..11ee71f88 100644
--- a/packages/guides/src/Compiler/NodeTransformers/CollectLinkTargetsTransformer.php
+++ b/packages/guides/src/Compiler/NodeTransformers/CollectLinkTargetsTransformer.php
@@ -21,6 +21,7 @@
use phpDocumentor\Guides\Nodes\LinkTargetNode;
use phpDocumentor\Guides\Nodes\MultipleLinkTargetsNode;
use phpDocumentor\Guides\Nodes\Node;
+use phpDocumentor\Guides\Nodes\OptionalLinkTargetsNode;
use phpDocumentor\Guides\Nodes\SectionNode;
use phpDocumentor\Guides\ReferenceResolvers\AnchorNormalizer;
use Psr\Log\LoggerInterface;
@@ -94,6 +95,10 @@ public function enterNode(Node $node, CompilerContext $compilerContext): Node
}
if ($node instanceof LinkTargetNode) {
+ if ($node instanceof OptionalLinkTargetsNode && $node->isNoindex()) {
+ return $node;
+ }
+
$currentDocument = $this->documentStack->top();
Assert::notNull($currentDocument);
$anchor = $this->anchorReducer->reduceAnchor($node->getId());
diff --git a/packages/guides/src/Nodes/OptionalLinkTargetsNode.php b/packages/guides/src/Nodes/OptionalLinkTargetsNode.php
new file mode 100644
index 000000000..46453d573
--- /dev/null
+++ b/packages/guides/src/Nodes/OptionalLinkTargetsNode.php
@@ -0,0 +1,26 @@
+
-
- Another Page - Bootstrap Theme
-
-
-
-
-
-
-
-
-
-