1
0
mirror of synced 2025-12-20 02:19:14 -05:00

Use Doctocat link header style (#21615)

* update autolinkHeadings to use Doctocat link header style

* fix header link test

* update graphql/rest rendering to use doctocat header link

* fix: miniToc issue with stray anchor

Co-authored-by: Rachael Sewell <rachmari@github.com>
This commit is contained in:
Mike Surowiec
2021-09-21 18:14:38 -04:00
committed by GitHub
parent 9ba2e1dd41
commit d2199e3deb
16 changed files with 324 additions and 268 deletions

View File

@@ -21,6 +21,7 @@ import rewriteLocalLinks from './plugins/rewrite-local-links.js'
import useEnglishHeadings from './plugins/use-english-headings.js'
import rewriteLegacyAssetPaths from './plugins/rewrite-legacy-asset-paths.js'
import wrapInElement from './plugins/wrap-in-element.js'
import doctocatLinkIcon from './doctocat-link-icon.js'
const graphql = HighlightjsGraphql.definer
export default function createProcessor(context) {
@@ -32,7 +33,11 @@ export default function createProcessor(context) {
.use(remark2rehype, { allowDangerousHtml: true })
.use(slug)
.use(useEnglishHeadings, context)
.use(autolinkHeadings, { behavior: 'wrap' })
.use(autolinkHeadings, {
behavior: 'prepend',
properties: { ariaHidden: true, tabIndex: -1, class: 'doctocat-link' },
content: doctocatLinkIcon,
})
.use(highlight, {
languages: { graphql, dockerfile, http, groovy, erb, powershell },
subset: false,