diff --git a/tools/src/prepare-for-vale/KeepDescriptions.ts b/tools/src/prepare-for-vale/KeepDescriptions.ts index b2d0d33f..002d7015 100644 --- a/tools/src/prepare-for-vale/KeepDescriptions.ts +++ b/tools/src/prepare-for-vale/KeepDescriptions.ts @@ -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; + }); } } diff --git a/tools/tests/prepare-for-vale/fixtures/spec.txt b/tools/tests/prepare-for-vale/fixtures/spec.txt index 3f29f1c0..8070b934 100644 --- a/tools/tests/prepare-for-vale/fixtures/spec.txt +++ b/tools/tests/prepare-for-vale/fixtures/spec.txt @@ -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