Skip to content

Commit

Permalink
Add favicon to forc doc (FuelLabs#3541)
Browse files Browse the repository at this point in the history
Uses the `sway-logo.svg` as the favicon for docs produced by `forc doc`

Outcome:
<img width="98" alt="Screen Shot 2022-12-07 at 2 28 23 PM"
src="https://user-images.githubusercontent.com/57543709/206288671-7407045c-0c64-49b5-9af5-d9cfd0d85804.png">

Closes FuelLabs#3481
  • Loading branch information
eureka-cpu authored Dec 7, 2022
1 parent a5b1c18 commit 1b75006
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions forc-plugins/forc-doc/src/render.rs
Original file line number Diff line number Diff line change
Expand Up @@ -170,9 +170,11 @@ fn html_head(
decl_name: String,
) -> Box<dyn RenderBox> {
let prefix = module_depth_to_path_prefix(module_depth);
let mut favicon = prefix.clone();
let mut normalize = prefix.clone();
let mut swaydoc = prefix.clone();
let mut ayu = prefix;
favicon.push_str("assets/sway-logo.svg");
normalize.push_str("assets/normalize.css");
swaydoc.push_str("assets/swaydoc.css");
ayu.push_str("assets/ayu.css");
Expand All @@ -187,6 +189,7 @@ fn html_head(
content=format!("API documentation for the Sway `{decl_name}` {decl_ty} in `{location}`.")
);
meta(name="keywords", content=format!("sway, swaylang, sway-lang, {decl_name}"));
link(rel="icon", href=favicon);
title: format!("{decl_name} in {location} - Sway");
link(rel="stylesheet", type="text/css", href=normalize);
link(rel="stylesheet", type="text/css", href=swaydoc, id="mainThemeStyle");
Expand Down Expand Up @@ -328,6 +331,7 @@ fn all_items(crate_name: String, all_doc: &AllDoc) -> Box<dyn RenderBox> {
content="List of all items in this crate"
);
meta(name="keywords", content="sway, swaylang, sway-lang");
link(rel="icon", href="assets/sway-logo.svg");
title: "List of all items in this crate";
link(rel="stylesheet", type="text/css", href="assets/normalize.css");
link(rel="stylesheet", type="text/css", href="assets/swaydoc.css", id="mainThemeStyle");
Expand Down

0 comments on commit 1b75006

Please sign in to comment.