@@ -2,14 +2,14 @@ import type { Context, Page } from '@/types'
22import type { PageTransformer } from './types'
33import { load } from 'js-yaml'
44import path from 'path'
5- import { liquid , renderContent } from '@/content-render/index'
5+ import { liquid } from '@/content-render/index'
66import { allVersions } from '@/versions/lib/all-versions'
77import { loadTemplate } from '@/article-api/lib/load-template'
88import { getSecretScanningData } from '@/secret-scanning/lib/get-secret-scanning-data'
99
1010/**
1111 * Transformer for Secret Scanning pages.
12- * Loads pattern data and converts secret scanning documentation into markdown format using a Liquid template .
12+ * Loads pattern data and converts secret scanning documentation into markdown format.
1313 * Used by the Article API to render Secret Scanning documentation dynamically.
1414 */
1515export class SecretScanningTransformer implements PageTransformer {
@@ -87,22 +87,15 @@ export class SecretScanningTransformer implements PageTransformer {
8787
8888 const intro = page . intro ? await page . renderProp ( 'intro' , context , { textOnly : true } ) : ''
8989
90- // Prepare template data
91- const templateData : Record < string , unknown > = {
92- page : {
93- title : page . title ,
94- intro,
95- } ,
96- content,
97- }
98-
99- // Load and render template
90+ // Render the template with Liquid only — page.render() already ran
91+ // rewriteLocalLinks on all markdown links, and the regex cleanup above
92+ // only creates fragment links (e.g. #token-versions) which don't need
93+ // link rewriting. So we skip the expensive remark re-parse.
10094 const templateContent = loadTemplate ( this . templateName )
101-
102- return await renderContent ( templateContent , {
95+ return await liquid . parseAndRender ( templateContent , {
10396 ...context ,
104- ... templateData ,
105- markdownRequested : true ,
97+ page : { title : page . title , intro } ,
98+ content ,
10699 } )
107100 }
108101}
0 commit comments