Skip to content

Commit

Permalink
fix(docs): only rewrite relative links
Browse files Browse the repository at this point in the history
* Right now the script actually seemed to work on Windows because the delimiters were different and the `indexOf` check passed therefore.
* It didn't work on non-windows platforms (but the `indexOf` worked), because the logic was incorrect. Previously only links that are not inside of `guides/` have been rewritten.

Fixes angular#3147
  • Loading branch information
devversion committed Feb 28, 2017
1 parent d1abc9e commit 43e8748
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion tools/gulp/tasks/docs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,9 @@ function transformMarkdownFiles(buffer: Buffer, file: any): string {

/** Fixes paths in the markdown files to work in the material-docs-io. */
function fixMarkdownDocLinks(link: string, filePath: string): string {
if (link.startsWith('http') && filePath.indexOf('guides/') === -1) {
// As for now, only markdown links that are relative and inside of the guides/ directory
// will be rewritten.
if (!filePath.includes(path.normalize('guides/')) || link.startsWith('http')) {
return link;
}

Expand Down

0 comments on commit 43e8748

Please sign in to comment.