1
0
mirror of synced 2025-12-20 10:28:40 -05:00

All table th gets scope (#36555)

This commit is contained in:
Peter Bengtsson
2023-04-26 10:58:25 -04:00
committed by GitHub
parent 8fd4a37d51
commit 2291eed3c6
2 changed files with 19 additions and 4 deletions

View File

@@ -29,9 +29,10 @@ import doctocatLinkIcon from './doctocat-link-icon.js'
// see https://github.com/unifiedjs/unified/issues/79
const wrapperForImages = () =>
wrapInElement({ selector: 'ol > li img', wrapper: 'span.procedural-image-wrapper' })
const wrapperForRowheadersThead = () =>
const wrapperForTheadThScope = () =>
wrapInElement({
selector: '.rowheaders thead th',
selector: 'thead th',
wrapper: 'th',
// This moves what it finds in the selector inside the wrapper.
rewrite: true,
@@ -39,6 +40,18 @@ const wrapperForRowheadersThead = () =>
scope: 'col',
},
})
const wrapperForTbodyThScope = () =>
wrapInElement({
selector: 'thead th',
wrapper: 'th',
// This moves what it finds in the selector inside the wrapper.
rewrite: true,
wrapperAdditionalAttributes: {
scope: 'col',
},
})
const wrapperForRowheadersTbody = () =>
wrapInElement({
selector: '.rowheaders tbody tr td:first-child',
@@ -70,7 +83,8 @@ export default function createProcessor(context) {
})
.use(raw)
.use(wrapperForImages)
.use(wrapperForRowheadersThead)
.use(wrapperForTheadThScope)
.use(wrapperForTbodyThScope)
.use(wrapperForRowheadersTbody)
.use(rewriteImgSources)
.use(rewriteAssetImgTags)