Set correct scope attributes on rowheaders tables (#35999)
Co-authored-by: Rachael Sewell <rachmari@github.com>
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user