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

www: add language switcher to code blocks #1623

Draft
wants to merge 11 commits into
base: main
Choose a base branch
from

Conversation

marvinhagemeister
Copy link
Collaborator

@marvinhagemeister marvinhagemeister commented Aug 12, 2023

This PR spices up the code blocks quite a bit. It adds a language selector so that you can switch between TypeScript/JavaScript code. The setting is persisted in local store and is applied globally to all code blocks.

On top of that the PR adds the ability to add a title to a code block so that it tells the user what they're looking at. In most cases that will be the file name.

The marked smartypants plugin doesn't work with the latest marked version. The previous plugin would parse the final generated HTML again anyway instead of just tapping into marked's parser. So I've hand rolled our own smartypants.

fresh-code-blocks.mp4
@lino-levan
Copy link
Contributor

Would be cool if there was a copy button, giving that we're rolling our own codeblocks anyways.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
www-or-docs This PR adds docs.
2 participants