Skip to content

Commit

Permalink
Merge pull request github#18919 from github/restore-procedural-image-…
Browse files Browse the repository at this point in the history
…wrapper

Restore procedural-image-wrapper class on image divs
  • Loading branch information
sarahs authored Apr 22, 2021
2 parents 7df8df4 + 8ab292b commit c616844
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion lib/render-content/create-processor.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ module.exports = function createProcessor (context) {
.use(highlight, { languages: { graphql }, subset: false })
.use(raw)
.use(rewriteLegacyAssetPaths, context)
.use(wrapInElement, { selector: 'ol > li img', wrapper: 'div.procedural-image-wrapper' })
.use(wrapInElement, { selector: 'ol > li img', wrapper: 'span.procedural-image-wrapper' })
.use(rewriteLocalLinks, { languageCode: context.currentLanguage, version: context.currentVersion })
.use(html)
}
8 changes: 4 additions & 4 deletions lib/render-content/plugins/wrap-in-element.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,11 @@ module.exports = options => {
throw new TypeError('Expected a `string` as selector')
}

for (const match of selectAll(options.selector, tree)) {
for (const match of selectAll(selector, tree)) {
visit(tree, match, (node, i, parent) => {
const wrapper = parseSelector('div')
wrapper.children = [node]
parent.children[i] = wrapper
const parsedWrapper = parseSelector(wrapper)
parsedWrapper.children = [node]
parent.children[i] = parsedWrapper
})
}
}
Expand Down

0 comments on commit c616844

Please sign in to comment.