fix: content_font compatibility
This commit is contained in:
parent
5d1a49ab06
commit
5d4e94575b
1 changed files with 23 additions and 5 deletions
28
src/model.rs
28
src/model.rs
|
@ -477,12 +477,21 @@ impl EntryMetadata {
|
||||||
}
|
}
|
||||||
|
|
||||||
if !self.content_font.is_empty() {
|
if !self.content_font.is_empty() {
|
||||||
|
let s: Vec<&str> = self.content_font.split(" ").collect();
|
||||||
|
|
||||||
output.push_str(&format!(
|
output.push_str(&format!(
|
||||||
"<link rel=\"preconnect\" href=\"https://fonts.googleapis.com\">
|
"<link href=\"https://fonts.googleapis.com/css2?family={}&display=swap\" rel=\"stylesheet\">",
|
||||||
<link rel=\"preconnect\" href=\"https://fonts.gstatic.com\" crossorigin>
|
s[0].replace("_", "+"),
|
||||||
<link href=\"https://fonts.googleapis.com/css2?family={}&display=swap\" rel=\"stylesheet\">",
|
|
||||||
self.content_font.replace(" ", "+").replace("_", "+"),
|
|
||||||
));
|
));
|
||||||
|
|
||||||
|
if let Some(headings) = s.get(1) {
|
||||||
|
output.push_str(&format!(
|
||||||
|
"<link rel=\"preconnect\" href=\"https://fonts.googleapis.com\">
|
||||||
|
<link rel=\"preconnect\" href=\"https://fonts.gstatic.com\" crossorigin>
|
||||||
|
<link href=\"https://fonts.googleapis.com/css2?family={}&display=swap\" rel=\"stylesheet\">",
|
||||||
|
headings.replace("_", "+"),
|
||||||
|
));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if self.option_disable_search_engine {
|
if self.option_disable_search_engine {
|
||||||
|
@ -571,10 +580,19 @@ impl EntryMetadata {
|
||||||
}
|
}
|
||||||
|
|
||||||
if !self.content_font.is_empty() {
|
if !self.content_font.is_empty() {
|
||||||
|
let s: Vec<&str> = self.content_font.split(" ").collect();
|
||||||
|
|
||||||
output.push_str(&format!(
|
output.push_str(&format!(
|
||||||
".container {{ font-family: \"{}\", system-ui; }}",
|
".container {{ font-family: \"{}\", system-ui; }}",
|
||||||
self.content_font.replace("_", " ")
|
s[0].replace("_", " ")
|
||||||
));
|
));
|
||||||
|
|
||||||
|
if let Some(headings) = s.get(1) {
|
||||||
|
output.push_str(&format!(
|
||||||
|
".container h1, .container h2, .container h3, .container h4, .container h5, .container h6 {{ font-family: \"{}\", system-ui; }}",
|
||||||
|
headings.replace("_", " ")
|
||||||
|
));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if self.content_font_weight != 0 {
|
if self.content_font_weight != 0 {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue