{"id":15652706,"url":"https://github.com/jaywcjlove/rehype-attr","last_synced_at":"2026-03-16T03:02:00.972Z","repository":{"id":43359812,"uuid":"367331314","full_name":"jaywcjlove/rehype-attr","owner":"jaywcjlove","description":"New syntax to add attributes to Markdown.","archived":false,"fork":false,"pushed_at":"2024-06-25T04:12:46.000Z","size":315,"stargazers_count":32,"open_issues_count":3,"forks_count":1,"subscribers_count":3,"default_branch":"main","last_synced_at":"2024-10-29T22:02:31.919Z","etag":null,"topics":["ast","html","javascript","markdown","rehype","rehype-plugin","remark","unified"],"latest_commit_sha":null,"homepage":"https://jaywcjlove.github.io/rehype-attr","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/jaywcjlove.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","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},"funding":{"ko_fi":"jaywcjlove","buy_me_a_coffee":"jaywcjlove","custom":["https://www.paypal.me/kennyiseeyou","https://jaywcjlove.github.io/#/sponsor"]}},"created_at":"2021-05-14T10:43:06.000Z","updated_at":"2024-09-26T16:12:29.000Z","dependencies_parsed_at":"2023-01-31T07:45:30.786Z","dependency_job_id":"8f4be8ee-762d-4479-9e51-c8e38448cf98","html_url":"https://github.com/jaywcjlove/rehype-attr","commit_stats":{"total_commits":195,"total_committers":4,"mean_commits":48.75,"dds":"0.24102564102564106","last_synced_commit":"7dbc78d279a2d78106197bc75e195846ef70770d"},"previous_names":[],"tags_count":37,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jaywcjlove%2Frehype-attr","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jaywcjlove%2Frehype-attr/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jaywcjlove%2Frehype-attr/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jaywcjlove%2Frehype-attr/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jaywcjlove","download_url":"https://codeload.github.com/jaywcjlove/rehype-attr/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247857296,"owners_count":21007738,"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":["ast","html","javascript","markdown","rehype","rehype-plugin","remark","unified"],"created_at":"2024-10-03T12:43:26.107Z","updated_at":"2026-03-16T03:02:00.966Z","avatar_url":"https://github.com/jaywcjlove.png","language":"TypeScript","funding_links":["https://ko-fi.com/jaywcjlove","https://buymeacoffee.com/jaywcjlove","https://www.paypal.me/kennyiseeyou","https://jaywcjlove.github.io/#/sponsor"],"categories":[],"sub_categories":[],"readme":"\u003cdiv markdown=\"1\"\u003e\n  \u003csup\u003eUsing \u003ca href=\"https://wangchujiang.com/#/app\" target=\"_blank\"\u003emy app\u003c/a\u003e is also a way to \u003ca href=\"https://wangchujiang.com/#/sponsor\" target=\"_blank\"\u003esupport\u003c/a\u003e me:\u003c/sup\u003e\n  \u003cbr\u003e\n  \u003ca target=\"_blank\" href=\"https://apps.apple.com/app/6758053530\" title=\"Scap: Screenshot \u0026 Markup Edit for macOS\"\u003e\u003cimg alt=\"Scap: Screenshot \u0026 Markup Edit\" height=\"52\" width=\"52\" src=\"https://wangchujiang.com/appicon/scap.png\"\u003e\u003c/a\u003e\n  \u003ca target=\"_blank\" href=\"https://apps.apple.com/app/6757317079\" title=\"Screen Test for macOS\"\u003e\u003cimg alt=\"Screen Test\" height=\"52\" width=\"52\" src=\"https://wangchujiang.com/appicon/screen-test.png\"\u003e\u003c/a\u003e\n  \u003ca target=\"_blank\" href=\"https://apps.apple.com/app/Deskmark/6755948110\" title=\"Deskmark for macOS\"\u003e\u003cimg alt=\"Deskmark\" height=\"52\" width=\"52\" src=\"https://wangchujiang.com/appicon/deskmark.png\"\u003e\u003c/a\u003e\n  \u003ca target=\"_blank\" href=\"https://apps.apple.com/app/Keyzer/6500434773\" title=\"Keyzer for macOS\"\u003e\u003cimg alt=\"Keyzer\" height=\"52\" width=\"52\" src=\"https://wangchujiang.com/appicon/keyzer.png\"\u003e\u003c/a\u003e\n  \u003ca target=\"_blank\" href=\"https://github.com/jaywcjlove/vidwall-hub\" title=\"Vidwall Hub for macOS\"\u003e\u003cimg alt=\"Vidwall Hub\" height=\"52\" width=\"52\" src=\"https://wangchujiang.com/appicon/vidwall-hub.png\"\u003e\u003c/a\u003e\n  \u003ca target=\"_blank\" href=\"https://apps.apple.com/app/VidCrop/6752624705\" title=\"VidCrop for macOS\"\u003e\u003cimg alt=\"VidCrop\" height=\"52\" width=\"52\" src=\"https://wangchujiang.com/appicon/vidcrop.png\"\u003e\u003c/a\u003e\n  \u003ca target=\"_blank\" href=\"https://apps.apple.com/app/Vidwall/6747587746\" title=\"Vidwall for macOS\"\u003e\u003cimg alt=\"Vidwall\" height=\"52\" width=\"52\" src=\"https://wangchujiang.com/appicon/vidwall.png\"\u003e\u003c/a\u003e\n  \u003ca target=\"_blank\" href=\"https://wangchujiang.com/mousio-hint/\" title=\"Mousio Hint for macOS\"\u003e\u003cimg alt=\"Mousio Hint\" height=\"52\" width=\"52\" src=\"https://wangchujiang.com/appicon/mousio-hint.png\"\u003e\u003c/a\u003e\n  \u003ca target=\"_blank\" href=\"https://apps.apple.com/app/6746747327\" title=\"Mousio for macOS\"\u003e\u003cimg alt=\"Mousio\" height=\"52\" width=\"52\" src=\"https://wangchujiang.com/appicon/mousio.png\"\u003e\u003c/a\u003e\n  \u003ca target=\"_blank\" href=\"https://apps.apple.com/app/6745227444\" title=\"Musicer for macOS\"\u003e\u003cimg alt=\"Musicer\" height=\"52\" width=\"52\" src=\"https://wangchujiang.com/appicon/musicer.png\"\u003e\u003c/a\u003e\n  \u003ca target=\"_blank\" href=\"https://apps.apple.com/app/6743841447\" title=\"Audioer for macOS\"\u003e\u003cimg alt=\"Audioer\" height=\"52\" width=\"52\" src=\"https://wangchujiang.com/appicon/audioer.png\"\u003e\u003c/a\u003e\n  \u003ca target=\"_blank\" href=\"https://apps.apple.com/app/6744690194\" title=\"FileSentinel for macOS\"\u003e\u003cimg alt=\"FileSentinel\" height=\"52\" width=\"52\" src=\"https://wangchujiang.com/appicon/file-sentinel.png\"\u003e\u003c/a\u003e\n  \u003ca target=\"_blank\" href=\"https://apps.apple.com/app/6743495172\" title=\"FocusCursor for macOS\"\u003e\u003cimg alt=\"FocusCursor\" height=\"52\" width=\"52\" src=\"https://wangchujiang.com/appicon/focus-cursor.png\"\u003e\u003c/a\u003e\n  \u003ca target=\"_blank\" href=\"https://apps.apple.com/app/6742680573\" title=\"Videoer for macOS\"\u003e\u003cimg alt=\"Videoer\" height=\"52\" width=\"52\" src=\"https://wangchujiang.com/appicon/videoer.png\"\u003e\u003c/a\u003e\n  \u003ca target=\"_blank\" href=\"https://apps.apple.com/app/6740425504\" title=\"KeyClicker for macOS\"\u003e\u003cimg alt=\"KeyClicker\" height=\"52\" width=\"52\" src=\"https://wangchujiang.com/appicon/key-clicker.png\"\u003e\u003c/a\u003e\n  \u003ca target=\"_blank\" href=\"https://apps.apple.com/app/6739052447\" title=\"DayBar for macOS\"\u003e\u003cimg alt=\"DayBar\" height=\"52\" width=\"52\" src=\"https://wangchujiang.com/appicon/daybar.png\"\u003e\u003c/a\u003e\n  \u003ca target=\"_blank\" href=\"https://apps.apple.com/app/6739444407\" title=\"Iconed for macOS\"\u003e\u003cimg alt=\"Iconed\" height=\"52\" width=\"52\" src=\"https://wangchujiang.com/appicon/iconed.png\"\u003e\u003c/a\u003e\n  \u003ca target=\"_blank\" href=\"https://apps.apple.com/app/6737160756\" title=\"Mousio for macOS\"\u003e\u003cimg alt=\"Mousio\" height=\"52\" width=\"52\" src=\"https://wangchujiang.com/appicon/rightmenu-master.png\"\u003e\u003c/a\u003e\n  \u003ca target=\"_blank\" href=\"https://apps.apple.com/app/6723903021\" title=\"Paste Quick for macOS\"\u003e\u003cimg alt=\"Quick RSS\" height=\"52\" width=\"52\" src=\"https://wangchujiang.com/appicon/paste-quick.png\"\u003e\u003c/a\u003e\n  \u003ca target=\"_blank\" href=\"https://apps.apple.com/app/6670696072\" title=\"Quick RSS for macOS/iOS\"\u003e\u003cimg alt=\"Quick RSS\" height=\"52\" width=\"52\" src=\"https://wangchujiang.com/appicon/quick-rss.png\"\u003e\u003c/a\u003e\n  \u003ca target=\"_blank\" href=\"https://apps.apple.com/app/6670167443\" title=\"Web Serve for macOS\"\u003e\u003cimg alt=\"Web Serve\" height=\"52\" width=\"52\" src=\"https://wangchujiang.com/appicon/web-serve.png\"\u003e\u003c/a\u003e\n  \u003ca target=\"_blank\" href=\"https://apps.apple.com/app/6503953628\" title=\"Copybook Generator for macOS/iOS\"\u003e\u003cimg alt=\"Copybook Generator\" height=\"52\" width=\"52\" src=\"https://wangchujiang.com/appicon/copybook-generator.png\"\u003e\u003c/a\u003e\n  \u003ca target=\"_blank\" href=\"https://apps.apple.com/app/6471227008\" title=\"DevTutor for macOS/iOS\"\u003e\u003cimg alt=\"DevTutor for SwiftUI\" height=\"52\" width=\"52\" src=\"https://wangchujiang.com/appicon/devtutor.png\"\u003e\u003c/a\u003e\n  \u003ca target=\"_blank\" href=\"https://apps.apple.com/app/6479819388\" title=\"RegexMate for macOS/iOS\"\u003e\u003cimg alt=\"RegexMate\" height=\"52\" width=\"52\" src=\"https://wangchujiang.com/appicon/regex-mate.png\"\u003e\u003c/a\u003e\n  \u003ca target=\"_blank\" href=\"https://apps.apple.com/app/6479194014\" title=\"Time Passage for macOS/iOS\"\u003e\u003cimg alt=\"Time Passage\" height=\"52\" width=\"52\" src=\"https://wangchujiang.com/appicon/time-passage.png\"\u003e\u003c/a\u003e\n  \u003ca target=\"_blank\" href=\"https://apps.apple.com/app/6478772538\" title=\"IconizeFolder for macOS\"\u003e\u003cimg alt=\"Iconize Folder\" height=\"52\" width=\"52\" src=\"https://wangchujiang.com/appicon/iconize-folder.png\"\u003e\u003c/a\u003e\n  \u003ca target=\"_blank\" href=\"https://apps.apple.com/app/6478511402\" title=\"Textsound Saver for macOS/iOS\"\u003e\u003cimg alt=\"Textsound Saver\" height=\"52\" width=\"52\" src=\"https://wangchujiang.com/appicon/textsound-saver.png\"\u003e\u003c/a\u003e\n  \u003ca target=\"_blank\" href=\"https://apps.apple.com/app/6476924627\" title=\"Create Custom Symbols for macOS\"\u003e\u003cimg alt=\"Create Custom Symbols\" height=\"52\" width=\"52\" src=\"https://wangchujiang.com/appicon/create-custom-symbols.png\"\u003e\u003c/a\u003e\n  \u003ca target=\"_blank\" href=\"https://apps.apple.com/app/6476452351\" title=\"DevHub for macOS\"\u003e\u003cimg alt=\"DevHub\" height=\"52\" width=\"52\" src=\"https://wangchujiang.com/appicon/devhub.png\"\u003e\u003c/a\u003e\n  \u003ca target=\"_blank\" href=\"https://apps.apple.com/app/6476400184\" title=\"Resume Revise for macOS\"\u003e\u003cimg alt=\"Resume Revise\" height=\"52\" width=\"52\" src=\"https://wangchujiang.com/appicon/resume-revise.png\"\u003e\u003c/a\u003e\n  \u003ca target=\"_blank\" href=\"https://apps.apple.com/app/6472593276\" title=\"Palette Genius for macOS\"\u003e\u003cimg alt=\"Palette Genius\" height=\"52\" width=\"52\" src=\"https://wangchujiang.com/appicon/palette-genius.png\"\u003e\u003c/a\u003e\n  \u003ca target=\"_blank\" href=\"https://apps.apple.com/app/6470879005\" title=\"Symbol Scribe for macOS\"\u003e\u003cimg alt=\"Symbol Scribe\" height=\"52\" width=\"52\" src=\"https://wangchujiang.com/appicon/symbol-scribe.png\"\u003e\u003c/a\u003e\n\u003c/div\u003e\n\u003chr\u003e\n\nrehype-attr\n===\n\n[![Buy me a coffee](https://img.shields.io/badge/Buy_Me_a_Coffee-ffdd00?logo=buy-me-a-coffee\u0026logoColor=black)](https://jaywcjlove.github.io/#/sponsor)\n[![Follow On X](https://img.shields.io/badge/Follow%20on%20X-333333?logo=x\u0026logoColor=white)](https://x.com/jaywcjlove)\n[![Downloads](https://img.shields.io/npm/dm/rehype-attr.svg?style=flat)](https://www.npmjs.com/package/rehype-attr)\n[![NPM version](https://img.shields.io/npm/v/rehype-attr.svg?style=flat)](https://npmjs.org/package/rehype-attr)\n[![Build](https://github.com/jaywcjlove/rehype-attr/actions/workflows/ci.yml/badge.svg)](https://github.com/jaywcjlove/rehype-attr/actions/workflows/ci.yml)\n[![Coverage Status](https://jaywcjlove.github.io/rehype-attr/badges.svg)](https://jaywcjlove.github.io/rehype-attr/lcov-report/)\n[![Repo Dependents](https://badgen.net/github/dependents-repo/jaywcjlove/rehype-attr)](https://github.com/jaywcjlove/rehype-attr/network/dependents)\n\nThis plugin adds support for custom attributes in Markdown. Attributes can be added using HTML comment syntax, but they won’t appear in the preview, similar to [`remark-attr`](https://github.com/arobase-che/remark-attr).\n\n## Installation\n\nThis package is [ESM only](https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c): Node 12+ is needed to use it and it must be `import` instead of `require`.\n\n```bash\nnpm install rehype-attr\n```\n\n## Default Syntax\n\n### `Links`\n\n#### `HTML Example`\n\n```html\n\u003ca href=\"https://github.com\"\u003egithub\u003c/a\u003e\u003c!--rehype:rel=external\u0026style=color:pink;\u0026data-name=kenny--\u003e\n```\n\n\u003e Output: \n\u003e ```html\n\u003e \u003ca href=\"https://github.com\" rel=\"external\" style=\"color:pink;\" data-name=\"kenny\"\u003egithub\u003c/a\u003e\n\u003e ```\n\n\u003cdetails\u003e\n\u003csummary\u003eExample Code\u003c/summary\u003e\n\n```js\nimport { rehype } from 'rehype';\nimport rehypeAttrs from 'rehype-attr';\n\nconst htmlStr = rehype()\n  .data('settings', { fragment: true })\n  .use(rehypeAttrs, { properties: 'attr' })\n  .processSync(`\u003ca href=\"https://github.com\"\u003egithub\u003c/a\u003e\u003c!--rehype:rel=external--\u003e`)\n  .toString()\n```\n\n\u003c/details\u003e\n\n#### `Markdown Example`\n\n```markdown\n[github](https://github.com)\u003c!--rehype:rel=external--\u003e\n```\n\n\u003e Output: \n\u003e ```html\n\u003e \u003cp\u003e\n\u003e   \u003ca href=\"https://github.com\" rel=\"external\"\u003egithub\u003c/a\u003e\n\u003e   \u003c!--rehype:rel=external--\u003e\n\u003e \u003c/p\u003e\n\u003e ```\n\n\n\u003cdetails\u003e\n\u003csummary\u003eExample Code\u003c/summary\u003e\n\n```js\nimport { unified } from 'unified';\nimport stringify from 'rehype-stringify';\nimport rehypeRaw from 'rehype-raw';\nimport remark2rehype from 'remark-rehype';\nimport remarkParse from 'remark-parse';\nimport rehypeAttrs from 'rehype-attr';\n\nconst htmlStr = unified()\n  .use(remarkParse)\n  .use(remark2rehype, { allowDangerousHtml: true })\n  .use(rehypeRaw)\n  .use(rehypeAttrs, { properties: 'attr' })\n  .use(stringify)\n  .processSync(`[github](https://github.com)\u003c!--rehype:rel=external--\u003e`)\n  .toString()\n```\n\n\u003c/details\u003e\n\n\u003cbr /\u003e\n\n### `Header`\n\n#### `HTML Example`\n\n```html\n\u003ch1\u003eThis is a title\u003c/h1\u003e\u003c!--rehype:style=color:pink;--\u003e\n```\n\n\u003e Output: \n\u003e ```html\n\u003e \u003ch1 style=\"color:pink;\"\u003eThis is a title\u003c/h1\u003e\n\u003e ```\n\n\u003cdetails\u003e\n\u003csummary\u003eExample Code\u003c/summary\u003e\n\n```js\nimport { rehype } from 'rehype';\nimport rehypeAttrs from 'rehype-attr';\n\nconst htmlStr = rehype()\n  .data('settings', { fragment: true })\n  .use(rehypeAttrs, { properties: 'attr' })\n  .processSync(`\u003ch1\u003eThis is a title\u003c/h1\u003e\u003c!--rehype:style=color:pink;--\u003e`)\n  .toString()\n```\n\n\u003c/details\u003e\n\n#### `Markdown Example`\n\n```markdown\nThis is a title\n====\n\u003c!--rehype:style=color:pink;--\u003e\n```\n\n\u003e Output:\n\u003e ```html\n\u003e \u003ch1 style=\"color:pink;\"\u003eThis is a title\u003c/h1\u003e\n\u003e ```\n\n```markdown\n# This is a title\n\u003c!--rehype:style=color:pink;--\u003e\n```\n\n\u003e Output:\n\u003e ```html\n\u003e \u003ch1 style=\"color:pink;\"\u003eThis is a title\u003c/h1\u003e\n\u003e ```\n\n### `Strong`\n\n#### `HTML Example`\n\n```html\nThis is a \u003cstrong\u003eUnicorn\u003c/strong\u003e\u003c!--rehype:style=color: grey--\u003e\n```\n\n\u003e Output: \n\u003e ```html\n\u003e This is a \u003cstrong style=\"color: grey\"\u003eUnicorn\u003c/strong\u003e\n\u003e ```\n\n#### `Markdown Example`\n\n```markdown\nThis is a **Unicorn**\u003c!--rehype:style=color: grey--\u003e\n```\n\n\u003e Output:\n\u003e ```html\n\u003e \u003cp\u003eThis is a \u003cstrong style=\"color: grey\"\u003eUnicorn\u003c/strong\u003e \u003c!--rehype:style=color: grey--\u003e\u003c/p\u003e\n\u003e ```\n\n### `Emphasis`\n\n#### `HTML Example`\n\n```html\nNpm stand for \u003cem\u003enode\u003c/em\u003e\u003c!--rehype:style=color: red--\u003e packet manager.\n```\n\n\u003e Output: \n\u003e ```html\n\u003e Npm stand for \u003cem style=\"color: red\"\u003enode\u003c/em\u003e packet manager.\n\u003e ```\n\n#### `Markdown Example`\n\n```markdown\nNpm stand for *node* \u003c!--rehype:style=color: red--\u003e packet manager.\n```\n\n\u003e Output:\n\u003e \n\u003e ```html\n\u003e \u003cp\u003eNpm stand for \u003cem style=\"color: red\"\u003enode\u003c/em\u003e\u003c!--rehype:style=color: red--\u003e packet manager.\u003c/p\u003e\n\u003e ```\n\n### `Code`\n\n```markdown\n\u003c!--rehype:title=Rehype Attrs\u0026abc=1\u0026hello=2--\u003e\n\\```js\nconsole.log('')\n\\```\n```\n\n\u003e Output:\n\u003e \n\u003e ```html\n\u003e \u003cpre data-type=\"rehyp\"\u003e\n\u003e   \u003ccode class=\"language-js\" data-config=\"[object Object]\"\u003e\n\u003e     console.log('')\n\u003e   \u003c/code\u003e\n\u003e \u003c/pre\u003e\n\u003e ```\n\n### `Inlne Code`\n\n#### `HTML Example`\n\n```html\nThis is the \u003ccode\u003econtent\u003c/code\u003e\u003c!--rehype:style=color:pink;--\u003e\n```\n\n\u003e Output: \n\u003e ```html\n\u003e This is the \u003ccode style=\"color:pink;\"\u003econtent\u003c/code\u003e\n\u003e ```\n\n#### `Markdown Example`\n\n```markdown\nThis is the `content`\u003c!--rehype:style=color:pink;--\u003e\n```\n\n\u003e Output:\n\u003e \n\u003e ```html\n\u003e \u003cp\u003eThis is the \u003ccode style=\"color:pink;\"\u003econtent\u003c/code\u003e\u003c!--rehype:style=color:pink;--\u003e\u003c/p\u003e\n\u003e ```\n\n### `List`\n\n```markdown\n- list\n\u003c!--rehype:style=width:100px;--\u003e\n```\n\n\u003e Output:\n\u003e \n\u003e ```html\n\u003e \u003cul style=\"width:100px;\"\u003e\n\u003e   \u003cli\u003elist\u003c/li\u003e\n\u003e \u003c/ul\u003e\n\u003e \u003c!--rehype:style=width:100px;--\u003e\n\u003e ```\n\n#### `HTML Example`\n\n```js\nimport { rehype } from 'rehype';\nimport rehypeAttrs from 'rehype-attr';\n\nconst htmlStr = rehype()\n  .data('settings', { fragment: true })\n  .use(rehypeAttrs, { properties: 'attr' })\n  .processSync(`\u003ca href=\"https://github.com\"\u003egithub\u003c/a\u003e\u003c!--rehype:rel=external--\u003e`)\n  .toString()\n```\n\nOutput: \n\n```html\n\u003ch1 style=\"color:pink;\"\u003eThis is a title\u003c/h1\u003e\n```\n\n#### `Markdown Example`\n\n```js\nimport { unified } from 'unified';\nimport stringify from 'rehype-stringify';\nimport rehypeRaw from 'rehype-raw';\nimport remarkParse from 'remark-parse';\nimport remark2rehype from 'remark-rehype';\nimport rehypeAttrs from 'rehype-attr';\n\nconst mrkStr = `[github](https://github.com)\u003c!--rehype:rel=external--\u003e`\nconst htmlStr = unified()\n  .use(remarkParse)\n  .use(remark2rehype, { allowDangerousHtml: true })\n  .use(rehypeRaw)\n  .use(rehypeAttrs, { properties: 'attr' })\n  .use(stringify)\n  .processSync(mrkStr)\n  .toString()\n```\n\nOutput: \n\n```html\n\u003cp\u003e\n  \u003ca href=\"https://github.com\" rel=\"external\"\u003egithub\u003c/a\u003e\n  \u003c!--rehype:rel=external--\u003e\n\u003c/p\u003e\n```\n\n## Options\n\n### `properties`\n\n\u003e Default Value: `data`  \n\u003e Value: `data`, `string`, `attr`\n\n### `codeBlockParames`\n\nCode block passing parameters\n\n\u003e Default Value: `true`  \n\n### `commentStart`\n\nOptional start delimiter for comments @example `\\\\{\\\\*`\n\n\u003e Default Value: `\u003c!--`  \n\n### `commentEnd`\n\nOptional end delimiter for comments @example `\\\\*\\\\}`\n\n\u003e  Default Value: `--\u003e`  \n\n## Related\n\n- [`rehype-video`](https://github.com/jaywcjlove/rehype-video) Add improved video syntax: links to `.mp4` and `.mov` turn into videos.\n- [`rehype-rewrite`](https://github.com/jaywcjlove/rehype-rewrite) Rewrite element with rehype.\n- [`rehype-ignore`](https://github.com/jaywcjlove/rehype-ignore) Ignore content display via HTML comments, Shown in GitHub readme, excluded in HTML.\n- [`remark-github-blockquote-alert`](https://github.com/jaywcjlove/remark-github-blockquote-alert) Remark plugin to add support for [GitHub Alert](https://docs.github.com/en/get-started/writing-on-github/getting-started-with-writing-and-formatting-on-github/basic-writing-and-formatting-syntax#alerts)\n\n## Contributors\n\nAs always, thanks to our amazing contributors!\n\n\u003ca href=\"https://github.com/jaywcjlove/rehype-attr/graphs/contributors\"\u003e\n  \u003cimg src=\"https://jaywcjlove.github.io/rehype-attr/CONTRIBUTORS.svg\" /\u003e\n\u003c/a\u003e\n\nMade with [github-action-contributors](https://github.com/jaywcjlove/github-action-contributors).\n\n## License\n\nMIT © [Kenny Wong](https://github.com/jaywcjlove)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjaywcjlove%2Frehype-attr","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjaywcjlove%2Frehype-attr","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjaywcjlove%2Frehype-attr/lists"}