{"id":13532262,"url":"https://github.com/untemps/solid-readotron","last_synced_at":"2025-06-25T22:02:48.831Z","repository":{"id":43655940,"uuid":"459681967","full_name":"untemps/solid-readotron","owner":"untemps","description":"SolidJS component to display an estimated reading time","archived":false,"fork":false,"pushed_at":"2023-01-13T17:20:07.000Z","size":858,"stargazers_count":9,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-02-05T09:47:50.220Z","etag":null,"topics":["component","javascript","read-o-meter","reading-rates","reading-time","reading-time-estimator","solid","solid-components","solid-js","solidjs","speed-reading-time"],"latest_commit_sha":null,"homepage":"https://solid-readotron.vercel.app/","language":"JavaScript","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/untemps.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2022-02-15T17:31:20.000Z","updated_at":"2023-10-26T13:48:53.000Z","dependencies_parsed_at":"2023-02-09T16:30:27.340Z","dependency_job_id":null,"html_url":"https://github.com/untemps/solid-readotron","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/untemps%2Fsolid-readotron","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/untemps%2Fsolid-readotron/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/untemps%2Fsolid-readotron/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/untemps%2Fsolid-readotron/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/untemps","download_url":"https://codeload.github.com/untemps/solid-readotron/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241768273,"owners_count":20017129,"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":["component","javascript","read-o-meter","reading-rates","reading-time","reading-time-estimator","solid","solid-components","solid-js","solidjs","speed-reading-time"],"created_at":"2024-08-01T07:01:09.534Z","updated_at":"2025-03-04T01:50:28.202Z","avatar_url":"https://github.com/untemps.png","language":"JavaScript","readme":"\u003cp align=\"center\"\u003e\n    Svelte component to display an estimated reading time\n\u003c/p\u003e\n\n---\n\n[![npm](https://img.shields.io/npm/v/@untemps/solid-readotron?style=for-the-badge)](https://www.npmjs.com/package/@untemps/solid-readotron)\n[![GitHub Workflow Status](https://img.shields.io/github/actions/workflow/status/untemps/solid-readotron/index.yml?style=for-the-badge)](https://github.com/untemps/solid-readotron/actions)\n[![Codecov](https://img.shields.io/codecov/c/github/untemps/solid-readotron?style=for-the-badge)](https://codecov.io/gh/untemps/solid-readotron)\n\n## Demo\n\n\u003cp align=\"center\"\u003e\n    :red_circle:\u0026nbsp;\u003cbig\u003e\u003ca href=\"https://solid-readotron.vercel.app\" target=\"_blank\" rel=\"noopener\"\u003eLIVE\n    DEMO\u003c/a\u003e\u003c/big\u003e\u0026nbsp;:red_circle:\n    \u003cbr/\u003e\u003cbr/\u003e\n    \u003cimg src=\"assets/example.png\" alt=\"Example\" style=\"max-width: 100%\"/\u003e\n\u003c/p\u003e\n\n## Installation\n\n```bash\nyarn add @untemps/solid-readotron\n```\n\n## Usage\n\n### Basic usage\n\n```html\n\u003cmain\u003e\n\t\u003cReadotron selector=\".text\" /\u003e\n\t\u003csection class=\"text\"\u003e...\u003c/section\u003e\n\u003c/main\u003e\n```\n\n### API\n\n| Props      | Type               | Default           | Description                                                                                                                                                     |\n| ---------- | ------------------ |-------------------| ----------------------------------------------------------------------------------------------------------------------- |\n| `selector` | string             | (required)        | Selector of the element which contains the content to parse. See [Selector](#selector)                                  |\n| `lang`     | string             | 'default'         | Lang of the content. See [Lang](#lang)                                                                                  |\n| `template` | string             | '%time% min read' | Display template which contains dynamic tokens to be replaced by the parsed values. See [Template](#template)           |\n\n### Selector\n\n`selector` prop is mandatory as it points to which element contains the text content to parse.\nYou can utilize any selector supported by the Web API [querySelector](https://developer.mozilla.org/fr/docs/Web/API/Document/querySelector) function.  \nIf several elements match the selector, it only parses the text of the first element in the array.\n\n### Lang\n\n'lang' is an optional prop that designates the language of the text to parse. The component implements the [@untemps/read-per-minute](https://github.com/untemps/read-per-minute) underhand package which returns an estimation based on the _lang_ (language).  \nReading rates by _lang_ come from [\"How many words do we read per minute? A review and meta-analysis of reading rate\"](https://osf.io/4nv9f/) by Marc Brysbaert - Department of Experimental Psychology Ghent University\n\n| Lang    | Rate |\n| ------- | ---- |\n| default | 200  |\n| ar      | 181  |\n| zh      | 260  |\n| nl      | 228  |\n| en      | 236  |\n| fi      | 195  |\n| fr      | 214  |\n| de      | 260  |\n| he      | 224  |\n| it      | 285  |\n| ko      | 226  |\n| es      | 278  |\n| sv      | 218  |\n\nIf a lang is not defined or the provided lang is not listed, the **default** value (200) will be applied.\n\n#### Example\n\n```html\n\u003cmain\u003e\n\t\u003cReadotron selector=\".text\" lang=\"en\" /\u003e\n\t\u003csection class=\"text\"\u003e...\u003c/section\u003e\n\u003c/main\u003e\n```\n\n### Template\n\nYou can customize the Readotron display by using the `template` prop: a template is a string with one or more tokens delimited with `%`\n\n#### Available tokens\n\n| Token   | Description                         |\n| ------- | ----------------------------------- |\n| `time`  | Estimated reading time (in minutes) |\n| `words` | Number of words                     |\n\n#### Example\n\n```html\n\u003cmain\u003e\n\t\u003cReadotron selector=\".text\" template=\"Reading Time: %time% minutes (%words% words)\" /\u003e\n\t\u003csection class=\"text\"\u003e...\u003c/section\u003e\n\u003c/main\u003e\n```\n\n### Children\n\nAnother way to customize the Readotron display is to pass down a function as children.\n\n#### Available arguments\n\n| Token   | Description                         |\n| ------- | ----------------------------------- |\n| `time`  | Estimated reading time (in minutes) |\n| `words` | Number of words                     |\n| `error` | Parsing error if available          |\n\n#### Example\n\n```html\n\u003cmain\u003e\n    \u003cReadotron selector=\".text\"\u003e\n      {(time, words, error) =\u003e (\n      \u003cShow when={!error} fallback={\u003cspan class='error'\u003eOops\u003c/span\u003e}\u003e\n        \u003cspan class='readotron'\u003e\n          {time} min read ({words} words)\n        \u003c/span\u003e\n      \u003c/Show\u003e``\n      )}\n    \u003c/Readotron\u003e\n    \u003csection class=\"text\"\u003e\n        ...\n    \u003c/section\u003e\n\u003c/main\u003e\n```\n\n## Development\n\nThe component can be served for development purpose on `http://localhost:10001/` running:\n\n```\nyarn dev\n```\n\n## Contributing\n\nContributions are warmly welcomed:\n\n-   Fork the repository\n-   Create a feature branch\n-   Develop the feature AND write the tests (or write the tests AND develop the feature)\n-   Commit your changes\n    using [Angular Git Commit Guidelines](https://github.com/angular/angular.js/blob/master/DEVELOPERS.md#-git-commit-guidelines)\n-   Submit a Pull Request\n","funding_links":[],"categories":["📦 Components \u0026 Libraries"],"sub_categories":["UI Components"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Funtemps%2Fsolid-readotron","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Funtemps%2Fsolid-readotron","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Funtemps%2Fsolid-readotron/lists"}