-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Adding Frontmatter Reader: Support summary card (OG. Twitter) #2321
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
Hi, would you have time to rebase this to make it easier to review it, please? |
@@ -35,6 +35,9 @@ shlex = "1.3.0" | |||
tempfile = "3.4.0" | |||
toml = "0.5.11" # Do not update, see https://github.com/rust-lang/mdBook/issues/2037 | |||
topological-sort = "0.2.2" | |||
gray_matter = "0.2" #Fronmatter | |||
serde_yaml = "0.9" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
serde_yaml
was deprecated recently, please use serde_yml
use serde::Deserialize; | ||
|
||
fn extract_frontmatter(content: &str) -> Option<&str> { | ||
let start = content.find("---")? + 3; // Find the end of the first `---` + 3 to move past it |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Given that ---
can appear anywhere in a regular markdown content, I'd restrict this to the case when the file starts with ---
.
☔ The latest upstream changes (possibly #2681) made this pull request unmergeable. Please resolve the merge conflicts. |
See issues #1416 and specific description in my comment: #1416 (comment).
This works for my site dedp.online, but I'd appreciate some help to integrate it nicely. It's more hackable and hard-coded to these frontmatter I used:
Would be nice to read them dynamically. Also, I'm not sure if I added it at the right points.
PS: I also tried to implement a preprocessor (see #1416 (comment)), but with this PR that one is not needed anymore. Also, I guess this should be integrated into mdBook, and can't be as Preprocessor only?