{"id":15927370,"url":"https://github.com/uncenter/markdown-it-kbd-better","last_synced_at":"2025-11-19T07:30:21.040Z","repository":{"id":155634593,"uuid":"632638340","full_name":"uncenter/markdown-it-kbd-better","owner":"uncenter","description":"⌨️ Markdown-it syntax add-on for the \u003ckbd\u003e tag, but with tiny improvements.","archived":false,"fork":false,"pushed_at":"2024-01-01T23:58:25.000Z","size":8137,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-02-15T19:49:36.947Z","etag":null,"topics":["markdown-it","markdown-it-plugin"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/markdown-it-kbd-better","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/uncenter.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-04-25T20:30:48.000Z","updated_at":"2024-06-30T18:37:41.000Z","dependencies_parsed_at":null,"dependency_job_id":"f265ca96-eee2-4710-bd2a-e67806180bea","html_url":"https://github.com/uncenter/markdown-it-kbd-better","commit_stats":null,"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/uncenter%2Fmarkdown-it-kbd-better","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/uncenter%2Fmarkdown-it-kbd-better/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/uncenter%2Fmarkdown-it-kbd-better/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/uncenter%2Fmarkdown-it-kbd-better/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/uncenter","download_url":"https://codeload.github.com/uncenter/markdown-it-kbd-better/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":239619570,"owners_count":19669447,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["markdown-it","markdown-it-plugin"],"created_at":"2024-10-06T23:01:03.283Z","updated_at":"2025-11-19T07:30:20.819Z","avatar_url":"https://github.com/uncenter.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# markdown-it-kbd-better\n\nThis is a fork of [markdown-it-kbd](https://github.com/jGleitz/markdown-it-kbd) with some tiny improvements just for myself.\n\nNotably, it includes the following changes:\n\n-   Support for replacing key names with values using a map (e.g. `mac:cmd` -\u003e `⌘`). Fully customizable in the options, add your own replacements or disable it completely. Comes with a built-in preset for replacing some common keys with icons. You could use this to make macros like `copy` to `⌘+C` or `win:ctrl` to `⊞+Ctrl`.\n-   Support for transforming key names with a custom function (e.g. adding a prefix to all keys or capitalizing them). Fully customizable in the options, add your own transformations or disable it completely.\n-   Support for case-sensitive key matching. Fully customizable in the options, disable it if you don't need it.\n\n## Installation\n\n```sh\nnpm i markdown-it-kbd-better\npnpm add markdown-it-kbd-better\nyarn add markdown-it-kbd-better\nbun add markdown-it-kbd-better\n```\n\n## Usage\n\n```js\nconst markdownIt = require('markdown-it');\nconst markdownItKbd = require('markdown-it-kbd-better');\n\nconst md = markdownIt().use(markdownItKbd);\n```\n\n## Options\n\n### `presets`\n\nDefault: `[]`\n\nEnable built-in presets. Currently, the only built-in preset is `icons`, which replaces keys like `cmd` with `⌘`, but more may be added in the future (feel free to open an issue if you have a suggestion).\n\nTo enable the `icons` preset, use the following:\n\n```js\n.use(markdownItKbd, {\n    presets: [{\n        name: 'icons'\n    }]\n});\n```\n\nYou can optionally pass `prefix` as well, which is used to prefix the key name. For example, if you wanted to match `icon:cmd` (prefixed with `icon:`) instead of `cmd`, you could use the following:\n\n```js\n.use(markdownItKbd, {\n    presets: [\n        {\n            name: 'icons',\n            prefix: 'icon:'\n        }\n    ]\n});\n```\n\n### `keyMap`\n\nDefault: `{}`\n\nA map of keys and values to replace. If the content of a KBD element is present in this map, it will be replaced with the corresponding value. You can use it to replace symbols like with the `icons` preset, or maybe phrases like \"copy\":\n\n```js\n.use(markdownItKbd, {\n    keyMap: {\n        copy: '⌘+C'\n    }\n});\n```\n\n### `caseSensitive`\n\nDefault: `false`\n\nWhether or not to match keys in a case-sensitive manner. If this is set to `false`, all keys will be converted to lowercase before being matched. Otherwise, they will be matched exactly as they appear in the map.\n\n### `transform`\n\nDefault: `return content;` (no transformation)\n\nA function that transforms the content. This is useful for things like capitalizing the key name or adding a prefix to it.\n\nFor example, you could capitalize all key names:\n\n```js\n.use(markdownItKbd, {\n    transform: (content: string) =\u003e {\n        return content.toUpperCase();\n    }\n});\n```\n\nOr you could add a text to all key names:\n\n```js\n.use(markdownItKbd, {\n    transform: (content: string) =\u003e {\n        return `Key: ${content}`;\n    }\n});\n```\n\n## License\n\n[MIT](LICENSE)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Funcenter%2Fmarkdown-it-kbd-better","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Funcenter%2Fmarkdown-it-kbd-better","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Funcenter%2Fmarkdown-it-kbd-better/lists"}