{"id":27938231,"url":"https://github.com/fedify-dev/markdown-it-mention","last_synced_at":"2025-05-07T08:26:58.387Z","repository":{"id":238877644,"uuid":"797823195","full_name":"fedify-dev/markdown-it-mention","owner":"fedify-dev","description":"A markdown-it plugin that parses and renders Mastodon-style @mentions","archived":false,"fork":false,"pushed_at":"2025-03-11T09:54:59.000Z","size":33,"stargazers_count":8,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-05-03T17:15:42.510Z","etag":null,"topics":["fediverse","markdown","markdown-it","markdown-it-plugin","mention"],"latest_commit_sha":null,"homepage":"https://jsr.io/@fedify/markdown-it-mention","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/fedify-dev.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGES.md","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":"2024-05-08T15:31:30.000Z","updated_at":"2025-03-11T09:55:03.000Z","dependencies_parsed_at":"2024-05-08T17:14:57.759Z","dependency_job_id":"c690583f-38c1-47a2-a3a1-3f2d5cfdc6fd","html_url":"https://github.com/fedify-dev/markdown-it-mention","commit_stats":null,"previous_names":["dahlia/markdown-it-mention","fedify-dev/markdown-it-mention"],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fedify-dev%2Fmarkdown-it-mention","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fedify-dev%2Fmarkdown-it-mention/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fedify-dev%2Fmarkdown-it-mention/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fedify-dev%2Fmarkdown-it-mention/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/fedify-dev","download_url":"https://codeload.github.com/fedify-dev/markdown-it-mention/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252338842,"owners_count":21732034,"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":["fediverse","markdown","markdown-it","markdown-it-plugin","mention"],"created_at":"2025-05-07T08:26:57.552Z","updated_at":"2025-05-07T08:26:58.367Z","avatar_url":"https://github.com/fedify-dev.png","language":"TypeScript","readme":"\u003c!-- deno-fmt-ignore-file --\u003e\n\n@fedify/markdown-it-mention\n===========================\n\n[![JSR][JSR badge]][JSR]\n[![npm][npm badge]][npm]\n[![GitHub Actions][GitHub Actions badge]][GitHub Actions]\n\nThis is a [markdown-it] plugin that parses and renders Mastodon-style @mentions,\ne.g., `@username@domain.com`.  It converts them to a link, e.g.:\n\n~~~~ html\n\u003ca href=\"acct:@username@domain.com\"\u003e\u003cspan class=\"at\"\u003e@\u003c/span\u003e\u003cspan\n  class=\"user\"\u003eusername\u003c/span\u003e\u003c/a\u003e\n~~~~\n\nThe value of `href` attributes, other attributes (if any), and the content of\nthe link can be customized by passing [options] to the plugin:\n\n~~~~ typescript\nimport MarkdownIt from \"markdown-it\";\nimport { mention, toFullHandle } from \"@fedify/markdown-it-mention\";\n\nconst md = new MarkdownIt();\nmd.use(mention, {\n  link: (handle: string, env: any) =\u003e `https://example.com/${handle}`,\n  linkAttributes: (handle: string, env: any) =\u003e ({ class: \"mention\" }),\n  label: toFullHandle,\n});\n~~~~\n\n\u003e [!TIP]\n\u003e The `link` callback can return `null` to disable the link.\n\nIf you want to collect all the handles mentioned in the document, you can pass\nthe environment object to the `render()` method:\n\n~~~~ typescript\nconst env = {};\nmd.render(\n  \"# Hello, @foo@bar.com\\n\\n\u003e @baz@qux.com\",\n  env,\n);\nconsole.log(env.mentions);  // [\"@foo@bar.com\", \"@baz@qux.com\"]\n~~~~\n\n[JSR]: https://jsr.io/@fedify/markdown-it-mention\n[JSR badge]: https://jsr.io/badges/@fedify/markdown-it-mention\n[npm]: https://www.npmjs.com/package/@fedify/markdown-it-mention\n[npm badge]: https://img.shields.io/npm/v/%40fedify%2Fmarkdown-it-mention?logo=npm\n[GitHub Actions]: https://github.com/fedify-dev/markdown-it-mention/actions/workflows/main.yaml\n[GitHub Actions badge]: https://github.com/fedify-dev/markdown-it-mention/actions/workflows/main.yaml/badge.svg\n[markdown-it]: https://github.com/markdown-it/markdown-it\n[options]: https://jsr.io/@fedify/markdown-it-mention/doc/~/PluginOptions\n\n\nInstallation\n------------\n\n### Deno\n\n~~~~ sh\ndeno add jsr:@fedify/markdown-it-mention\n~~~~\n\n### Node.js\n\n~~~~ sh\nnpm add @fedify/markdown-it-mention\n~~~~\n\n### Bun\n\n~~~~ sh\nbun add @fedify/markdown-it-mention\n~~~~\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffedify-dev%2Fmarkdown-it-mention","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffedify-dev%2Fmarkdown-it-mention","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffedify-dev%2Fmarkdown-it-mention/lists"}