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

Style code blocks after GitHub #784

Merged
merged 4 commits into from
Jul 7, 2022
Merged

Conversation

choldgraf
Copy link
Collaborator

@choldgraf choldgraf commented Jul 5, 2022

This makes a few small modifications to our code blocks to take some inspiration from the GitHub code block styling. Here are the major changes:

  • Adds support for code block titles
  • Slightly increases the padding of our code blocks to match what GitHub uses (1rem)

Below are a few GIFs to show the old / new behavior:

Code blocks

chrome_61osAOURx2

Notebooks

chrome_HFrj9ZXvWF

closes #783

Feedback?

I know this is a slight visual change to the code blocks, so if anybody disagrees with the change let me know. My rationale is that we are not design experts, and debating whether padding should be 10px or 16px is probably not a good use of our time, and so we should just pick a design system that is well-used and thoughtful regarding code, and follow that (thus, GitHub styles). Personally, I also think the extra spacing is a little bit cleaner and nicer for reading.

@@ -4,4 +4,7 @@
*/
// This will impact the top offset for many sections
--pst-header-height: 3rem;

// Border radius
--pst-border-radius: 0.2rem;
Copy link
Collaborator

Choose a reason for hiding this comment

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

is this new variable getting used anywhere? I don't see it in the diff...

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

whoops - you're right, will remove

Copy link
Collaborator

@12rambau 12rambau left a comment

Choose a reason for hiding this comment

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

I would say the best UI improvements are the one people don't detect because they feel naturals. This one is one of them.

Nothing to add from my side

@choldgraf choldgraf added this to the 0.10 milestone Jul 6, 2022
@choldgraf
Copy link
Collaborator Author

OK it seems like folks are generally happy with this one, so I'll merge it in and we can iterate in subsequent PRs, thanks for the feedback!

@choldgraf choldgraf merged commit 94a9e8c into pydata:main Jul 7, 2022
@choldgraf choldgraf deleted the code-caption branch July 7, 2022 07:40
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.

Make code block titles follow GitHub code block styles
3 participants