Skip to content

Commit 52ca96d

Browse files
heiskrCopilot
andauthored
⚡️ Skip remark pipeline when article api content has no internal links (#60770)
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent 6310125 commit 52ca96d

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

src/content-render/index.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,12 @@ export async function renderContent(
3838
try {
3939
template = await renderLiquid(template, context)
4040
if (context.markdownRequested) {
41-
const md = await renderMarkdown(template, context)
42-
43-
return md
41+
// Skip the remark pipeline when there are no internal links to rewrite,
42+
// since link rewriting is the only transformation the pipeline performs.
43+
if (!/\]\(\s*<?\//.test(template) && !/\]:\s*\//.test(template)) {
44+
return template.trim()
45+
}
46+
return await renderMarkdown(template, context)
4447
}
4548

4649
const html = await renderUnified(template, context, options)

0 commit comments

Comments
 (0)