Skip to content

Playwright is a framework for Web Testing and Automation. It allows testing Chromium, Firefox and WebKit with a single API.

devops: render-release-notes link to github (#38922)

Simon Knott5edb755f8390
diff --git a/utils/doclint/linkUtils.js b/utils/doclint/linkUtils.js
index 0c8b919a2d..86372398b9 100644
--- a/utils/doclint/linkUtils.js
+++ b/utils/doclint/linkUtils.js
@@ -149,10 +149,16 @@ function renderJSSignature(args) {
* @param {string} content
* @param {string} languagePath
* @param {string} relativePath
+ * @param {boolean} releaseNotesMode
* @returns {string}
*/
-function renderPlaywrightDevLinks(content, languagePath, relativePath) {
+function renderPlaywrightDevLinks(content, languagePath, relativePath, releaseNotesMode = false) {
return content.replace(/\[([^\]]+)\]\((\.[^\)]+)\)/g, (match, p1, p2) => {
+ if (releaseNotesMode && p2.includes('/images/')) {
+ const url = new URL(p2, `https://github.com/microsoft/playwright/blob/main/docs/src/`);
+ url.searchParams.set('raw', 'true');
+ return `[${p1}](${url.toString()})`;
+ }
return `[${p1}](${new URL(p2.replace('.md', ''), `https://playwright.dev${languagePath}/docs${relativePath}/`).toString()})`;
});
}
diff --git a/utils/render_release_notes.mjs b/utils/render_release_notes.mjs
index 4d50acb7bc..33f733965c 100644
--- a/utils/render_release_notes.mjs
+++ b/utils/render_release_notes.mjs
@@ -72,5 +72,5 @@ documentation.renderLinksInNodes(nodes);
throw new Error(`Could not find version ${version} in release notes.\nUsage: node ${path.basename(process.argv[1])} <language> <version>\n\nWhere <version> is a version tag without v prefix, e.g. 1.45`);
}
-const output = renderPlaywrightDevLinks(md.render(nodes), languageToRelativeDocsPath(language), '');
+const output = renderPlaywrightDevLinks(md.render(nodes), languageToRelativeDocsPath(language), '', true);
process.stdout.write(output);