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: Format code blocks at build time #9373

Merged
merged 4 commits into from
May 8, 2024
Merged

feat: Format code blocks at build time #9373

merged 4 commits into from
May 8, 2024

Conversation

a-hariti
Copy link
Collaborator

@a-hariti a-hariti commented Mar 7, 2024

Pre-merge checklist

If you work at Sentry, you're able to merge your own PR without review, but please don't unless there's a good reason.

  • Checked Vercel preview for correctness, including links
  • PR was reviewed and approved by any necessary SMEs
  • PR was reviewed and approved by a member of the Sentry docs team

Description of changes

Format code blocks at build time in a transpilation fashion using Prettier

Ignores code blocks with diff metadata to avoid confusion due to leading + and - characters

Right now supports languages that are supported of the box by Prettier, there's room for more support for other languages through plugins

resolves #9057

Copy link

vercel bot commented Mar 7, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
sentry-docs ✅ Ready (Inspect) Visit Preview 💬 Add feedback May 8, 2024 11:07am

src/remark-format-code.js Outdated Show resolved Hide resolved
@a-hariti
Copy link
Collaborator Author

a-hariti commented Mar 7, 2024

PHP plugin seems to choke on the top level public keyword on this line although it's a normal pattern in Laravel

I will wait on this for now until we have a clear idea of the preferred code formatting conventions among PHP developers

@a-hariti a-hariti changed the title [Draft] feat: format code blocks at build time feat: format code blocks at build time Mar 7, 2024
@getsantry
Copy link
Contributor

getsantry bot commented Mar 29, 2024

This pull request has gone three weeks without activity. In another week, I will close it.

But! If you comment or otherwise update it, I will reset the clock, and if you add the label WIP, I will leave it alone unless WIP is removed ... forever!


"A weed is but an unloved flower." ― Ella Wheeler Wilcox 🥀

@getsantry getsantry bot added the Stale label Mar 29, 2024
Copy link
Member

@lforst lforst left a comment

Choose a reason for hiding this comment

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

If this works :shipit:

@getsantry getsantry bot closed this Apr 10, 2024
@lforst lforst reopened this Apr 10, 2024
@getsantry getsantry bot closed this Apr 18, 2024
@lforst lforst reopened this Apr 18, 2024
@getsantry getsantry bot closed this Apr 26, 2024
@lforst lforst reopened this Apr 26, 2024
@getsantry getsantry bot closed this May 5, 2024
@lforst lforst reopened this May 6, 2024
Copy link

codecov bot commented May 8, 2024

Bundle Report

Changes will increase total bundle size by 1.55kB ⬆️

Bundle name Size Change
sentry-docs-server 7.43MB 1.56kB ⬆️
sentry-docs-edge-server 456.19kB 3 bytes ⬇️
sentry-docs-client 6.16MB 8 bytes ⬇️

@a-hariti
Copy link
Collaborator Author

a-hariti commented May 8, 2024

Can we push this through @lforst?

@lforst lforst changed the title feat: format code blocks at build time feat: Format code blocks at build time May 8, 2024
@lforst lforst merged commit 6aefdcb into master May 8, 2024
8 checks passed
@lforst lforst deleted the format-code-blocks branch May 8, 2024 14:44
@github-actions github-actions bot locked and limited conversation to collaborators May 24, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Format code blocks during build for consistent styling
2 participants