diff --git a/.github/codeql/codeql-config.yml b/.github/codeql/codeql-config.yml
new file mode 100644
index 000000000..6affb851a
--- /dev/null
+++ b/.github/codeql/codeql-config.yml
@@ -0,0 +1,3 @@
+name: "CodeQL config"
+paths-ignore:
+ - tests/format
diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml
new file mode 100644
index 000000000..4eaae0ffe
--- /dev/null
+++ b/.github/workflows/codeql.yml
@@ -0,0 +1,40 @@
+name: CodeQL
+
+on:
+ push:
+ branches:
+ - main
+ - patch-release
+ - next
+ - "!renovate/**"
+ pull_request:
+ branches:
+ - main
+ - patch-release
+ - next
+ - "!renovate/**"
+
+permissions:
+ actions: read
+ contents: read
+ security-events: write
+
+concurrency:
+ group: ${{ github.workflow }}-${{ github.ref }}
+ cancel-in-progress: true
+
+jobs:
+ analyze:
+ name: Analyze
+ runs-on: ubuntu-latest
+ steps:
+ - name: Checkout
+ uses: actions/checkout@v3.1.0
+
+ - name: Initialize CodeQL
+ uses: github/codeql-action/init@v2.1.32
+ with:
+ config-file: ./.github/codeql/codeql-config.yml
+
+ - name: Perform CodeQL Analysis
+ uses: github/codeql-action/analyze@v2.1.32
diff --git a/.github/workflows/eslint-rules.yml b/.github/workflows/eslint-rules.yml
index 524cec0c6..22cda132f 100644
--- a/.github/workflows/eslint-rules.yml
+++ b/.github/workflows/eslint-rules.yml
@@ -2,6 +2,10 @@ name: Internal_ESLint_Rules_Test
on:
push:
+ branches:
+ - main
+ - patch-release
+ - next
paths:
- "scripts/tools/eslint-plugin-prettier-internal-rules/**"
# This workflow file
diff --git a/.github/workflows/release-script-test.yml b/.github/workflows/release-script-test.yml
index dc65b8abc..f4e46c5a0 100644
--- a/.github/workflows/release-script-test.yml
+++ b/.github/workflows/release-script-test.yml
@@ -13,6 +13,10 @@ concurrency:
on:
push:
+ branches:
+ - main
+ - patch-release
+ - next
paths:
- "scripts/release/**"
- ".github/workflows/release-script-test.yml"
diff --git a/src/language-markdown/printer-markdown.js b/src/language-markdown/printer-markdown.js
index 0f37642dd..eacd53e5a 100644
--- a/src/language-markdown/printer-markdown.js
+++ b/src/language-markdown/printer-markdown.js
@@ -836,7 +836,7 @@ function printTitle(title, options, printSpace = true) {
: options.singleQuote
? "'"
: '"';
- title = title.replace(/\\/, "\\\\");
+ title = title.replaceAll("\\", "\\\\");
title = title.replace(new RegExp(`(${quote})`, "g"), "\\$1");
return `${quote}${title}${quote}`;
}
diff --git a/tests/format/markdown/linkReference/__snapshots__/jsfmt.spec.js.snap b/tests/format/markdown/linkReference/__snapshots__/jsfmt.spec.js.snap
index b1f0178b8..52b166889 100644
--- a/tests/format/markdown/linkReference/__snapshots__/jsfmt.spec.js.snap
+++ b/tests/format/markdown/linkReference/__snapshots__/jsfmt.spec.js.snap
@@ -206,12 +206,27 @@ proseWrap: "always"
[a]: https://example.com "\\\\\\""
[a]: https://example.com '\\\\\\''
-[a] https://example.com (\\\\\\))
+[a]: https://example.com (\\\\\\))
[a]: https://example.com "\\\\'"
[a]: https://example.com '\\\\"'
[a]: https://example.com (\\\\")
+[a]: https://example.com "\\a\\a"
+[a]: https://example.com '\\a\\a'
+[a]: https://example.com (\\a\\a)
+
+[a]: https://example.com "\\\\a\\\\a"
+[a]: https://example.com '\\\\a\\\\a'
+[a]: https://example.com (\\\\a\\\\a)
+
+[a]: https://example.com "\\\\\\a\\\\\\a"
+[a]: https://example.com '\\\\\\a\\\\\\a'
+[a]: https://example.com (\\\\\\a\\\\\\a)
+
+[a]: https://example.com "\\\\\\\\a\\\\\\\\a"
+[a]: https://example.com '\\\\\\\\a\\\\\\\\a'
+[a]: https://example.com (\\\\\\\\a\\\\\\\\a)
=====================================output=====================================
[ref]: https://example.com "bar"
@@ -231,12 +246,24 @@ https://example.com (\\")
[a]: https://example.com (\\))
-[a]: https://example.com "\\\\\\"" [a]: https://example.com '\\\\\\'' [a]
+[a]: https://example.com "\\\\\\"" [a]: https://example.com '\\\\\\'' [a]:
https://example.com (\\\\\\))
[a]: https://example.com "'"
[a]: https://example.com '"'
[a]: https://example.com '"'
+[a]: https://example.com "\\\\a\\\\a"
+[a]: https://example.com "\\\\a\\\\a"
+[a]: https://example.com "\\\\a\\\\a"
+[a]: https://example.com "\\\\a\\\\a"
+[a]: https://example.com "\\\\a\\\\a"
+[a]: https://example.com "\\\\a\\\\a"
+[a]: https://example.com "\\\\\\\\a\\\\\\\\a"
+[a]: https://example.com "\\\\\\\\a\\\\\\\\a"
+[a]: https://example.com "\\\\\\\\a\\\\\\\\a"
+[a]: https://example.com "\\\\\\\\a\\\\\\\\a"
+[a]: https://example.com "\\\\\\\\a\\\\\\\\a"
+[a]: https://example.com "\\\\\\\\a\\\\\\\\a"
================================================================================
`;
@@ -265,12 +292,27 @@ proseWrap: "never"
[a]: https://example.com "\\\\\\""
[a]: https://example.com '\\\\\\''
-[a] https://example.com (\\\\\\))
+[a]: https://example.com (\\\\\\))
[a]: https://example.com "\\\\'"
[a]: https://example.com '\\\\"'
[a]: https://example.com (\\\\")
+[a]: https://example.com "\\a\\a"
+[a]: https://example.com '\\a\\a'
+[a]: https://example.com (\\a\\a)
+
+[a]: https://example.com "\\\\a\\\\a"
+[a]: https://example.com '\\\\a\\\\a'
+[a]: https://example.com (\\\\a\\\\a)
+
+[a]: https://example.com "\\\\\\a\\\\\\a"
+[a]: https://example.com '\\\\\\a\\\\\\a'
+[a]: https://example.com (\\\\\\a\\\\\\a)
+
+[a]: https://example.com "\\\\\\\\a\\\\\\\\a"
+[a]: https://example.com '\\\\\\\\a\\\\\\\\a'
+[a]: https://example.com (\\\\\\\\a\\\\\\\\a)
=====================================output=====================================
[ref]: https://example.com "bar"
@@ -287,11 +329,23 @@ proseWrap: "never"
[a]: https://example.com (\\))
-[a]: https://example.com "\\\\\\"" [a]: https://example.com '\\\\\\'' [a] https://example.com (\\\\\\))
+[a]: https://example.com "\\\\\\"" [a]: https://example.com '\\\\\\'' [a]: https://example.com (\\\\\\))
[a]: https://example.com "'"
[a]: https://example.com '"'
[a]: https://example.com '"'
+[a]: https://example.com "\\\\a\\\\a"
+[a]: https://example.com "\\\\a\\\\a"
+[a]: https://example.com "\\\\a\\\\a"
+[a]: https://example.com "\\\\a\\\\a"
+[a]: https://example.com "\\\\a\\\\a"
+[a]: https://example.com "\\\\a\\\\a"
+[a]: https://example.com "\\\\\\\\a\\\\\\\\a"
+[a]: https://example.com "\\\\\\\\a\\\\\\\\a"
+[a]: https://example.com "\\\\\\\\a\\\\\\\\a"
+[a]: https://example.com "\\\\\\\\a\\\\\\\\a"
+[a]: https://example.com "\\\\\\\\a\\\\\\\\a"
+[a]: https://example.com "\\\\\\\\a\\\\\\\\a"
================================================================================
`;
diff --git a/tests/format/markdown/linkReference/title.md b/tests/format/markdown/linkReference/title.md
index b8c739849..00267b20e 100644
--- a/tests/format/markdown/linkReference/title.md
+++ b/tests/format/markdown/linkReference/title.md
@@ -15,9 +15,24 @@
[a]: https://example.com "\\\""
[a]: https://example.com '\\\''
-[a] https://example.com (\\\))
+[a]: https://example.com (\\\))
[a]: https://example.com "\\'"
[a]: https://example.com '\\"'
[a]: https://example.com (\\")
+[a]: https://example.com "\a\a"
+[a]: https://example.com '\a\a'
+[a]: https://example.com (\a\a)
+
+[a]: https://example.com "\\a\\a"
+[a]: https://example.com '\\a\\a'
+[a]: https://example.com (\\a\\a)
+
+[a]: https://example.com "\\\a\\\a"
+[a]: https://example.com '\\\a\\\a'
+[a]: https://example.com (\\\a\\\a)
+
+[a]: https://example.com "\\\\a\\\\a"
+[a]: https://example.com '\\\\a\\\\a'
+[a]: https://example.com (\\\\a\\\\a)
diff --git a/website/pages/playground/index.html b/website/pages/playground/index.html
index 60bc8a10a..2cae24070 100644
--- a/website/pages/playground/index.html
+++ b/website/pages/playground/index.html
@@ -28,39 +28,146 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -103,6 +210,12 @@
-
+