This is an automated email from the ASF dual-hosted git repository.
jeffreyh pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/doris-website.git
The following commit(s) were added to refs/heads/master by this push:
new 75cbe244cd8 [Fix]:avoid identifying dead links in code blocks (#2679)
75cbe244cd8 is described below
commit 75cbe244cd854f657fd0cea14d306719a5ec661d
Author: yangon <[email protected]>
AuthorDate: Thu Jul 31 10:15:02 2025 +0800
[Fix]:avoid identifying dead links in code blocks (#2679)
---
scripts/check_move.js | 12 +++++++++++-
1 file changed, 11 insertions(+), 1 deletion(-)
diff --git a/scripts/check_move.js b/scripts/check_move.js
index 0ad15df06b2..18632330e32 100644
--- a/scripts/check_move.js
+++ b/scripts/check_move.js
@@ -1,4 +1,8 @@
#!/usr/bin/env node
+/**
+ * Used to check whether there are broken links in the modified files in the
pipeline
+ */
+
const { execSync } = require("child_process");
const fs = require("fs");
@@ -42,11 +46,17 @@ function isLocalLink(link) {
!path.isAbsolute(link);
}
+function removeCodeBlocks(content) {
+ return content.replace(/```[\s\S]*?```/g, ""); // remove ```...```
+}
+
// Check links in files
function checkFileLinks(filePath) {
const content = fs.readFileSync(filePath, "utf-8");
const dir = path.dirname(filePath);
- const matches = [...content.matchAll(linkRegex)];
+
+ const cleanedContent = removeCodeBlocks(content);
+ const matches = [...cleanedContent.matchAll(linkRegex)];
for (const match of matches) {
const rawLink = match[1].split("#")[0]; // Remove anchor point
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]