diff --git a/src/book/init.rs b/src/book/init.rs index 4acf4b52..4726d570 100644 --- a/src/book/init.rs +++ b/src/book/init.rs @@ -134,6 +134,9 @@ impl BookBuilder { let mut general_css = File::create(cssdir.join("general.css"))?; general_css.write_all(theme::GENERAL_CSS)?; + let mut book_css = File::create(cssdir.join("book.css"))?; + book_css.write_all(theme::BOOK_CSS)?; + let mut chrome_css = File::create(cssdir.join("chrome.css"))?; chrome_css.write_all(theme::CHROME_CSS)?; diff --git a/src/renderer/html_handlebars/hbs_renderer.rs b/src/renderer/html_handlebars/hbs_renderer.rs index 002db7eb..7ecafbcb 100644 --- a/src/renderer/html_handlebars/hbs_renderer.rs +++ b/src/renderer/html_handlebars/hbs_renderer.rs @@ -119,6 +119,7 @@ impl HtmlHandlebars { write_file(destination, "book.js", &theme.js)?; write_file(destination, "css/general.css", &theme.general_css)?; + write_file(destination, "css/book.css", &theme.book_css)?; write_file(destination, "css/chrome.css", &theme.chrome_css)?; write_file(destination, "css/print.css", &theme.print_css)?; write_file(destination, "css/variables.css", &theme.variables_css)?; @@ -552,7 +553,7 @@ fn fix_code_blocks(html: &str) -> String { let after = &caps[3]; format!( - r#""#, + r#""#, before = before, classes = classes, after = after diff --git a/src/theme/book.js b/src/theme/book.js index 943e0a1b..e6de2ca7 100644 --- a/src/theme/book.js +++ b/src/theme/book.js @@ -331,6 +331,12 @@ function playpen_text(playpen) { stylesheets.tomorrowNight.disabled = true; stylesheets.highlight.disabled = true; + ace_theme = "ace/theme/tomorrow_night"; + } else if (theme == 'book') { + stylesheets.ayuHighlight.disabled = true; + stylesheets.tomorrowNight.disabled = true; + stylesheets.highlight.disabled = true; + ace_theme = "ace/theme/tomorrow_night"; } else { stylesheets.ayuHighlight.disabled = true; diff --git a/src/theme/css/book.css b/src/theme/css/book.css new file mode 100644 index 00000000..e129bf81 --- /dev/null +++ b/src/theme/css/book.css @@ -0,0 +1,65 @@ +body { + font-family: "Source Serif Pro", serif; +} +p { + text-align: justify; + line-height: 1.25em; +} +code { + font-family: "Source Code Pro", monospace; + padding: 0 !important; +} +code:not(.block) { + padding: 0 0 1pt 0 !important; +} +code:not(.block)::before { + content: '‘'; +} +code:not(.block)::after { + content: '’'; +} +pre { + margin-left: 2em; +} +pre pre { + margin-left: 0; +} +pre.playpen > div.buttons { + float: right; + height: 0; +} +em { + font-style: italic; +} +h3::before { + content: "¶"; + width: 1em; + display: inline-block; + margin-left: -1em; +} +h4::before { + content: "§"; + width: 1em; + display: inline-block; + margin-left: -1em; +} +.left-buttons { + position: absolute; +} +.right-buttons { + position: absolute; + right: 0; +} + +#menu-bar-sticky-container { + background-color: rgba(255, 255, 255, 0.8) !important; +} + +@media print { + .menu-bar, .buttons { + display: none; + } + body { + font-size: 11pt; + } +} diff --git a/src/theme/index.hbs b/src/theme/index.hbs index cce561f6..aaab4053 100644 --- a/src/theme/index.hbs +++ b/src/theme/index.hbs @@ -13,18 +13,18 @@ + - + - {{#each additional_css}} @@ -105,6 +105,7 @@
  • +
  • {{#if search_enabled}}