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

docs: formally document how admonitions can be customized #7799

Merged
merged 1 commit into from
Jul 20, 2022

Conversation

Josh-Cena
Copy link
Collaborator

Pre-flight checklist

  • I have read the Contributing Guidelines on pull requests.
  • If this is a code change: I have written unit tests and/or added dogfooding pages to fully verify the new behavior.
  • If this is a new API or substantial change: the PR has an accompanying issue (closes #0000) and the maintainers have approved on my working plan.

Motivation

I'm frequently asked about how admonitions can be customized—since the API is now stable and first-class, we can document it in a better place.

I'm not very satisfied with the explanation of swizzling. We would need to split the Admonition component so that we don't encourage ejecting just to add a custom type (mostly because we have to use the extractMDXAdmonitionTitle utility).

Test Plan

Test links

Deploy preview: https://deploy-preview-_____--docusaurus-2.netlify.app/

Related issues/PRs

@Josh-Cena Josh-Cena added the pr: documentation This PR works on the website or other text documents in the repo. label Jul 18, 2022
@facebook-github-bot facebook-github-bot added the CLA Signed Signed Facebook CLA label Jul 18, 2022
@netlify
Copy link

netlify bot commented Jul 18, 2022

[V2]

Name Link
🔨 Latest commit 42db0c3
🔍 Latest deploy log https://app.netlify.com/sites/docusaurus-2/deploys/62d51ed819a6c8000857554d
😎 Deploy Preview https://deploy-preview-7799--docusaurus-2.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

@github-actions
Copy link

⚡️ Lighthouse report for the deploy preview of this PR

URL Performance Accessibility Best Practices SEO PWA Report
/ 🟠 85 🟢 100 🟢 100 🟢 100 🟢 90 Report
/docs/installation 🟠 83 🟢 100 🟢 100 🟢 100 🟢 90 Report

@slorber
Copy link
Collaborator

slorber commented Jul 20, 2022

Thanks, that was on my todo 😄

Yes we should split it and make it easy to extend

Also not a fan that to add a new type, we have to "re-declare" all the default keywords => not very convenient API but good enough for now 🤷‍♂️

@slorber slorber merged commit 09326bd into main Jul 20, 2022
@slorber slorber deleted the jc/admonition-doc branch July 20, 2022 10:57
@Josh-Cena
Copy link
Collaborator Author

We should add an option like "extendDefaults". TS-ESLint also uses this pattern in some APIs.

dpang314 pushed a commit to dpang314/docusaurus that referenced this pull request Jul 24, 2022
This was referenced Oct 19, 2023
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: documentation This PR works on the website or other text documents in the repo.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants