Skip to content

Commit ac9dccd

Browse files
committed
Allow replacement of same document
A document can be readded by the compiler, we do not need to error about this.
1 parent 73da64e commit ac9dccd

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

packages/guides/src/Nodes/ProjectNode.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,10 @@ public function addLinkTarget(string $anchorName, InternalTarget $target): void
154154
}
155155

156156
if (isset($this->internalLinkTargets[$linkType][$anchorName]) && $linkType !== 'std:title') {
157+
if ($this->internalLinkTargets[$linkType][$anchorName]->getDocumentPath() === $target->getDocumentPath()) {
158+
return;
159+
}
160+
157161
throw new DuplicateLinkAnchorException(sprintf('Duplicate anchor "%s". There is already another anchor of that name in document "%s"', $anchorName, $this->internalLinkTargets[$linkType][$anchorName]->getDocumentPath()));
158162
}
159163

0 commit comments

Comments
 (0)