Skip to content

WEB: Add code highlighting in PDEPs and render tables correctly #51458

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

Merged
merged 1 commit into from
Feb 26, 2023

Conversation

lithomas1
Copy link
Member

@lithomas1 lithomas1 commented Feb 17, 2023

  • closes #xxxx (Replace xxxx with the GitHub issue number)
  • Tests added and passed if fixing a bug or adding a new feature
  • All code checks passed.
  • Added type annotations to new arguments/methods/functions.
  • Added an entry in the latest doc/source/whatsnew/vX.X.X.rst file if fixing a bug or adding a new feature.

Discovered that tables were rendering really nastily and there was no code highlighting so PDEPs were looking a little bland while working on PDEP 7.

Note: The codehilite.css file that I added was generated by pygments, and is based on the friendly style
(I'll try to find the pydata-sphinx-theme style css file though).

@lithomas1 lithomas1 added Web pandas website PDEP pandas enhancement proposal labels Feb 17, 2023
@lithomas1
Copy link
Member Author

Nvm, we basically have the same thing as pydata-sphinx-theme, the only difference is that we don't have the box around the code block so it still looks kinda nasty.

@lithomas1 lithomas1 marked this pull request as ready for review February 17, 2023 17:20
@lithomas1
Copy link
Member Author

image

This is what it looks like.

@jorisvandenbossche
Copy link
Member

We clearly have been noticing the same things ;) The last days, I was thinking we could also use sphinx (with myst) instead to solve many of those issues. I wrote up #51461 about that

Copy link
Member

@datapythonista datapythonista left a comment

Choose a reason for hiding this comment

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

Lookg great, thanks @lithomas1

@@ -418,6 +418,9 @@ def main(
body = markdown.markdown(
content, extensions=context["main"]["markdown_extensions"]
)
# Apply Bootstrap's table formatting manually
# Python-Markdown doesn't let us config table attributes by hand
body = body.replace("<table>", '<table class="table table-bordered">')
Copy link
Member

Choose a reason for hiding this comment

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

Really nice. At some point I thought on creating a plugin for python markdown to do this (the core dev doesn't want to add anything into the project, which is probably good). But didn't think about this as a workaround.

@datapythonista
Copy link
Member

Preview docs at: https://pandas.pydata.org/preview/51458/

@datapythonista
Copy link
Member

Looks like you're changing the background color of the navigation bar, not sure if that's intended. I like how it looks like actually, but feels like this PR shouldn't change it, right?

Also, we can address it in a follow up PR, but I think we can add some padding and maybe a border to the code boxes: https://pandas.pydata.org/preview/51458/pdeps/0004-consistent-to-datetime-parsing.html

Happy to take care of that myself in a follow up PR, but probably easy to add it here too.

@datapythonista
Copy link
Member

Looks like you're changing the background color of the navigation bar, not sure if that's intended. I like how it looks like actually, but feels like this PR shouldn't change it, right?

My bad. Just realized now that I'm in a different monitor, where the color looks darker. Interesting that everything else looks the same, except of our navigation bar. Sorry about the noise.

@datapythonista datapythonista removed the PDEP pandas enhancement proposal label Feb 26, 2023
@datapythonista datapythonista merged commit 44e07b2 into pandas-dev:main Feb 26, 2023
@datapythonista
Copy link
Member

Also, we can address it in a follow up PR, but I think we can add some padding and maybe a border to the code boxes: https://pandas.pydata.org/preview/51458/pdeps/0004-consistent-to-datetime-parsing.html

Thanks @lithomas1. I think we can address the above comment in a follow up, but nice improvement to the website!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Web pandas website
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants