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

Set correct scope attributes on rowheaders tables (#35999)

Co-authored-by: Rachael Sewell <rachmari@github.com>
This commit is contained in:
Peter Bengtsson
2023-03-30 07:41:33 -04:00
committed by GitHub
parent d53b5a2bb1
commit 8d13af951e
3 changed files with 42 additions and 3 deletions

View File

@@ -29,12 +29,25 @@ 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 wrapperForTables = () =>
const wrapperForRowheadersThead = () =>
wrapInElement({
selector: '.rowheaders 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',
wrapper: 'th',
// This moves what it finds in the selector inside the wrapper.
rewrite: true,
wrapperAdditionalAttributes: {
scope: 'row',
},
})
export default function createProcessor(context) {
@@ -57,7 +70,8 @@ export default function createProcessor(context) {
})
.use(raw)
.use(wrapperForImages)
.use(wrapperForTables)
.use(wrapperForRowheadersThead)
.use(wrapperForRowheadersTbody)
.use(rewriteImgSources)
.use(rewriteAssetImgTags)
.use(rewriteLocalLinks, context)