Skip to content

Commit

Permalink
feat(website): ✨ added proper docs links parsing system
Browse files Browse the repository at this point in the history
Now I need to update all the links...
  • Loading branch information
arctic-hen7 committed Oct 9, 2021
1 parent 61dac01 commit cfa2d60
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions website/website/src/templates/docs/generation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,19 @@ pub async fn get_build_state(path: String, locale: String) -> RenderFnResultWith
contents
};

// Parse any relative links to other pages in the docs
// We add the base path, the locale, and the docs version
// We use the special token `:` to denote these (e.g. `[static exporting](:exporting)`)
let contents = contents.replace(
"](:",
&format!(
"]({}/{}/docs/{}/",
get_path_prefix_server(),
&locale,
&version
),
);

// Parse the file to HTML
let html_contents = parse_md_to_html(&contents);
// Get the title from the first line of the contents, stripping the initial `#`
Expand Down

0 comments on commit cfa2d60

Please sign in to comment.