mdbook/tests/testsuite/print/relative_links/expected/print.html
Eric Huss 005f4d648a Fix print page links for internal links to non-chapters
This fixes links on the print page that go to an internal destination
that is not a chapter. The path would have the wrong relative
destination, and would be broken. The logic for detecting this was
incorrectly only checking if a link went outside the book, or didn't
have an html extension. This doesn't work for links to HTML files that
are inside the book, but not one of the chapters.
2025-10-30 18:37:12 -07:00

21 lines
No EOL
1.5 KiB
HTML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<h1 id="first-chapter"><a class="header" href="#first-chapter">First Chapter</a></h1>
<div style="break-before: page; page-break-before: always;"></div>
<h1 id="first-nested"><a class="header" href="#first-nested">First Nested</a></h1>
<div style="break-before: page; page-break-before: always;"></div>
<h1 id="testing-relative-links-for-the-print-page"><a class="header" href="#testing-relative-links-for-the-print-page">Testing relative links for the print page</a></h1>
<p>When we link to <a href="#first-nested">the first section</a>, it should work on
both the print page and the non-print page.</p>
<p>The same link should work <a href="#first-nested">with an html extension</a>.</p>
<p>A <a href="#some-section">fragment link</a> should work.</p>
<p>Link <a href="../std/foo/bar.html">outside</a>.</p>
<p>Link <a href="../std/foo/bar.html#panic">outside with anchor</a>.</p>
<p>Link <a href="first/alpha/beta.html">inside but doesnt exist</a>.
Link <a href="first/alpha/beta.html#anchor">inside but doesnt exist with anchor</a>.
Link <a href="first/alpha/gamma.html">inside to html</a>.
Link <a href="first/alpha/gamma.html#anchor">inside to html with anchor</a>.</p>
<p><img src="images/picture.png" alt="Some image"></p>
<p><a href="#first-nested">HTML Link</a></p>
<img src="images/picture.png" alt="raw html">
<h2 id="some-section"><a class="header" href="#some-section">Some section</a></h2>
<p><a href="https://example.com/foo.html#bar">Links with scheme shouldnt be touched.</a></p>
<p><a href="images/not-html?arg1&amp;arg2#with-anchor">Non-html link</a></p>