Skip to content

feat: global Markdown config option & frontMatterParser field - #5972

Closed
Josh-Cena wants to merge 13 commits into
mainfrom
jc/markdown-config
Closed

Josh-Cena wants to merge 13 commits into
mainfrom
jc/markdown-config

Conversation

@Josh-Cena

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

Copy link
Copy Markdown
Collaborator

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 mentioned this pull request Nov 24, 2021
2 tasks done
@Josh-Cena Josh-Cena added this to the 2.0.0 milestone Dec 20, 2021
@Josh-Cena

Copy link
Copy Markdown
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

netlify Bot commented Dec 20, 2021 •

Copy link
Copy Markdown

@github-actions

github-actions Bot commented Dec 20, 2021 •

Copy link
Copy Markdown

⚡️ 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

github-actions Bot commented Dec 20, 2021 •

Copy link
Copy Markdown

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
Copy Markdown
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