Refactor Thead Th scope Markdown plugin (#37299)
This commit is contained in:
@@ -22,6 +22,7 @@ import rewriteAssetImgTags from './plugins/rewrite-asset-img-tags.js'
|
||||
import useEnglishHeadings from './plugins/use-english-headings.js'
|
||||
import wrapInElement from './plugins/wrap-in-element.js'
|
||||
import headingLinks from './plugins/heading-links.js'
|
||||
import rewriteTheadThScope from './plugins/rewrite-thead-th-scope.js'
|
||||
|
||||
// plugins aren't designed to be used more than once,
|
||||
// this workaround lets us do that
|
||||
@@ -29,28 +30,6 @@ import headingLinks from './plugins/heading-links.js'
|
||||
const wrapperForImages = () =>
|
||||
wrapInElement({ selector: 'ol > li img', wrapper: 'span.procedural-image-wrapper' })
|
||||
|
||||
const wrapperForTheadThScope = () =>
|
||||
wrapInElement({
|
||||
selector: 'thead th',
|
||||
wrapper: 'th',
|
||||
// This moves what it finds in the selector inside the wrapper.
|
||||
rewrite: true,
|
||||
wrapperAdditionalAttributes: {
|
||||
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',
|
||||
@@ -78,8 +57,7 @@ export default function createProcessor(context) {
|
||||
})
|
||||
.use(raw)
|
||||
.use(wrapperForImages)
|
||||
.use(wrapperForTheadThScope)
|
||||
.use(wrapperForTbodyThScope)
|
||||
.use(rewriteTheadThScope)
|
||||
.use(wrapperForRowheadersTbody)
|
||||
.use(rewriteImgSources)
|
||||
.use(rewriteAssetImgTags)
|
||||
|
||||
Reference in New Issue
Block a user