Skip to content
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

feat: global Markdown config option & frontMatterParser field #5972

Closed
wants to merge 13 commits into from

Conversation

Josh-Cena
Copy link
Collaborator

@Josh-Cena Josh-Cena commented Nov 19, 2021

Motivation

Initial step to #4625! 🎉
Resolve #5568.

Have you read the Contributing Guidelines on pull requests?

Yes

Test Plan

Unit tests: TODO
Dogfooded on website:

Caveats

The callback is called on every Markdown file, including partials. This leads to warnings about unused front matter if the hook injects extra front matter. We should find a way to: (a) call the custom callback which may do other useful stuff and (b) not trigger the warning if there was no front matter prior to the callback call.

Another possible solution I can think of is add another fileMetadata context value in addition to plugin, which includes createTime, author, fileName, etc. This may be useful also for the use-case of #5691.

@Josh-Cena Josh-Cena added the pr: new feature This PR adds a new API or behavior. label Nov 19, 2021
@facebook-github-bot facebook-github-bot added the CLA Signed Signed Facebook CLA label Nov 19, 2021
@Josh-Cena Josh-Cena added this to the 2.0.0 milestone Dec 20, 2021
@Josh-Cena
Copy link
Collaborator Author

I adopted a pretty inelegant solution to this problem by only checking for "apparent" front matter on partials. I don't know if we should pass in file paths (hard to implement) or just drop the warning for front matter in partials altogether

@netlify
Copy link

netlify bot commented Dec 20, 2021

✔️ [V2]

🔨 Explore the source changes: 4394434

🔍 Inspect the deploy log: https://app.netlify.com/sites/docusaurus-2/deploys/61cfd68ecd0d580007842432

😎 Browse the preview: https://deploy-preview-5972--docusaurus-2.netlify.app

@github-actions
Copy link

github-actions bot commented Dec 20, 2021

⚡️ Lighthouse report for the changes in this PR:

Category Score
🟠 Performance 71
🟢 Accessibility 98
🟢 Best practices 100
🟢 SEO 100
🟢 PWA 95

Lighthouse ran on https://deploy-preview-5972--docusaurus-2.netlify.app/

@github-actions
Copy link

github-actions bot commented Dec 20, 2021

Size Change: +606 B (0%)

Total Size: 670 kB

Filename Size Change
website/build/assets/js/main.********.js 498 kB +606 B (0%)
ℹ️ View Unchanged
Filename Size
website/.docusaurus/globalData.json 40.1 kB
website/build/assets/css/styles.********.css 102 kB
website/build/index.html 29.6 kB

compressed-size-action

@Josh-Cena Josh-Cena added the status: awaiting review This PR is ready for review, will be merged after maintainers' approval label Dec 20, 2021
@Josh-Cena Josh-Cena removed the status: awaiting review This PR is ready for review, will be merged after maintainers' approval label Jan 17, 2022
@Josh-Cena
Copy link
Collaborator Author

Closing until #6370. That one would mean totally turning this over, so I'd rather implement that first.

@Josh-Cena Josh-Cena closed this Mar 31, 2022
@Josh-Cena Josh-Cena deleted the jc/markdown-config branch March 31, 2022 07:22
@Josh-Cena Josh-Cena removed this from the 2.0.0 milestone Mar 31, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed Signed Facebook CLA pr: new feature This PR adds a new API or behavior.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Docs / blog / pages: createFrontMatter callback to transform front matter
2 participants