1
mirror of https://github.com/jakejarvis/jarv.is.git synced 2025-04-27 00:28:27 -04:00

add a few more helpful anchor IDs on sub-headings

This commit is contained in:
Jake Jarvis 2021-08-30 23:19:01 -04:00
parent eace0683b4
commit 3a7cd284a4
Signed by: jake
GPG Key ID: 2B0C9CF251E69A39
8 changed files with 43 additions and 39 deletions

View File

@ -1,4 +1,5 @@
{
"root": true,
"extends": [
"@jakejarvis/eslint-config",
"plugin:no-unsanitized/DOM",

View File

@ -63,11 +63,11 @@ div#content {
a.anchorjs-link {
display: inline-block;
margin-left: 0.25em;
padding-left: 0.25em;
padding-right: 0.5em;
padding: 0 0.5em 0 0.25em;
background: none;
opacity: 0;
font-weight: 300;
background: none;
line-height: 1;
&::before {
content: "\0023"; // pound sign
@ -81,7 +81,7 @@ div#content {
}
&:hover > a.anchorjs-link {
opacity: 1;
opacity: 1; // '#' link appears on hover over entire sub-heading line
}
}
}

View File

@ -56,7 +56,7 @@ div.highlight-clipboard-enabled {
right: 0;
width: 5.5em;
padding: 0.6em 0.2em;
padding: 0.75em 0.25em;
border: 1px solid;
cursor: pointer;

View File

@ -45,7 +45,7 @@ A _very_ barebones example is embedded above ([view the source here](https://git
---
### [Minified JS](https://raw.githubusercontent.com/jakejarvis/dark-mode-example/gh-pages/dark-mode.min.js) (410 bytes gzipped! 📦):
### [Minified JS](https://raw.githubusercontent.com/jakejarvis/dark-mode-example/gh-pages/dark-mode.min.js) (410 bytes gzipped! 📦): {#minified-js}
<!-- prettier-ignore -->
```js
@ -53,7 +53,7 @@ A _very_ barebones example is embedded above ([view the source here](https://git
(function(){var e=window,t=e.document,i=t.body.classList,a=localStorage,c="dark_mode_pref",d=a.getItem(c),n="dark",o="light",r=o,s=t.querySelector(".dark-mode-toggle"),m=r===n,l=function(e){i.remove(n,o);i.add(e);m=e===n};d===n&&l(n);d===o&&l(o);if(!d){var f=function(e){return"(prefers-color-scheme: "+e+")"};e.matchMedia(f(n)).matches?l(n):e.matchMedia(f(o)).matches?l(o):l(r);e.matchMedia(f(n)).addListener((function(e){e.matches&&l(n)}));e.matchMedia(f(o)).addListener((function(e){e.matches&&l(o)}))}if(s){s.style.visibility="visible";s.addEventListener("click",(function(){if(m){l(o);a.setItem(c,o)}else{l(n);a.setItem(c,n)}}),!0)}})();
```
### Full JS:
### Full JS: {#full-js}
<!-- prettier-ignore -->
```js
@ -136,7 +136,7 @@ A _very_ barebones example is embedded above ([view the source here](https://git
})();
```
### HTML & CSS Example:
### HTML & CSS Example: {#html-css}
<!-- prettier-ignore -->
```html
@ -191,7 +191,7 @@ A _very_ barebones example is embedded above ([view the source here](https://git
---
### Further reading:
### Further reading: {#further-reading}
- [The Dark (Mode) Web Rises](https://charlesrt.uk/blog/the-dark-web-rises/)
- [Dark Mode vs. Light Mode: Which Is Better?](https://www.nngroup.com/articles/dark-mode/)

View File

@ -29,7 +29,7 @@ But this means in the meantime, project owners are free to rename their branches
---
### 1. Move your `master` branch to `main`:
### 1. Move your `master` branch to `main`: {#step-1}
...or `development`, `unstable`, `trunk`, `live`, `original`; your choice!
@ -39,7 +39,7 @@ We use `branch -m` to **move** the branch locally instead of creating a new one
git branch -m master main
```
### 2. Push the new branch to GitHub:
### 2. Push the new branch to GitHub: {#step-2}
The first command is probably familiar. `-u` sets the new branch as the local default at the same time, and the second line ensures our local `HEAD` points to our new branch on GitHub.
@ -50,13 +50,13 @@ git remote set-head origin main
You can verify this worked by running `git branch -r`. You should see something like `origin/HEAD -> origin/main`.
### 3. Change the default branch in your repository's settings:
### 3. Change the default branch in your repository's settings: {#step-3}
Setting the default branch remotely is the only step that can't be done on the command line (although you can technically [use the GitHub API](https://github.com/erbridge/github-branch-renamer)). Head to **Settings → Branches** on GitHub to [change the default branch](https://help.github.com/en/github/collaborating-with-issues-and-pull-requests/changing-the-base-branch-of-a-pull-request).
{{< image src="images/github-default.png" width="810" alt="Changing the default branch of a GitHub repository" />}}
### 4. Delete the old `master` branch on GitHub:
### 4. Delete the old `master` branch on GitHub: {#step-4}
We used `-m` (move) to **rename** the `master` branch locally, but GitHub will still have two identical branches at this point (as you saw in the previous step). Deleting it can be a little nerve-racking, so poke around your repository on GitHub and make sure your new branch is there and the commit history is correct.
@ -66,7 +66,7 @@ You can say good riddance to `master` [through the GitHub UI](https://help.githu
git push origin --delete master
```
### 5. Scan your code, scripts, automation, etc. for references to `master`:
### 5. Scan your code, scripts, automation, etc. for references to `master`: {#step-5}
Do a quick search of your codebase for `master` to manually replace any dead references to it.
@ -78,7 +78,7 @@ Pay attention to CI files — `.travis.yml`, `.github/workflows/`, `.circleci/c
> **Update:** GitHub is now [redirecting deleted branches](https://github.blog/changelog/2020-07-17-links-to-deleted-branches-now-redirect-to-the-default-branch/) to the default branch!
### Bonus points:
### Bonus points: {#bonus-points}
None of this will work on a brand new repository with zero commits. But we can hack around this limitation pretty easily...
@ -96,7 +96,7 @@ And while we're at it, Nat... **It's time to finally [#DropICE](https://github.c
---
### Further reading:
### Further reading: {#further-reading}
- [_Master/slave (technology)_ on Wikipedia](<https://en.wikipedia.org/wiki/Master/slave_(technology)>)
- [History of "master" in BitKeeper → Git](https://mail.gnome.org/archives/desktop-devel-list/2019-May/msg00066.html)

View File

@ -29,13 +29,13 @@ The following steps to submit a pull request will work on Git repositories hoste
Starting from the very beginning, we'll fork an existing repository to our account, clone the fork locally, commit your changes to a new branch, and push it back upstream to GitHub to submit for approval.
## 1. Forking the Repository
## 1. Forking the Repository {#step-1}
Assuming you're using GitHub, this step is easy. Just find the repository you're contributing to and press the Fork button in the upper left. This will create an exact copy of the repository (and all of its branches) under your own username.
{{< image src="images/step1.png" alt="Step 1" />}}
## 2. Clone your new fork locally
## 2. Clone your new fork locally {#step-2}
GitHub will automatically redirect you to the forked repository under your username. This is the repository you need to clone to your local development environment, **not** the original. Grab the URL GitHub provides under the green "Clone or Download" button and plug it into the command below.
@ -45,7 +45,7 @@ git clone git@github.com:jakejarvis/react-native.git
{{< image src="images/step2.png" width="420" alt="Step 2" />}}
## 3. Track the original repository as a remote of the fork
## 3. Track the original repository as a remote of the fork {#step-3}
_This step is technically optional, but important if you plan to continue contributing to a project in the future, so we might as well..._
@ -60,7 +60,7 @@ git remote add --track master upstream git@github.com:facebook/react-native.git
git fetch upstream
```
## 4. Create a new branch for your changes
## 4. Create a new branch for your changes {#step-4}
It's possible to make changes directly to the `master` branch, but this might FUBAR things down the road for complicated reasons. It's best to [`checkout`](https://git-scm.com/docs/git-checkout) a new branch for **each** change/improvement you want to make. Replace `fix-readme-typo` with a more descriptive name for your changes, like `add-mobile-site` or `update-dependencies`.
@ -68,11 +68,11 @@ It's possible to make changes directly to the `master` branch, but this might FU
git checkout -b fix-readme-typo upstream/master
```
## 5. Make your changes!
## 5. Make your changes! {#step-5}
This is either the easiest part or the hardest part, depending on how you look at it. 😉 At this point, you're isolated in the new branch you just created, and it's safe to open whatever text editor or IDE you use and go wild.
## 6. Add, commit, and push the changes
## 6. Add, commit, and push the changes {#step-6}
You're probably used to these commands. Add the files you've changed and commit them with a descriptive message.
@ -87,7 +87,7 @@ The one difference is the branch you're pushing to. You likely usually push to `
git push -u origin fix-readme-typo
```
## 7. Submit your pull request
## 7. Submit your pull request {#step-7}
You're now all ready to submit the improvement you've made to the project's maintainers for approval. Head over to the original repositories Pull Requests tab, and you should see an automatic suggestion from GitHub to create a pull request from your new branch.

View File

@ -50,7 +50,7 @@
"node-fetch": "^2.6.1",
"numeral": "^2.0.6",
"query-string": "^7.0.1",
"simple-anchor": "^1.0.1",
"simple-anchor": "^1.0.2",
"trim-newlines": "^4.0.2",
"twemoji": "13.1.0",
"twemoji-emojis": "14.1.0",

View File

@ -955,9 +955,12 @@
integrity sha512-T9pUWd3dp2lcJabGGkQClNPbPUsBeoR2APnKkgjtxiTrnbl4cRjaXYlQvyyvRRASAe07agYnJobdDqA+IbvnXg==
"@jakejarvis/eslint-config@*":
version "1.0.1"
resolved "https://registry.yarnpkg.com/@jakejarvis/eslint-config/-/eslint-config-1.0.1.tgz#10a149fa8fdbe730a7d65f7808b9acc149564df8"
integrity sha512-+UM5F7BQRBses5DpaWj6hcvxE5Qqb8xJRYSxp7ucqk6eEnm92xLgN0frGe2/zXtVgRWGt5Fvx/5EwkGM6tfNCg==
version "1.0.3"
resolved "https://registry.yarnpkg.com/@jakejarvis/eslint-config/-/eslint-config-1.0.3.tgz#4074b572dbb0ad0b5223ef9f286ae1a863042e9f"
integrity sha512-BQvuO9h8bgxtMYhz9ksutEzNqBl74Bi4PL5MDRv4xoBLMCcbhXyDWZOGiyMSNy3CyaK0LSUEGUTKWIqz9avyrQ==
dependencies:
eslint-plugin-compat "^3.13.0"
eslint-plugin-import "^2.24.2"
"@jest/types@^27.1.0":
version "27.1.0"
@ -1480,9 +1483,9 @@
form-data "^3.0.0"
"@types/node@*":
version "16.7.7"
resolved "https://registry.yarnpkg.com/@types/node/-/node-16.7.7.tgz#73b345af160b495716cf7e2b54b68f701320f08b"
integrity sha512-bxWC4rgIF/FjM7JsPvpk6ZKGITgw27qsYCbi6h4kWZWYpchOLENgvFaRBZUc64Q/M1y+X2EteahRbyo8QFCKdw==
version "16.7.8"
resolved "https://registry.yarnpkg.com/@types/node/-/node-16.7.8.tgz#2448be5f24fe6b77114632b6350fcd219334651e"
integrity sha512-8upnoQU0OPzbIkm+ZMM0zCeFCkw2s3mS0IWdx0+AAaWqm4fkBb0UJp8Edl7FVKRamYbpJC/aVsHpKWBIbiC7Zg==
"@types/normalize-package-data@^2.4.0":
version "2.4.1"
@ -3884,9 +3887,9 @@ ee-first@1.1.1:
integrity sha1-WQxhFWsK4vTwJVcyoViyZrxWsh0=
electron-to-chromium@^1.3.811:
version "1.3.822"
resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.3.822.tgz#7036edc7f669b0aa79e9801dc5f56866c6ddc0b2"
integrity sha512-k7jG5oYYHxF4jx6PcqwHX3JVME/OjzolqOZiIogi9xtsfsmTjTdie4x88OakYFPEa8euciTgCCzvVNwvmjHb1Q==
version "1.3.824"
resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.3.824.tgz#9f85cc826c70b12180009d461e3b19c8121a56d2"
integrity sha512-Fk+5aD0HDi9i9ZKt9n2VPOZO1dQy7PV++hz2wJ/KIn+CvVfu4fny39squHtyVDPuHNuoJGAZIbuReEklqYIqfA==
emoji-regex@^7.0.1:
version "7.0.3"
@ -4111,7 +4114,7 @@ eslint-module-utils@^2.6.2:
debug "^3.2.7"
pkg-dir "^2.0.0"
eslint-plugin-compat@~3.13.0:
eslint-plugin-compat@^3.13.0, eslint-plugin-compat@~3.13.0:
version "3.13.0"
resolved "https://registry.yarnpkg.com/eslint-plugin-compat/-/eslint-plugin-compat-3.13.0.tgz#fade6f2ad25263cf93f8d23c988533551ced8663"
integrity sha512-cv8IYMuTXm7PIjMVDN2y4k/KVnKZmoNGHNq27/9dLstOLydKblieIv+oe2BN2WthuXnFNhaNvv3N1Bvl4dbIGA==
@ -4125,7 +4128,7 @@ eslint-plugin-compat@~3.13.0:
lodash.memoize "4.1.2"
semver "7.3.5"
eslint-plugin-import@~2.24.2:
eslint-plugin-import@^2.24.2, eslint-plugin-import@~2.24.2:
version "2.24.2"
resolved "https://registry.yarnpkg.com/eslint-plugin-import/-/eslint-plugin-import-2.24.2.tgz#2c8cd2e341f3885918ee27d18479910ade7bb4da"
integrity sha512-hNVtyhiEtZmpsabL4neEj+6M5DCLgpYyG9nzJY8lZQeQXEn5UPW1DpUdsMHMXsq98dbNm7nt1w9ZMSVpfJdi8Q==
@ -9490,10 +9493,10 @@ signal-exit@^3.0.0, signal-exit@^3.0.2, signal-exit@^3.0.3:
resolved "https://registry.yarnpkg.com/signal-exit/-/signal-exit-3.0.3.tgz#a1410c2edd8f077b08b4e253c8eacfcaf057461c"
integrity sha512-VUJ49FC8U1OxwZLxIbTTrDvLnf/6TDgxZcK8wxR8zs13xpx7xbG60ndBlhNrFi2EMuFRoeDoJO7wthSLq42EjA==
simple-anchor@^1.0.1:
version "1.0.1"
resolved "https://registry.yarnpkg.com/simple-anchor/-/simple-anchor-1.0.1.tgz#bc3e069554bae19c9e2063cd1c72e2c6d94b0774"
integrity sha512-wX21+94g3rUrbva9iLXzPtI6aJX84KzcAi2PJH2aacqM9C8pYDgOMkCjG+lrXhrF2OdCjFvO8zjUfnhUzHL13A==
simple-anchor@^1.0.2:
version "1.0.2"
resolved "https://registry.yarnpkg.com/simple-anchor/-/simple-anchor-1.0.2.tgz#a58aab1dad122ccb1cc5d07a5b1130132dc0a6eb"
integrity sha512-PeUwwqJqj43UkW+Pyb4IaSPXDdrANANnnhYV4n9czRbnBuxIIhpiKC3KNkOWh8iaFbCdnP8vnmfQBPg4H4QU8A==
simple-git-hooks@^2.6.1:
version "2.6.1"