File tree Expand file tree Collapse file tree 1 file changed +6
-2
lines changed Expand file tree Collapse file tree 1 file changed +6
-2
lines changed Original file line number Diff line number Diff line change @@ -50,8 +50,12 @@ function transformMarkdownFiles(buffer: Buffer, file: any): string {
5050 `<div material-docs-example="${ name } "></div>`
5151 ) ;
5252
53- content = content . replace ( LINK_PATTERN , ( match : string , pre : string , link : string ) =>
54- `${ pre } href="${ fixMarkdownDocLinks ( link , file . path ) } "`
53+ /* Replaces the URL in anchor elements inside of compiled markdown files. */
54+ content = content . replace ( LINK_PATTERN , ( match : string , head : string , link : string ) =>
55+ // The head is the first match of the RegExp and is necessary to ensure that the RegExp matches
56+ // an anchor element. The head will be then used to re-create the existing anchor element.
57+ // If the head is not prepended to the replaced value, then the first match will be lost.
58+ `${ head } href="${ fixMarkdownDocLinks ( link , file . path ) } "`
5559 ) ;
5660
5761 return content ;
You can’t perform that action at this time.
0 commit comments