Skip to content

Add ability to disable OS detection in kbd shortcode? #13489

@cscheid

Description

@cscheid

Discussed in #13487

Originally posted by andrewheiss October 1, 2025

Description

The kbd shortcode is really helpful for formatting keyboard shortcuts across operating systems.

In Javascript-enabled outputs, it uses some fancy logic to replace keys with their macOS equivalents, so that Command becomes ⌘, and so on.

This is great for documents that can adapt to the reader's OS. For teaching with slideshows, though, it's a little trickier because the Javascript OS-detection can't be disabled.

For instance, suppose I have this revealjs slidehow:

---
title: "Cross-platform kbd"
format: revealjs
---

## Rendering

To render:

- macOS: {{< kbd Command-Shift-K >}}
- Windows: {{< kbd Ctrl-Shift-K >}}

If I'm showing the slides in a classroom setting using a computer running macOS, the Windows shortcut displays as ^⇧K

image

Similarly, if I'm showing the slides from a computer with Windows, the macOS shortcut displays as Command-Shift-K

image

As far as I can tell, there's no way to use the kbd shortcode to get output like this:

image

It might be helpful for teaching purposes to have a setting/option for the kbd shortcode to disable to OS detection

Metadata

Metadata

Assignees

Labels

enhancementNew feature or requestshortcodesissues related to shortcodes

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions