You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
After transferring the readme information to an Rmd file for better rendering, the logo appeared greatly oversized and centre instead of right-justified.
Proposed solution:
The logo has to be 64-bit encoded to a html file with the relevant height and width (as a percentage of the total) specified in css code. The html file then has to be appended to the title by mentioning it in the YAML header.
This is done in two steps as follows:
Run the below R chunk (now added to the top of README.Rmd) to create the html version of the logo every time you edit any of the logo parameters. Note that this chunk has to be run by itself BEFORE knitting the whole .Rmd to a Github document, as knitting will fail if the YAML header can't find the html file containing the logo.
### Note:
# - If you need to update the size of the logo, edit the width and height below and then run this chunk BEFORE knitting
# Ensures the package "pacman" is installed
if (!require("pacman")) install.packages("pacman")
# Load required libraries:
pacman::p_load(htmltools,
here,
readr)
# Base-64 encode the image file:
img <- htmltools::img(src = knitr::image_uri(f = here::here("inst",
"app",
"www",
"godataR_logo.png")),
alt = 'logo',
style = 'position:absolute;
width:10%;
height:15%;
top:10px;
right:1%;
padding:10px;
z-index:200;')
# Create the image file:
htmlhead <- paste0('<script>
document.write(\'<div class="logos">', img, '</div>\')
</script>')
# Read in the image file:
readr::write_lines(htmlhead, file = "header.html")
Knit the Rmd, which will now incorporate the logo in the title space as specified in the updated YAML header:
Reported by:
@sarahollis
Problem statement:
After transferring the readme information to an Rmd file for better rendering, the logo appeared greatly oversized and centre instead of right-justified.
Proposed solution:
The logo has to be 64-bit encoded to a html file with the relevant height and width (as a percentage of the total) specified in css code. The html file then has to be appended to the title by mentioning it in the YAML header.
This is done in two steps as follows:
The text was updated successfully, but these errors were encountered: