Skip to content

Commit

Permalink
Eject undesirable header quicklinks
Browse files Browse the repository at this point in the history
They don't look good, and the ToC will do the job just as well
  • Loading branch information
nie7321 committed Oct 26, 2023
1 parent 248ab73 commit 5d6ffb7
Show file tree
Hide file tree
Showing 4 changed files with 0 additions and 95 deletions.
29 changes: 0 additions & 29 deletions astro.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -2,42 +2,13 @@ import { defineConfig } from 'astro/config';
import tailwind from "@astrojs/tailwind";
import alpinejs from "@astrojs/alpinejs";
import { rehypeHeadingIds } from '@astrojs/markdown-remark';
import rehypeAutolinkHeadings from "rehype-autolink-headings";
import { toString } from 'hast-util-to-string'
import { h } from 'hastscript'

const createSROnlyLabel = (text) => {
const node = h('span.sr-only', `Section: ${escape(text)}`)
node.properties['is:raw'] = true
return node
}

// https://astro.build/config
export default defineConfig({
integrations: [tailwind(), alpinejs()],
markdown: {
rehypePlugins: [
rehypeHeadingIds,
[
rehypeAutolinkHeadings,
{
behavior: 'append',
group: ({ tagName }) =>
h(`div.heading-wrapper.level-${tagName}`, {
tabIndex: -1,
}),
content: (heading) => [
h(
`span.anchor-icon`,
{
ariaHidden: 'true',
},
'#'
),
createSROnlyLabel(toString(heading)),
],
}
]
],
}
});
3 changes: 0 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,6 @@
"alpinejs": "^3.0.0",
"astro": "^3.3.2",
"csv-parse": "^5.5.2",
"hast-util-to-string": "^3.0.0",
"hastscript": "^8.0.0",
"rehype-autolink-headings": "^7.0.0",
"sass": "^1.69.4",
"simple-datatables": "^8.0.0",
"tailwindcss": "^3.0.24"
Expand Down
17 changes: 0 additions & 17 deletions src/styles/markdown.scss
Original file line number Diff line number Diff line change
Expand Up @@ -5,23 +5,6 @@
* Copyright (c) 2021 Robert Guss. Used under the MIT License <https://github.com/robertguss/Astro-Theme-Creek/blob/master/LICENSE>.
*/
.markdown-content {
h1, h2, h3, h4, h5, h6 {
a {
font-size: .85em;
margin-left: -0.5em;
padding-right: 0.23em;
margin-top: 0.125em;
-webkit-user-select: none;
-moz-user-select: none;
user-select: none;
@apply opacity-0 no-underline float-left;
}

a:hover {
@apply opacity-100 text-web-blue no-underline;
}
}

h1, h2, h3 {
@apply underline;
}
Expand Down
46 changes: 0 additions & 46 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1556,20 +1556,6 @@ hast-util-from-parse5@^8.0.0:
vfile-location "^5.0.0"
web-namespaces "^2.0.0"

hast-util-heading-rank@^3.0.0:
version "3.0.0"
resolved "https://registry.yarnpkg.com/hast-util-heading-rank/-/hast-util-heading-rank-3.0.0.tgz#2d5c6f2807a7af5c45f74e623498dd6054d2aba8"
integrity sha512-EJKb8oMUXVHcWZTDepnr+WNbfnXKFNf9duMesmr4S8SXTJBJ9M4Yok08pu9vxdJwdlGRhVumk9mEhkEvKGifwA==
dependencies:
"@types/hast" "^3.0.0"

hast-util-is-element@^3.0.0:
version "3.0.0"
resolved "https://registry.yarnpkg.com/hast-util-is-element/-/hast-util-is-element-3.0.0.tgz#6e31a6532c217e5b533848c7e52c9d9369ca0932"
integrity sha512-Val9mnv2IWpLbNPqc/pUem+a7Ipj2aHacCwgNfTiK0vJKl0LF+4Ba4+v1oPHFpf3bLYmreq0/l3Gud9S5OH42g==
dependencies:
"@types/hast" "^3.0.0"

hast-util-parse-selector@^3.0.0:
version "3.1.1"
resolved "https://registry.yarnpkg.com/hast-util-parse-selector/-/hast-util-parse-selector-3.1.1.tgz#25ab00ae9e75cbc62cf7a901f68a247eade659e2"
Expand Down Expand Up @@ -1680,13 +1666,6 @@ hast-util-to-parse5@^8.0.0:
web-namespaces "^2.0.0"
zwitch "^2.0.0"

hast-util-to-string@^3.0.0:
version "3.0.0"
resolved "https://registry.yarnpkg.com/hast-util-to-string/-/hast-util-to-string-3.0.0.tgz#2a131948b4b1b26461a2c8ac876e2c88d02946bd"
integrity sha512-OGkAxX1Ua3cbcW6EJ5pT/tslVb90uViVkcJ4ZZIMW/R33DX/AkcJcRrPebPwJkHYwlDHXz4aIwvAAaAdtrACFA==
dependencies:
"@types/hast" "^3.0.0"

hast-util-whitespace@^2.0.0:
version "2.0.1"
resolved "https://registry.yarnpkg.com/hast-util-whitespace/-/hast-util-whitespace-2.0.1.tgz#0ec64e257e6fc216c7d14c8a1b74d27d650b4557"
Expand Down Expand Up @@ -2947,18 +2926,6 @@ readdirp@~3.6.0:
dependencies:
picomatch "^2.2.1"

rehype-autolink-headings@^7.0.0:
version "7.0.0"
resolved "https://registry.yarnpkg.com/rehype-autolink-headings/-/rehype-autolink-headings-7.0.0.tgz#bb98de219fa434ae41304631acabaed32497395f"
integrity sha512-DLskejGYHQP9v7vUW85BeYIclgfMQ1IwAMx+0lm8Sr3cME2NThgy2OdTfosmuBA68fqP5o4FK+dknpUMFvlxYQ==
dependencies:
"@types/hast" "^3.0.0"
"@ungap/structured-clone" "^1.0.0"
hast-util-heading-rank "^3.0.0"
hast-util-is-element "^3.0.0"
unified "^11.0.0"
unist-util-visit "^5.0.0"

rehype-parse@^8.0.0:
version "8.0.5"
resolved "https://registry.yarnpkg.com/rehype-parse/-/rehype-parse-8.0.5.tgz#ccffc21e08e288c7846614f8dc1dc23d603a4a80"
Expand Down Expand Up @@ -3524,19 +3491,6 @@ unified@^10.0.0, unified@^10.1.2:
trough "^2.0.0"
vfile "^5.0.0"

unified@^11.0.0:
version "11.0.3"
resolved "https://registry.yarnpkg.com/unified/-/unified-11.0.3.tgz#e141be0fe466a2d28b2160f62712bc9cbc08fdd4"
integrity sha512-jlCV402P+YDcFcB2VcN/n8JasOddqIiaxv118wNBoZXEhOn+lYG7BR4Bfg2BwxvlK58dwbuH2w7GX2esAjL6Mg==
dependencies:
"@types/unist" "^3.0.0"
bail "^2.0.0"
devlop "^1.0.0"
extend "^3.0.0"
is-plain-obj "^4.0.0"
trough "^2.0.0"
vfile "^6.0.0"

unist-util-generated@^2.0.0:
version "2.0.1"
resolved "https://registry.yarnpkg.com/unist-util-generated/-/unist-util-generated-2.0.1.tgz#e37c50af35d3ed185ac6ceacb6ca0afb28a85cae"
Expand Down

0 comments on commit 5d6ffb7

Please sign in to comment.