speed up link checker on PR (#32992)
This commit is contained in:
@@ -24,14 +24,6 @@ import wrapInElement from './plugins/wrap-in-element.js'
|
||||
import doctocatLinkIcon from './doctocat-link-icon.js'
|
||||
const graphql = HighlightjsGraphql.definer
|
||||
|
||||
// The rewrite-asset-urls plugin is nice because it makes the `<img src=...>`
|
||||
// tags use unique URLs so they can be aggressively cached in the
|
||||
// CDN. But it might not always make sense to bother. For example, in
|
||||
// some CI where you're rendering lots of content and don't care
|
||||
// about aggressive CDN caching at all. E.g. Actions that do link checking
|
||||
// on rendered HTML.
|
||||
const DISABLE_REWRITE_ASSET_URLS = JSON.parse(process.env.DISABLE_REWRITE_ASSET_URLS || 'false')
|
||||
|
||||
export default function createProcessor(context) {
|
||||
return unified()
|
||||
.use(process.env.COMMONMARK ? markdownNext : markdown)
|
||||
@@ -52,7 +44,21 @@ export default function createProcessor(context) {
|
||||
})
|
||||
.use(raw)
|
||||
.use(wrapInElement, { selector: 'ol > li img', wrapper: 'span.procedural-image-wrapper' })
|
||||
.use(DISABLE_REWRITE_ASSET_URLS ? null : rewriteImgSources)
|
||||
.use(rewriteImgSources)
|
||||
.use(rewriteLocalLinks, {
|
||||
languageCode: context.currentLanguage,
|
||||
version: context.currentVersion,
|
||||
})
|
||||
.use(html)
|
||||
}
|
||||
|
||||
export function createMinimalProcessor(context) {
|
||||
return unified()
|
||||
.use(process.env.COMMONMARK ? markdownNext : markdown)
|
||||
.use(process.env.COMMONMARK ? gfm : null)
|
||||
.use(remark2rehype, { allowDangerousHtml: true })
|
||||
.use(slug)
|
||||
.use(raw)
|
||||
.use(rewriteLocalLinks, {
|
||||
languageCode: context.currentLanguage,
|
||||
version: context.currentVersion,
|
||||
|
||||
Reference in New Issue
Block a user