{"id":19318429,"url":"https://github.com/localjo/quotable-toolbar","last_synced_at":"2025-04-22T17:31:04.252Z","repository":{"id":42864457,"uuid":"259391805","full_name":"localjo/quotable-toolbar","owner":"localjo","description":"📢 A library to add buttons to quotes and text selection that make it quick and easy for your readers to share quotes from your website.","archived":false,"fork":false,"pushed_at":"2023-01-07T17:34:55.000Z","size":2050,"stargazers_count":5,"open_issues_count":9,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-02T02:05:56.926Z","etag":null,"topics":["popup","preact","quotes","sharing","social-buttons","social-media","text-selection","twitter","typescript"],"latest_commit_sha":null,"homepage":"https://iamlocaljo.com/projects/quotable/","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/localjo.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},"funding":{"github":"localjo","patreon":"localjo"}},"created_at":"2020-04-27T16:39:33.000Z","updated_at":"2023-03-01T20:03:30.000Z","dependencies_parsed_at":"2023-02-07T18:31:36.198Z","dependency_job_id":null,"html_url":"https://github.com/localjo/quotable-toolbar","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/localjo%2Fquotable-toolbar","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/localjo%2Fquotable-toolbar/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/localjo%2Fquotable-toolbar/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/localjo%2Fquotable-toolbar/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/localjo","download_url":"https://codeload.github.com/localjo/quotable-toolbar/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250287462,"owners_count":21405617,"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":["popup","preact","quotes","sharing","social-buttons","social-media","text-selection","twitter","typescript"],"created_at":"2024-11-10T01:18:36.225Z","updated_at":"2025-04-22T17:31:03.281Z","avatar_url":"https://github.com/localjo.png","language":"TypeScript","funding_links":["https://github.com/sponsors/localjo","https://patreon.com/localjo"],"categories":[],"sub_categories":[],"readme":"# `quotable-toolbar` 📢\n\n\u003e A library to add buttons to quotes and text selection that make it quick and easy for your readers to share quotes from your website.\n\n![Banner Image](./images/banner-1544x500.png)\n\n[![NPM](https://img.shields.io/npm/v/quotable-toolbar.svg)](https://www.npmjs.com/package/quotable-toolbar)\n\nQuotable is a TypeScript library (distributed as a browser bundle and an ES6 module) that allows you to easily add a contextual popup to your web page for sharing selected text and quotes on Twitter (and soon, other networks).\n\nQuotable is also available [as a WordPress plugin](https://wordpress.org/plugins/quotable/).\n\n## Install\n\n```bash\nyarn add quotable-toolbar\n```\n\n## Usage\n\nAssuming an html page with a structure similar to this;\n\n```html\n\u003cdiv id=\"blog-container\"\u003e\n  \u003cp\u003e...\u003c/p\u003e\n  \u003cblockquote\u003e...\u003c/blockquote\u003e\n  \u003cblockquote class=\"is-quotable\"\u003e...\u003c/blockquote\u003e\n  \u003cblockquote class=\"not-quotable\"\u003e...\u003c/blockquote\u003e\n  \u003cp\u003e...\u003c/p\u003e\n  \u003cblockquote\u003e\n    \u003cp\u003e...\u003c/p\u003e\n    \u003cp\u003e...\u003c/p\u003e\n  \u003c/blockquote\u003e\n  \u003cp\u003e...\u003c/p\u003e\n\u003c/div\u003e\n```\n\nYou can activate Quotable like this;\n\n```js\nimport Quotable from 'quotable-toolbar';\n\nwindow.addEventListener('DOMContentLoaded', () =\u003e {\n  const quotableToolbar = new Quotable({\n    selector: `#blog-container`, // Wrapping element to activate Quotable on\n    isActive: {\n      blockquotes: true, // Whether to add Quotable links to blockquotes\n      textSelection: true, // Whether to activate text selection popup\n      include: ['.is-quotable'], // Blockquotes to always add links to\n      exclude: ['.not-quotable'], // Blockquotes to never add links to\n    },\n    url: window.location.href, // URL to share, should be cannonical\n    twitter: {\n      via: 'JoFromAkron', // Twitter account to @\n      related: 'JoFromAkron', // Twitter account to suggest after sharing\n      hashtags: ['quotable', 'typescript'], // Hashtags to add to tweet\n    },\n  });\n  quotableToolbar.activate();\n});\n```\n\n## Features\n\nQuotable has two separate features you can activate, 1) add sharing links to blockquotes and 2) add a sharing link popup on text selection.\n\n### Blockquotes\n\nQuotable will search for every blockquote in the container you select, and append a sharing link. If the blockquote contains paragraphs, the sharing link will be appended to each paragraph. Quotable also wraps the text content of the paragraph or blockquote with a span, used to highlight the text when the sharing link is hovered. You can also selectively add the sharing link to blockquotes by setting `isActive.blockquotes: false` and passing an array to `include` of selectors for elements you want to add sharing link to. Alternatively, you can selectively deactivate the sharing link when `isActive.blockquotes: true` by passing an array to `exclude` of selectors for the elements you _don't_ want to add a sharing link to.\n\n![Screenshot](./images/screenshot-1.png)\n\n### Text Selection\n\nQuotable adds a popup for every text selection within the container you select. You can disable this with `isActive.textSelection: false`\n\n![Screenshot](./images/screenshot-2.png)\n\n### Sharing Links\n\nThe `url` option determines which url will be shared, when the user clicks a sharing link. You can use `window.location.href`, but if that's not necessarily the canonical url you want people to share, you should set this manually with that value.\n\nRight now, Quotable has support for a link to share content on Twitter. You can configure Twitter sharing options with the `twitter` options object. In the future, support will be added for other networks (Facebook, Reddit, Hacker News, etc), and each option will have it's own settings key in the options object.\n\n![Screenshot](./images/screenshot-3.png)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flocaljo%2Fquotable-toolbar","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flocaljo%2Fquotable-toolbar","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flocaljo%2Fquotable-toolbar/lists"}