Add `text_bold_font_weight` argument
matiasandina opened this issue · comments
I'm not sure this is a bug, I'm doing something wrong, or Firefox is not rendering content properly.
I am following the example in the website documentation using style_mono_accent()
.
style_mono_accent(
base_color = "#262626", #1c5253
header_font_google = google_font("Josefin Sans"),
text_font_google = google_font("Montserrat",
"300", "700", "300i")
Generates this .css
body {
font-family: var(--text-font-family), var(--text-font-family-fallback), var(--text-font-base);
font-weight: 300;
color: var(--text-color);
}
This displays properly on the Rstudio viewer, but not on Firefox. The strong
tag is overwritten by font-weight: 300
in body
.
The only way I found to have this display properly in Firefox is by adding "inherit" at the beginning of the weights on google_font()
style_mono_accent(
base_color = "#262626", #1c5253
header_font_google = google_font("Josefin Sans"),
text_font_google = google_font("Montserrat", "inherit",
"300", "700", "300i")
Generates this .css
body {
font-family: var(--text-font-family), var(--text-font-family-fallback), var(--text-font-base);
font-weight: inherit;
color: var(--text-color);
}
Yeah, the first font weight in the list becomes the default font-weight of the body
:
xaringanthemer/inst/scripts/style_xaringan_body.R
Lines 88 to 92 in c1513bb
Try using this:
style_mono_accent(
base_color = "#262626", #1c5253
header_font_google = google_font("Josefin Sans"),
text_font_google = google_font("Montserrat", "300", "700", "300i"),
extra_css = list(strong = list("font-weight" = 700))
)
The real problem is that font-weight
isn't explicitly set on <strong>
by the xaringanthemer css. Some browsers provide a default value of for this tag and others don't, which is why you see a difference between RStudio's viewer and other browsers.
Do you think it makes sense to show this on the documentation? Maybe in the "Colors" section here https://pkg.garrickadenbuie.com/xaringanthemer/articles/xaringanthemer.html ?
Not really. If anything, I could add a CSS rule to set the font-weight
of <strong>
to bold
. That parameter could be tied to an R argument, like text_bold_font_weight
, that would work like text_font_weight
.
That would be great!