Skip to content

Commit

Permalink
docs: Actually fix md links containing anchors
Browse files Browse the repository at this point in the history
  • Loading branch information
ogoffart committed Jul 6, 2022
1 parent ffeb5c5 commit 8dfec21
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions docs/resources/slint-docs-preview.html
Original file line number Diff line number Diff line change
Expand Up @@ -52,13 +52,13 @@
// resolved by rustdoc. This helper locates such links and resolves them, assuming that each
// .md file gets its own sub-directory with an index.html.
function fix_markdown_links() {
for (let anchor of document.querySelectorAll('a[href$=".md"], a[href~=".md#"]')) {
for (let anchor of document.querySelectorAll('a[href$=".md"], a[href*=".md#"]')) {
let url = new URL(anchor.href);
let dir_separator = Math.max(url.pathname.lastIndexOf("/"), 0);
let base_name = url.pathname.slice(dir_separator + 1, -3);
let base_path = url.pathname.slice(0, dir_separator);
url.pathname = base_path + "/../" + base_name + "/index.html";
anchor.setAttribute("href", url.pathname);
anchor.setAttribute("href", url);
}
}
fix_markdown_links()
Expand Down

0 comments on commit 8dfec21

Please sign in to comment.