{"id":25211478,"url":"https://github.com/substrate-system/anchor","last_synced_at":"2025-04-05T06:27:10.791Z","repository":{"id":276706309,"uuid":"910974458","full_name":"substrate-system/anchor","owner":"substrate-system","description":"Add hash links to your page.","archived":false,"fork":false,"pushed_at":"2025-03-20T22:11:27.000Z","size":31,"stargazers_count":0,"open_issues_count":2,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-23T00:35:56.783Z","etag":null,"topics":["html","links"],"latest_commit_sha":null,"homepage":"https://substrate-system.github.io/anchor/","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/substrate-system.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","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":"2025-01-02T00:22:11.000Z","updated_at":"2025-02-28T05:23:46.000Z","dependencies_parsed_at":null,"dependency_job_id":"4d8f57c5-0ea0-4067-82b9-4225e8a292be","html_url":"https://github.com/substrate-system/anchor","commit_stats":null,"previous_names":["substrate-system/anchor"],"tags_count":1,"template":false,"template_full_name":"nichoth/template-ts-browser","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/substrate-system%2Fanchor","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/substrate-system%2Fanchor/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/substrate-system%2Fanchor/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/substrate-system%2Fanchor/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/substrate-system","download_url":"https://codeload.github.com/substrate-system/anchor/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247298307,"owners_count":20916007,"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":["html","links"],"created_at":"2025-02-10T14:15:48.690Z","updated_at":"2025-04-05T06:27:10.781Z","avatar_url":"https://github.com/substrate-system.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# anchor\n![tests](https://github.com/substrate-system/anchor/actions/workflows/nodejs.yml/badge.svg)\n[![types](https://img.shields.io/npm/types/@substrate-system/anchor?style=flat-square\u0026cache-control=no-cache)](README.md)\n[![module](https://img.shields.io/badge/module-ESM%2FCJS-blue?style=flat-square)](README.md)\n[![semantic versioning](https://img.shields.io/badge/semver-2.0.0-blue?logo=semver\u0026style=flat-square)](https://semver.org/)\n[![Common Changelog](https://nichoth.github.io/badge/common-changelog.svg)](./CHANGELOG.md)\n[![install size](https://flat.badgen.net/packagephobia/install/@substrate-system/anchor?cache-control=no-cache)](https://packagephobia.com/result?p=@substrate-system/anchor)\n[![dependencies](https://img.shields.io/badge/dependencies-zero-brightgreen.svg?style=flat-square)](package.json)\n[![license](https://img.shields.io/badge/license-Polyform_Strict-f52f2f?style=flat-square)](LICENSE)\n\nAdd anchor links to the headings in a document.\n\n[See a live demo](https://substrate-system.github.io/anchor/)\n\nThis has been adapted from [bryanbraun/anchorjs](https://github.com/bryanbraun/anchorjs). Thanks [@bryanbraun](https://github.com/bryanbraun) for working in open source.\n\n\u003cdetails\u003e\u003csummary\u003e\u003ch2\u003eContents\u003c/h2\u003e\u003c/summary\u003e\n\n\u003c!-- toc --\u003e\n\n- [install](#install)\n- [Example](#example)\n- [Modules](#modules)\n  * [ESM](#esm)\n  * [Common JS](#common-js)\n  * [pre-built JS](#pre-built-js)\n- [API](#api)\n  * [options](#options)\n  * [`Anchor`](#anchor)\n  * [`anchor`](#anchor)\n\n\u003c!-- tocstop --\u003e\n\n\u003c/details\u003e\n\n## install\n\n```sh\nnpm i -S @substrate-system/anchor\n```\n\n## Example\n\nSee the example page: []()\n\n```js\n// import a function\nimport { anchor } from '@substrate-system/anchor'\n\n// import the class\nimport { Anchor } from '@substrate-system/anchor'\n\n// Use defaults for everything.\n// This will target any h2, h3, h4, or h5 tags\nanchor()\n\n// Or use the class.\n// Must call a.add after creating an instance\nconst a = new Anchor()\n```\n\n## Modules\n\nThis exposes ESM and common JS via [package.json `exports` field](https://nodejs.org/api/packages.html#exports).\n\n### ESM\n```js\nimport { Anchor } from '@substrate-system/anchor'\n```\n\n### Common JS\n```js\nconst Anchor = require('@substrate-system/anchor/module')\n```\n\n### pre-built JS\nThis package exposes minified JS files too. Copy them to a location that is\naccessible to your web server, then link to them in HTML.\n\n#### copy\n```sh\ncp ./node_modules/@substrate-system/anchor/dist/index.min.js ./public/anchor.min.js\n```\n\n#### HTML\n```html\n\u003cscript type=\"module\" src=\"./anchor.min.js\"\u003e\u003c/script\u003e\n```\n\n## API\n\n### options\n\n```ts\ntype AnchorOpts = {\n    // Characters like  '#', '¶', '❡', or '§'.\n    icon:string;\n    visible:'hover'|'always'|'touch';\n    placement:'right'|'left';\n    ariaLabel:string;  // any text, default \"Anchor\"\n    class:string;  // css class name\n    base:string;  // any base URI\n    truncate:number;  // Max length. Default 64\n    titleText:string;  // any text\n}\n```\n\n### `Anchor`\n\n```js\nclass Anchor {\n    constructor (opts:Partial\u003cAnchorOpts\u003e = {\n        icon: '\\uE9CB',\n        visible: 'always'\n    })\n}\n```\n\n### `anchor`\nLower case `anchor` is a function that will create a new `Anchor` and call\n`.add()`.\n\n```ts\nfunction anchor (opts:Partial\u003cAnchorOpts\u003e = {}):Anchor\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsubstrate-system%2Fanchor","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsubstrate-system%2Fanchor","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsubstrate-system%2Fanchor/lists"}