Skip to content

Commit d415e22

Browse files
api-documenter: permissive api reference check for MarkdownDocumenter
1 parent b09f550 commit d415e22

File tree

1 file changed

+10
-7
lines changed

1 file changed

+10
-7
lines changed

apps/api-documenter/src/markdown/MarkdownDocumenter.ts

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.
22
// See LICENSE in the project root for license information.
33

4+
import * as colors from 'colors';
45
import * as path from 'path';
56

67
import {
@@ -606,14 +607,16 @@ export class MarkdownDocumenter {
606607
onRenderApiLink: (args: IMarkdownRenderApiLinkArgs) => {
607608
const resolveResult: IDocItemSetResolveResult = this._docItemSet.resolveApiItemReference(args.reference);
608609
if (!resolveResult.docItem) {
609-
throw new Error('Unresolved: ' + JSON.stringify(args.reference));
610+
// Eventually we should introduce a warnings file
611+
console.error(colors.yellow('Warning: Unresolved hyperlink to '
612+
+ Markup.formatApiItemReference(args.reference)));
613+
} else {
614+
// NOTE: GitHub's markdown renderer does not resolve relative hyperlinks correctly
615+
// unless they start with "./" or "../".
616+
const docFilename: string = './' + this._getFilenameForDocItem(resolveResult.docItem);
617+
args.prefix = '[';
618+
args.suffix = '](' + docFilename + ')';
610619
}
611-
612-
// NOTE: GitHub's markdown renderer does not resolve relative hyperlinks correctly
613-
// unless they start with "./" or "../".
614-
const docFilename: string = './' + this._getFilenameForDocItem(resolveResult.docItem);
615-
args.prefix = '[';
616-
args.suffix = '](' + docFilename + ')';
617620
}
618621
});
619622

0 commit comments

Comments
 (0)