diff --git a/docs/contributions/index.rst b/docs/contributions/index.rst index 15b8d86ba..bd39ace49 100644 --- a/docs/contributions/index.rst +++ b/docs/contributions/index.rst @@ -10,5 +10,13 @@ Clone the mono repository Run the tests ============= +The project comes with a Makefile that will run the tests and other +checks for you. +It relies on ``docker``, but you can run any make target natively by +using the ``PHP_BIN`` make variable. +For instance, to run the pre-commit checks, you can run:: + + make PHP_BIN=php pre-commit-test + Submit a Pull Request ===================== diff --git a/packages/guides/src/ReferenceResolvers/DocReferenceResolver.php b/packages/guides/src/ReferenceResolvers/DocReferenceResolver.php index 7a2abc4fb..0cd2633b1 100644 --- a/packages/guides/src/ReferenceResolvers/DocReferenceResolver.php +++ b/packages/guides/src/ReferenceResolvers/DocReferenceResolver.php @@ -18,7 +18,9 @@ public function resolve(LinkInlineNode $node, RenderContext $renderContext): boo return false; } - $document = $renderContext->getProjectNode()->findDocumentEntry($node->getTargetReference()); + $document = $renderContext->getProjectNode()->findDocumentEntry( + $renderContext->canonicalUrl($node->getTargetReference()), + ); if ($document === null) { return false; } diff --git a/packages/guides/src/RenderContext.php b/packages/guides/src/RenderContext.php index a0bb31d8e..46c2ab0c5 100644 --- a/packages/guides/src/RenderContext.php +++ b/packages/guides/src/RenderContext.php @@ -94,7 +94,7 @@ public function getLink(string $name, bool $relative = true): string return ''; } - public function canonicalUrl(string $url): string|null + public function canonicalUrl(string $url): string { return $this->urlGenerator->canonicalUrl($this->getDirName(), $url); } diff --git a/tests/Integration/tests/docref/expected/index.html b/tests/Integration/tests/docref/expected/index.html new file mode 100644 index 000000000..77d0dbdf1 --- /dev/null +++ b/tests/Integration/tests/docref/expected/index.html @@ -0,0 +1,14 @@ + + + + Root + + + +
+

Root

+ +
+ + + diff --git a/tests/Integration/tests/docref/expected/subfolder/index.html b/tests/Integration/tests/docref/expected/subfolder/index.html new file mode 100644 index 000000000..8dd758276 --- /dev/null +++ b/tests/Integration/tests/docref/expected/subfolder/index.html @@ -0,0 +1,15 @@ + + + + Subfolder index + + + +
+

Subfolder index

+ +

Root

+
+ + + diff --git a/tests/Integration/tests/docref/input/index.rst b/tests/Integration/tests/docref/input/index.rst new file mode 100644 index 000000000..673c7a032 --- /dev/null +++ b/tests/Integration/tests/docref/input/index.rst @@ -0,0 +1,3 @@ +==== +Root +==== diff --git a/tests/Integration/tests/docref/input/subfolder/index.rst b/tests/Integration/tests/docref/input/subfolder/index.rst new file mode 100644 index 000000000..96c835ad0 --- /dev/null +++ b/tests/Integration/tests/docref/input/subfolder/index.rst @@ -0,0 +1,5 @@ +=============== +Subfolder index +=============== + +:doc:`../index` diff --git a/tests/Integration/tests/references/expected/subfolder/index.html b/tests/Integration/tests/references/expected/subfolder/index.html new file mode 100644 index 000000000..7422229c0 --- /dev/null +++ b/tests/Integration/tests/references/expected/subfolder/index.html @@ -0,0 +1,10 @@ + + + + + + + +

Page 1

+ + diff --git a/tests/Integration/tests/references/input/subfolder/index.rst b/tests/Integration/tests/references/input/subfolder/index.rst new file mode 100644 index 000000000..67f25c958 --- /dev/null +++ b/tests/Integration/tests/references/input/subfolder/index.rst @@ -0,0 +1,6 @@ +=============== +Subfolder index +=============== + + +:doc:`../page`