Skip to content

Commit

Permalink
📝 update docs site (broken link) and README
Browse files Browse the repository at this point in the history
  • Loading branch information
bryanbraun committed Apr 1, 2024
1 parent 7820d5f commit a125839
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 5 deletions.
8 changes: 7 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,14 +53,20 @@ Currently Supports: IE9+ and modern browsers
To contribute:

1. Fork/Clone the repo.
2. Make your changes.
2. Make your changes (the main source file is `anchor.js`).
3. Write tests as needed.
4. Run tests locally to confirm everything is working:
- Install test modules: Run `npm ci`
- Run all tests: `npm test`
5. Minify and prepare the code: `npm run build`
6. Submit a Pull Request.

### Docs

The docs site (in `/docs`) is a good place to test changes visually, because it has a lot of AnchorJS examples. The site can be viewed locally by opening `/docs/index.html` in a web browser. The docs are written in plain HTML and can be edited directly.

The version of AnchorJS used in the docs (`docs-anchor.js`) is a copy of the true source file (`anchor.js`), and is unminified (for easy testing, editing, and debugging). You don't need to include changes to `docs-anchor.js` in your PR. `docs-anchor.js` is overwritten to the latest version of AnchorJS source as part of `npm run build` (which is run when publishing a new version of anchor-js).

## License

Licensed with the [MIT License](/LICENSE).
File renamed without changes.
4 changes: 2 additions & 2 deletions docs/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -331,7 +331,7 @@ <h3 data-anchor-id="section-ids">Section IDs</h3>
&lt;script&gt;
anchors.add('h3');
&lt;/script&gt;</code></pre>
<p>This allows you to do things like <a href="https://css-tricks.com/on-target/#article-header-id-3">highlight sections when your users jump to them</a>.</p>
<p>This allows you to do things like <a href="https://css-tricks.com/css-target/#aa-a-perfect-use-highlighting-sections">highlight sections when your users jump to them</a>.</p>
</section>

<h3>Multiple sets of anchors</h3>
Expand Down Expand Up @@ -811,7 +811,7 @@ <h3>Tooltip</h3>
</div>
<footer class="footer"><p><small>Made by <a href="https://www.bryanbraun.com/">Bryan</a>. You should <a href="https://twitter.com/intent/tweet?text=Hi%20%40BryanEBraun%2C%20">say hi</a> sometime. 👋</small></p></footer>
</section>
<script src="anchor.js"></script>
<script src="docs-anchor.js"></script>
<script src="scripts.js"></script>
<script>
anchors.add('.main > h2, .main > h3, .main > section > h2, .main > section > h3').remove('.used-by-label');
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,11 @@
],
"scripts": {
"add-banner": "node banner.js",
"copy-dist": "shx cp anchor.js docs/anchor.js",
"copy-to-docs": "shx cp anchor.js docs/docs-anchor.js",
"jasmine": "karma start test/karma.conf.js --single-run",
"lint": "eslint .",
"lockfile-lint": "lockfile-lint --allowed-hosts npm --validate-https --type npm --path package-lock.json",
"build": "npm-run-all uglify add-banner copy-dist",
"build": "npm-run-all uglify add-banner copy-to-docs",
"uglify": "uglifyjs anchor.js --compress passes=2 --mangle --comments \"/Copyright/\" -o anchor.min.js",
"test": "npm-run-all --continue-on-error --aggregate-output --parallel lint lockfile-lint jasmine"
},
Expand Down

0 comments on commit a125839

Please sign in to comment.