Skip to content

feat(QuickStart): replace Docusaurus CodeBlock styles#445

Open
Tony133 wants to merge 4 commits into
fastify:mainfrom
Tony133:feat/custom-code-block
Open

feat(QuickStart): replace Docusaurus CodeBlock styles#445
Tony133 wants to merge 4 commits into
fastify:mainfrom
Tony133:feat/custom-code-block

Conversation

@Tony133

@Tony133 Tony133 commented Jun 27, 2026

Copy link
Copy Markdown
Member

Proposal:

  • Replaces Docusaurus CodeBlock styles
  • Added CodeBlock function in theme directory
  • Added styles.module.css in QuickStart directory
  • Update index.jsx in QuickStart directory

  • Preview Quickstart:
quickstart-refactor
  • Preview Using CLI:
quickstart-refactor-1
  • Preview Tab ESM:
quickstart-refactor-2
  • Preview Tab CJS:
quickstart-refactor-4
  • Preview Typescript Support:
quickstart-refactor-3

cc @fastify/frontend @fastify/website

@ilteoood

Copy link
Copy Markdown
Contributor

Honestly I don't understand why we need this.
All the 3 features that you highlighted are already available even with the default codeblock, here follows an example:
image

Consider also that creating a new component makes the migration to the new versions of docusaurus harder than what they already are.

@Tony133

Tony133 commented Jun 27, 2026

Copy link
Copy Markdown
Member Author

Honestly I don't understand why we need this. All the 3 features that you highlighted are already available even with the default codeblock, here follows an example: image

Consider also that creating a new component makes the migration to the new versions of docusaurus harder than what they already are.

Thanks for the review! You're absolutely right, the default configuration supports these features. The primary reason was purely aesthetic: I wanted to give the homepage/QuickStart a more customized and polished look. The goal was just to make the homepage a little bit nicer! 🙂 As I had started doing in this PR: #443

@ilteoood

Copy link
Copy Markdown
Contributor

Honestly I don't understand why we need this. All the 3 features that you highlighted are already available even with the default codeblock, here follows an example: image

Consider also that creating a new component makes the migration to the new versions of docusaurus harder than what they already are.

Thanks for the review! You're absolutely right, the default configuration supports these features. The primary reason was purely aesthetic: I wanted to give the homepage/QuickStart a more customized and polished look. The goal was just to make the homepage a little bit nicer! 🙂 As I had started doing in this PR: #443

I get it, but then why not opting for customizations through CSS? Is it something you considered or did you have any problem with it?

@Tony133

Tony133 commented Jun 27, 2026

Copy link
Copy Markdown
Member Author

Honestly I don't understand why we need this. All the 3 features that you highlighted are already available even with the default codeblock, here follows an example: image
Consider also that creating a new component makes the migration to the new versions of docusaurus harder than what they already are.

Thanks for the review! You're absolutely right, the default configuration supports these features. The primary reason was purely aesthetic: I wanted to give the homepage/QuickStart a more customized and polished look. The goal was just to make the homepage a little bit nicer! 🙂 As I had started doing in this PR: #443

I get it, but then why not opting for customizations through CSS? Is it something you considered or did you have any problem with it?

I’ll try to see what I can do by tweaking the CSS a little, without creating any custom components 💪🏻

@ilteoood

Copy link
Copy Markdown
Contributor

Honestly I don't understand why we need this. All the 3 features that you highlighted are already available even with the default codeblock, here follows an example: image
Consider also that creating a new component makes the migration to the new versions of docusaurus harder than what they already are.

Thanks for the review! You're absolutely right, the default configuration supports these features. The primary reason was purely aesthetic: I wanted to give the homepage/QuickStart a more customized and polished look. The goal was just to make the homepage a little bit nicer! 🙂 As I had started doing in this PR: #443

I get it, but then why not opting for customizations through CSS? Is it something you considered or did you have any problem with it?

I’ll try to see what I can do by tweaking the CSS a little, without creating any custom components 💪🏻

Thank you so much, please keep me posted!

@Tony133 Tony133 changed the title feat(QuickStart): replace Docusaurus CodeBlock with custom component feat(QuickStart): replace Docusaurus CodeBlock styles Jun 27, 2026
@Tony133

Tony133 commented Jun 27, 2026

Copy link
Copy Markdown
Member Author

@ilteoood As soon as you have time, I made a change via CSS without using custom components, see commit here: 34fe371

I've also updated the screenshots in the PR description 🙌

@@ -0,0 +1,99 @@
.subLabel {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Considering that you are wrapping everything with the qsCodeBlock class, do you still need this?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Considering that you are wrapping everything with the qsCodeBlock class, do you still need this?

removed, see commit here: b2b0097

.qsCodeblock [role='tabpanel'],
.qsCodeblock [class*='codeBlockContainer'],
.qsCodeblock [class*='codeBlockContent'] pre {
margin: 0 !important;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are these important really needed?
Maybe by using a more specific selector we can get rid of them

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are these important really needed? Maybe by using a more specific selector we can get rid of them

see commit here: dee94c9

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants