{"id":21525813,"url":"https://github.com/bkwld/vue-routing-anchor-parser","last_synced_at":"2025-04-09T23:23:11.753Z","repository":{"id":39822011,"uuid":"130884723","full_name":"BKWLD/vue-routing-anchor-parser","owner":"BKWLD","description":"A Vue directive that parses child elements for internally linking anchor tags and binds their click events to use Vue Router's push().","archived":false,"fork":false,"pushed_at":"2025-03-19T20:03:53.000Z","size":2209,"stargazers_count":3,"open_issues_count":4,"forks_count":2,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-24T01:12:33.913Z","etag":null,"topics":["directive","nuxt","router","vue"],"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/BKWLD.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}},"created_at":"2018-04-24T16:38:58.000Z","updated_at":"2025-03-10T23:57:10.000Z","dependencies_parsed_at":"2024-09-17T17:44:16.503Z","dependency_job_id":"014f0c54-6953-4b12-8b88-4a50444d2598","html_url":"https://github.com/BKWLD/vue-routing-anchor-parser","commit_stats":{"total_commits":118,"total_committers":5,"mean_commits":23.6,"dds":0.3389830508474576,"last_synced_commit":"0c44e370c1df5947de4fe42a3cfdf1de3af14b72"},"previous_names":[],"tags_count":30,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BKWLD%2Fvue-routing-anchor-parser","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BKWLD%2Fvue-routing-anchor-parser/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BKWLD%2Fvue-routing-anchor-parser/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BKWLD%2Fvue-routing-anchor-parser/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/BKWLD","download_url":"https://codeload.github.com/BKWLD/vue-routing-anchor-parser/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248126804,"owners_count":21052042,"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":["directive","nuxt","router","vue"],"created_at":"2024-11-24T01:38:32.006Z","updated_at":"2025-04-09T23:23:11.663Z","avatar_url":"https://github.com/BKWLD.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# vue-routing-anchor-parser\n\nA Vue directive that parses child elements for internally linking anchor tags and binds their click events to use Vue Router's push().\n\n## Install\n\n`yarn add vue-routing-anchor-parser` or `npm install --save vue-routing-anchor-parser`\n\n## Configure\n\n#### Vue\n\nIn a your bootstrapping JS:\n\n```js\nparseAnchors = require('vue-routing-anchor-parser')\ndirective.settings({\n  addBlankToExternal: false,\n  internalUrls: [\n    /^https?:\\/\\/localhost:\\d+/\n    /^https?:\\/\\/([\\w\\-]+\\.)?netlify\\.com/\n    /^https?:\\/\\/([\\w\\-]+\\.)?bukwild\\.com/\n  ]\n  internalHosts: [\n    'localhost',\n    'example.com',\n  ]\n})\nVue.directive('parse-anchors', parseAnchors)\n```\n\n#### Nuxt\n\nIn `nuxt.config.js`:\n\n```js\n  modules: [\n    'vue-routing-anchor-parser/nuxt/module',\n  ],\n  anchorParser: {\n    addBlankToExternal: true,\n    internalUrls: [\n      /^https?:\\/\\/localhost:\\d+/,\n      /^https?:\\/\\/([\\w\\-]+\\.)?netlify\\.com/,\n      /^https?:\\/\\/(www\\.)?bukwild\\.com/,\n    ],\n    internalHosts: [\n      'localhost',\n      'bukwild.com',\n    ],\n    externalPaths: [\n      /^\\/react-landing-page/,\n    ],\n    sameWindowUrls: [\n      /^https?:\\/\\/(shop\\.)?bukwild\\.com/,\n    ],\n    disableSmartLinkRegistration: false,\n  }\n```\n\n#### Options\n\n- `addBlankToExternal`: Set to true to add `target='_blank'` to external links\n- `internalUrls`: Array of regexes that, when found in `href` attributes, get treated as internal links.\n- `internalHosts`: Array of host names that, when found in `href` attributes, get treated as internal links.  These are checked after `internalUrls`.\n- `externalPaths`: Array of regexes that, when found in `href` attributes, get treated as external links.  Useful for sections of your website that are not part of this Vue/Nuxt app.\n- `sameWindowUrls`: Array of regexes that are checked when a URL is not internal. If there is a match, the URL opens in the same window rather opening a new window.\n- `disableSmartLinkRegistration`: Set to true to prevent the auto registration of `smart-link`\n\n## Usage\n\n#### `v-parse-anchors` directive\n\nAdd `v-parse-anchors` wherever you want to parse child anchors for internal links and route clicks through Vue Router.  `href`s that begin with a slash, like `\u003ca href='/path/to/something'\u003e` are treated as internal automatically.  If an internal route can't be resolved by Vue Router, it falls back to a full page refresh (though never opens in a new window.)\n\n#### `smart-link` component\n\nThe `smart-link` component conditionally renders a `nuxt-link` if an internal link or an `a` tag if not.\n\n```html\n\u003csmart-link to='https://www.bukwild.com'\u003eBukwild\u003c/smart-link\u003e\n```\n\n## Notes\n\n- This currently only parses on `bind`, meaning if the contents for the element change later, new `a` tags won't be processed.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbkwld%2Fvue-routing-anchor-parser","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbkwld%2Fvue-routing-anchor-parser","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbkwld%2Fvue-routing-anchor-parser/lists"}