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

Add Syntax highglighting for package pages #1347

Merged
merged 2 commits into from
Nov 24, 2024

Conversation

MangoIV
Copy link
Contributor

@MangoIV MangoIV commented Nov 24, 2024

Use prism.js to add syntax highlighting to package pages.

Justification:

  • makes landing pages much more readable
  • jdelivr CDN is already in use
  • prism.js isn't big
  • languages are automatically loaded as needed

- This is useful because that way you can ingest single packages
@MangoIV
Copy link
Contributor Author

MangoIV commented Nov 24, 2024

Unfortunately, GitHub seems to have trouble so I cannot upload a screenshot. I will do that later.

@MangoIV
Copy link
Contributor Author

MangoIV commented Nov 24, 2024

before

image

@MangoIV
Copy link
Contributor Author

MangoIV commented Nov 24, 2024

I added theme awareness and chose themes that fit hackage-server as it is now better:

light

image

dark

image

alternate light theme

image

- use jsdelivr to source prismjs (already used for maths)
- change radius of pre html element to 3px (same as for search box)
- dynamically load language highlighting as required
- load solarized light as the light theme and tomorrow night as the dark
  theme
@MangoIV
Copy link
Contributor Author

MangoIV commented Nov 24, 2024

base download (without any syntax highlighted) is 10kb and then for haskell syntax highlighting another 2kb. It is only triggered if the package has a README.

@gbaz gbaz merged commit 962b6d7 into haskell:master Nov 24, 2024
1 check passed
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