-
Notifications
You must be signed in to change notification settings - Fork 15
chore(docs): auto-generate api reference (VIV-2180) #1984
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
| fs.readFileSync(`dist/libs/wrapper-gen/component-metadata.json`, 'utf-8') | ||
| ); | ||
|
|
||
| const escapeMarkdown = (text = '') => text.replace(/([<>{}])/gm, '\\$1'); |
Check failure
Code scanning / CodeQL
Incomplete string escaping or encoding
Show autofix suggestion
Hide autofix suggestion
Copilot Autofix
AI about 1 year ago
To fix the problem, we need to ensure that backslashes are also escaped in the escapeMarkdown function. This can be done by adding backslashes to the list of characters to be escaped. We will use a regular expression that includes backslashes and ensure that all occurrences are replaced.
- Modify the
escapeMarkdownfunction to include backslashes in the characters to be escaped. - Update the regular expression to handle backslashes properly.
-
Copy modified line R9
| @@ -8,3 +8,3 @@ | ||
|
|
||
| const escapeMarkdown = (text = '') => text.replace(/([<>{}])/gm, '\\$1'); | ||
| const escapeMarkdown = (text = '') => text.replace(/([\\<>{}])/gm, '\\$1'); | ||
|
|
|
|
||
| const escapeMarkdown = (text = '') => text.replace(/([<>{}])/gm, '\\$1'); | ||
|
|
||
| const escapeType = (text = '') => text.replace(/([|])/gm, '\\$1'); |
Check failure
Code scanning / CodeQL
Incomplete string escaping or encoding
Show autofix suggestion
Hide autofix suggestion
Copilot Autofix
AI about 1 year ago
To fix the problem, we need to ensure that the escapeType function also escapes backslashes. This can be done by adding an additional replacement step to handle backslashes before escaping the pipe character. The best way to fix this without changing existing functionality is to use a regular expression to replace backslashes with double backslashes and then proceed with the existing replacement for the pipe character.
-
Copy modified line R11
| @@ -10,3 +10,3 @@ | ||
|
|
||
| const escapeType = (text = '') => text.replace(/([|])/gm, '\\$1'); | ||
| const escapeType = (text = '') => text.replace(/\\/g, '\\\\').replace(/([|])/gm, '\\$1'); | ||
|
|
| (resolvedType.length === 1 | ||
| ? `\`${resolvedType[0].text}\`` | ||
| : `*Enum*:<br/>${generateEnumType(resolvedType)}` | ||
| ).replace(/\|/g, '\\|'), |
Check failure
Code scanning / CodeQL
Incomplete string escaping or encoding
Show autofix suggestion
Hide autofix suggestion
Copilot Autofix
AI about 1 year ago
To fix the problem, we need to ensure that backslashes are properly escaped in the input strings. This can be achieved by adding a replacement for backslashes before any other replacements. Additionally, we should ensure that all replacements use the global flag to replace all occurrences of the target characters.
The best way to fix the problem without changing existing functionality is to update the escapeMarkdown, escapeType, and escapeDescription functions to handle backslashes and use the global flag for all replacements. This involves modifying the regular expressions used in these functions.
-
Copy modified line R9 -
Copy modified line R11
| @@ -8,5 +8,5 @@ | ||
|
|
||
| const escapeMarkdown = (text = '') => text.replace(/([<>{}])/gm, '\\$1'); | ||
| const escapeMarkdown = (text = '') => text.replace(/\\/g, '\\\\').replace(/([<>{}])/g, '\\$1'); | ||
|
|
||
| const escapeType = (text = '') => text.replace(/([|])/gm, '\\$1'); | ||
| const escapeType = (text = '') => text.replace(/\\/g, '\\\\').replace(/([|])/g, '\\$1'); | ||
|
|
No description provided.