Skip to content

Commit

Permalink
chore: added spaces outside of regex match
Browse files Browse the repository at this point in the history
Signed-off-by: Tokesh <[email protected]>
  • Loading branch information
Tokesh committed Dec 24, 2024
1 parent b02b5e9 commit 03cbf9d
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
5 changes: 4 additions & 1 deletion tools/src/prepare-for-vale/KeepDescriptions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,9 @@ export default class KeepDescriptions {
}

remove_links(line: string): string {
return line.replace(/\[([^\]]+)\]\([^)]+\)/g, '$1')
return line.replace(/\[([^\]]+)\]\([^)]+\)/g, (match, p1) => {
const spaces = ' '.repeat(match.length - p1.length-1);
return ' ' + p1 + spaces;
});
}
}
6 changes: 3 additions & 3 deletions tools/tests/prepare-for-vale/fixtures/spec.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,15 @@



For a successful response, this value is always true. On failure, an exception is returned instead Supported units.
For a successful response, this value is always true. On failure, an exception is returned instead Supported units .



The item level REST category class codes during indexing link with a title.
The item level REST category class codes during indexing link with a title .



Here is link one and link two.
Here is link one and link two .
Line two


Expand Down

0 comments on commit 03cbf9d

Please sign in to comment.