{"id":22799059,"url":"https://github.com/thomd/rehype-textmarker","last_synced_at":"2026-02-11T05:31:08.819Z","repository":{"id":246954297,"uuid":"822307837","full_name":"thomd/rehype-textmarker","owner":"thomd","description":"rehype plugin to highlight text pattern or text enclosed by a symbol with a \u003cmark\u003e tag","archived":false,"fork":false,"pushed_at":"2025-12-15T09:44:33.000Z","size":65,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-12-18T09:13:52.461Z","etag":null,"topics":["ast","rehype","rehype-plugin"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","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/thomd.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,"zenodo":null}},"created_at":"2024-06-30T21:49:45.000Z","updated_at":"2025-12-15T09:44:09.000Z","dependencies_parsed_at":"2025-04-20T14:17:39.974Z","dependency_job_id":null,"html_url":"https://github.com/thomd/rehype-textmarker","commit_stats":null,"previous_names":["thomd/rehype-textmarker"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/thomd/rehype-textmarker","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thomd%2Frehype-textmarker","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thomd%2Frehype-textmarker/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thomd%2Frehype-textmarker/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thomd%2Frehype-textmarker/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/thomd","download_url":"https://codeload.github.com/thomd/rehype-textmarker/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thomd%2Frehype-textmarker/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29327320,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-11T03:52:29.695Z","status":"ssl_error","status_checked_at":"2026-02-11T03:52:23.094Z","response_time":97,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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","rehype","rehype-plugin"],"created_at":"2024-12-12T07:07:49.319Z","updated_at":"2026-02-11T05:31:08.813Z","avatar_url":"https://github.com/thomd.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# rehype-textmarker\n\n![Build][build-badge]\n\n`rehype-textmarker` is a [rehype][rehype] plugin to highlight text pattern like e.g. `TODO`, `FIXME` or to highlight text surrounded by a defined symbol, e.g. `this is ≈highlighted≈ text` by enclosing the text with a `\u003cmark\u003e` tag.\n\nSee below example.\n\n## Usage\n\nSay we have the following file `example.md`:\n\n```markdown\n# Headline\n\nParagraph with ≈highlighted≈ text.\n\nInline code `console.≈log≈();`.\n\nTODO things to do later\n```\n\nand a module `example.js`:\n\n```js\nimport { remark } from 'remark'\nimport remarkRehype from 'remark-rehype'\nimport rehypeTextmarker from 'rehype-textmarker'\nimport rehypeStringify from 'rehype-stringify'\nimport { read } from 'to-vfile'\n\nconst file = await remark()\n  .use(remarkRehype)\n  .use(rehypeTextmarker, [\n    {\n      textPattern: /≈([^≈]+)≈/g,\n      className: 'yellow-marker',\n      tags: ['p', 'code'],\n    },\n    {\n      textPattern: /\\b(TODO)\\b/,\n      className: 'red-marker',\n    },\n  ])\n  .use(rehypeStringify)\n  .process(await read('example.md'))\n\nconsole.log(file.value)\n```\n\nthen running `node example.js` yields:\n\n```html\n\u003ch1\u003eHeadline\u003c/h1\u003e\n\u003cp\u003eParagraph with \u003cmark class=\"yellow-marker\"\u003ehighlighted\u003c/mark\u003e text.\u003c/p\u003e\n\u003cp\u003e\n  Inline code \u003ccode\u003econsole.\u003cmark class=\"yellow-marker\"\u003elog\u003c/mark\u003e();\u003c/code\u003e.\n\u003c/p\u003e\n\u003cp\u003e\u003cmark class=\"red-marker\"\u003eTODO\u003c/mark\u003e things to do later\u003c/p\u003e\n```\n\n## Test\n\n    pnpm run test\n\n## API\n\nThe default export is `rehypeTextmarker`.\n\n```js\nunified().use(rehypeTextmarker, options)\n```\n\n### Options\n\nIn order to define **multiple** regular expressions, put options into a list.\n\n```js\nunified().use(rehypeTextmarker, options)\nunified().use(rehypeTextmarker, [options_1, options_2, ... ])\n```\n\nwhere `options` is an object with at least a `textPattern` property.\n\nThe following options are available:\n\n- `textPattern` (`RegExp`, mandatory) — regular expression which must contain a **capturing group**.\n\n- `htmlTag` (`string`, optional) — HTML tag to sourround the captured string. Default is a `mark` tag.\n\n- `className` (`string`, optional) — style class to be added to the html tag. Default is no style class.\n\n- `tags` (`array` of `string`, optional) — list of tags within whose text is highlighted. It is also possible to define tags with class names, e.g. `code.language-js` which will only highlight wihtin Javascript code blocks . Default is `p` tag.\n\n- `ignore` (`array` of `string`, optional) — list of tags or tags with class names to ignore. Default is `[]`.\n\n[rehype]: https://github.com/rehypejs/rehype\n[build-badge]: https://github.com/thomd/rehype-textmarker/workflows/plugin-test/badge.svg\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthomd%2Frehype-textmarker","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fthomd%2Frehype-textmarker","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthomd%2Frehype-textmarker/lists"}