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

Refactor use of wrapInElement (#37675)

This commit is contained in:
Peter Bengtsson
2023-06-08 13:19:36 -04:00
committed by GitHub
parent 0b3540d1a6
commit 4ab430da63
5 changed files with 53 additions and 142 deletions

View File

@@ -20,16 +20,10 @@ import rewriteLocalLinks from './plugins/rewrite-local-links.js'
import rewriteImgSources from './plugins/rewrite-asset-urls.js'
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'
import rewriteForRowheaders from './plugins/rewrite-for-rowheaders.js'
// plugins aren't designed to be used more than once,
// this workaround lets us do that
// see https://github.com/unifiedjs/unified/issues/79
const wrapperForImages = () =>
wrapInElement({ selector: 'ol > li img', wrapper: 'span.procedural-image-wrapper' })
import wrapProceduralImages from './plugins/wrap-procedural-images.js'
export default function createProcessor(context) {
return unified()
@@ -46,7 +40,7 @@ export default function createProcessor(context) {
subset: false,
})
.use(raw)
.use(wrapperForImages)
.use(wrapProceduralImages)
.use(rewriteTheadThScope)
.use(rewriteForRowheaders)
.use(rewriteImgSources)