Skip to content

Commit

Permalink
hide the top path nav when printing
Browse files Browse the repository at this point in the history
  • Loading branch information
yihui committed Jun 24, 2024
1 parent d2f44b7 commit 6974b1e
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
2 changes: 1 addition & 1 deletion R/preview.R
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ file_page = function(x, raw) {
if (is.null(p <- res$payload)) return(res)
# inject navigation links to the top of the page
nav = commonmark::markdown_html(dir_title(x))
nav = sub('<p>', '<p style="font-size: .8em;">', nav, fixed = TRUE)
nav = sub('<p>', '<p class="nav-path">', nav, fixed = TRUE)
res$payload = sub('<body>', paste0('<body>\n', nav), p, fixed = TRUE)
res
}
Expand Down
8 changes: 8 additions & 0 deletions inst/resources/server.css
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
.nav-path {
font-size: .8em;
}
.pencil, .save {
text-decoration: none;
font-size: 1.5em;
Expand All @@ -21,3 +24,8 @@ td .pencil {
cursor: wait;
opacity: .5;
}
@media print {
.nav-path {
display: none;
}
}

0 comments on commit 6974b1e

Please sign in to comment.