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

Custom <pre> / <code> attributes #220

Closed
naiyerasif opened this issue Sep 3, 2021 · 1 comment · Fixed by #243
Closed

Custom <pre> / <code> attributes #220

naiyerasif opened this issue Sep 3, 2021 · 1 comment · Fixed by #243

Comments

@naiyerasif
Copy link

Please consider a way to add custom attributes on pre / code elements. Some usecases:

  • Keyboard navigation of codeblocks: To make the codeblocks accessible for keyboard users, tabindex = "0" should be set on pre element so that they can scroll them with keyboard. As a short-term goal, we can add tabindex = "0" by default. In long-term, we can still keep tabindex="0" as default but allow people to customize it. More details can be found here: https://accessibilityinsights.io/info-examples/web/scrollable-region-focusable/
  • Adding [data-*] attributes for customizing the behavior of codeblocks, e.g., adding a "Copy to Clipboard" button for specific codeblocks, displaying codeblock title, language, etc.
@fengzilong
Copy link
Contributor

fengzilong commented Oct 9, 2021

I'm willing to work on a PR for this feature when I get off work

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

Successfully merging a pull request may close this issue.

3 participants