{"id":27018962,"url":"https://github.com/rejchev/react-string-binder","last_synced_at":"2026-04-20T09:02:37.878Z","repository":{"id":285949263,"uuid":"959850650","full_name":"rejchev/react-string-binder","owner":"rejchev","description":"String binder allows you to replace keywords in plain text with ReactNode elements","archived":false,"fork":false,"pushed_at":"2025-04-03T13:47:30.000Z","size":71,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-04-03T14:36:13.922Z","etag":null,"topics":["binder","keyword","react","react-node","string-binder","typescript"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/@rejchev/react-string-binder","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/rejchev.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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":"2025-04-03T13:04:44.000Z","updated_at":"2025-04-03T13:47:34.000Z","dependencies_parsed_at":"2025-04-03T14:36:40.455Z","dependency_job_id":"d2a37d55-0d63-4e04-84fb-79cc474736a5","html_url":"https://github.com/rejchev/react-string-binder","commit_stats":null,"previous_names":["rejchev/react-string-binder"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rejchev%2Freact-string-binder","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rejchev%2Freact-string-binder/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rejchev%2Freact-string-binder/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rejchev%2Freact-string-binder/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rejchev","download_url":"https://codeload.github.com/rejchev/react-string-binder/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247272977,"owners_count":20911846,"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":["binder","keyword","react","react-node","string-binder","typescript"],"created_at":"2025-04-04T17:17:39.287Z","updated_at":"2026-04-20T09:02:37.872Z","avatar_url":"https://github.com/rejchev.png","language":"TypeScript","readme":"\u003ch1 align=center\u003eReact String Binder\u003c/h1\u003e \n\u003cdiv align=center\u003e\n\n[![CI](https://github.com/rejchev/react-string-binder/actions/workflows/ci.yml/badge.svg)](https://github.com/rejchev/react-string-binder/actions/workflows/ci.yml)\n[![LICENSE](https://img.shields.io/github/license/rejchev/sm-jansson)](LICENSE)\n\n\u003c/div\u003e\n\n## About\nA simple react string binder lib.\n\nThe StringBinder allows you to replace keywords in plain text with ReactNode elements\n\n## Install\n`npm i @rejchev/react-string-binder`\n\n## Usage\n### Keywords\nA keyword in plain text must start \u0026 close with `$` and contain only `A-Za-z` with out any spaces (min len = 1).\n\n```jsx\n\n// keyword is $keyword$\nconst success = `This is a $keyword$.`;\n\n// just not handled\nconst fail = `This is not a $1keyword`;\n\n// just not handled\nconst watch = `This is not a $key_word`;\n\n// multiply keys: $flowers, $crons\nconst multiple = \"$flowers$ and $crowns$.\";\n```\n### Binds\nKeys of bindable `ReactNode` | `string` must be same as keywords but without `$`\n\n```jsx\nimport StringBinderInstance from \"@rejchev/react-string-binder\";\n\nconst text = \"This is a simple $nl$\";\n\nconst result = StringBinderInstance.bind(text, {\n    nl: \u003chr /\u003e\n})\n\n```\n\n## Usage example\n\n```jsx\n\nimport StringBinderInstance, {StringBinderT} from \"@rejchev/react-string-binder\";\n\nfunction App() {\n\n  const text =\n    \"The spring sun warms the awakening nature. $n$\" +\n    \"Birds chirp joyfully in the tree $crowns$, $flowers$ stretch towards the heavenly surface. $n$\" +\n    \"The air is filled with freshness and the aroma of the first flowers.\"\n\n  const unknownKeys =\n    // Test variant \u003cbr/\u003e\n    \"Test $variant$ $n$\" +\n\n    // Test another_variant \u003cbr/\u003e\n    \"Test another_$variant$ $n$\" +\n\n    // Test third_variant_variant\n    \"Test third_$variant$_variant\"\n\n  const oneMore =\n    // Test \u003ca href=\"//yandex.ru\" target=\"_blank\"\u003eflowers\u003c/a\u003eflowers \u003cbr/\u003e\n    \"Test $flowers$flowers $n$\" +\n\n    // Test \u003ca href=\"//yandex.ru\" target=\"_blank\"\u003eflowers\u003c/a\u003eflowers \u003cbr/\u003e\n    \"Test $flowers$flowers$ $n$\" +\n\n    // Test \u003ca href=\"//yandex.ru\" target=\"_blank\"\u003eflowers\u003c/a\u003e\u003ca href=\"//yandex.ru\" target=\"_blank\"\u003eflowers\u003c/a\u003e \u003cbr/\u003e\n    \"Test $flowers$$flowers$ $n$\"\n\n  const binder : StringBinderT = {\n    crowns: \u003ca href={'//google.com'} target={'_blank'}\u003ecrowns\u003c/a\u003e,\n    flowers: \u003ca href={'//yandex.ru'} target={'_blank'}\u003eflowers\u003c/a\u003e,\n    n: \u003cbr/\u003e,\n  }\n\n  return (\n    \u003c\u003e\n      \u003cp className=\"read-the-docs\"\u003e\n        {StringBinderInstance.bind(text, binder)}\n      \u003c/p\u003e\n      \u003cp className=\"read-the-docs\"\u003e\n        {StringBinderInstance.bind(unknownKeys, binder)}\n      \u003c/p\u003e\n      \u003cp className=\"read-the-docs\"\u003e\n        {StringBinderInstance.bind(oneMore, binder)}\n      \u003c/p\u003e\n    \u003c/\u003e\n  )\n}\n```","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frejchev%2Freact-string-binder","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frejchev%2Freact-string-binder","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frejchev%2Freact-string-binder/lists"}