diff --git a/src/config.rs b/src/config.rs index 655d3da0..736795dd 100644 --- a/src/config.rs +++ b/src/config.rs @@ -440,6 +440,8 @@ pub struct HtmlConfig { pub no_section_label: bool, /// Search settings. If `None`, the default will be used. pub search: Option, + /// Git repository url. If 'None', the git button will not be shown. + pub git_repository_url: Option, } impl HtmlConfig { diff --git a/src/renderer/html_handlebars/hbs_renderer.rs b/src/renderer/html_handlebars/hbs_renderer.rs index 3f87ba4d..ebf20feb 100644 --- a/src/renderer/html_handlebars/hbs_renderer.rs +++ b/src/renderer/html_handlebars/hbs_renderer.rs @@ -454,6 +454,10 @@ fn make_data( ) } + if let Some(ref git_repository_url) = html_config.git_repository_url { + data.insert("git-repository-url".to_owned(), json!(git_repository_url)); + } + let mut chapters = vec![]; for item in book.iter() { diff --git a/src/theme/css/chrome.css b/src/theme/css/chrome.css index 82883e6b..0ab16869 100644 --- a/src/theme/css/chrome.css +++ b/src/theme/css/chrome.css @@ -63,9 +63,12 @@ a > .hljs { margin: 0; } -#print-button { +.right-buttons { margin: 0 15px; } +.right-buttons a { + text-decoration: none; +} html:not(.sidebar-visible) #menu-bar:not(:hover).folded > #menu-bar-sticky-container { transform: translateY(-60px); diff --git a/src/theme/index.hbs b/src/theme/index.hbs index 982c2f7d..21c0b0a4 100644 --- a/src/theme/index.hbs +++ b/src/theme/index.hbs @@ -113,6 +113,11 @@ + {{#if git-repository-url}} + + + + {{/if}}