diff --git a/apps/api-documenter/src/markdown/MarkdownEmitter.ts b/apps/api-documenter/src/markdown/MarkdownEmitter.ts index 738329e5235..ecfbbbd423f 100644 --- a/apps/api-documenter/src/markdown/MarkdownEmitter.ts +++ b/apps/api-documenter/src/markdown/MarkdownEmitter.ts @@ -15,7 +15,8 @@ import { DocSection, DocNodeTransforms, DocEscapedText, - DocErrorText + DocErrorText, + DocBlockTag } from '@microsoft/tsdoc'; import { InternalError } from '@microsoft/node-core-library'; @@ -191,8 +192,13 @@ export class MarkdownEmitter { case DocNodeKind.InlineTag: { break; } + case DocNodeKind.BlockTag: { + const tagNode: DocBlockTag = docNode as DocBlockTag; + console.warn('Unsupported block tag: ' + tagNode.tagName); + break; + } default: - throw new Error('Unsupported element kind: ' + docNode.kind); + throw new InternalError('Unsupported DocNodeKind kind: ' + docNode.kind); } } diff --git a/apps/api-documenter/src/markdown/test/CustomMarkdownEmitter.test.ts b/apps/api-documenter/src/markdown/test/CustomMarkdownEmitter.test.ts index 01498a383cc..a0dfe7d5a1c 100644 --- a/apps/api-documenter/src/markdown/test/CustomMarkdownEmitter.test.ts +++ b/apps/api-documenter/src/markdown/test/CustomMarkdownEmitter.test.ts @@ -10,7 +10,8 @@ import { DocSoftBreak, DocLinkTag, DocHtmlStartTag, - DocHtmlEndTag + DocHtmlEndTag, + DocBlockTag } from '@microsoft/tsdoc'; import { CustomDocNodes } from '../../nodes/CustomDocNodeKind'; @@ -131,6 +132,23 @@ test('render Markdown from TSDoc', () => { ) ]); + output.appendNodes([ + new DocHeading({ configuration, title: 'Unknown block tag' }), + new DocParagraph({ configuration }, + [ + new DocBlockTag({ + configuration, + tagName: '@unknown' + }), + new DocEmphasisSpan({ configuration, bold: true }, + [ new DocPlainText({ configuration, text: 'bold' }) ] + ), + new DocPlainText({ configuration, text: 'non-bold' }), + new DocPlainText({ configuration, text: 'more-non-bold' }) + ] + ) + ]); + output.appendNodes([ new DocHeading({ configuration, title: 'Bad characters' }), new DocParagraph({ configuration }, diff --git a/apps/api-documenter/src/markdown/test/__snapshots__/CustomMarkdownEmitter.test.ts.snap b/apps/api-documenter/src/markdown/test/__snapshots__/CustomMarkdownEmitter.test.ts.snap index b555b69ce1a..ae459a5a8d7 100644 --- a/apps/api-documenter/src/markdown/test/__snapshots__/CustomMarkdownEmitter.test.ts.snap +++ b/apps/api-documenter/src/markdown/test/__snapshots__/CustomMarkdownEmitter.test.ts.snap @@ -28,6 +28,10 @@ This is a bold word. [a link](./index.md)boldnon-boldmore-non-bold +## Unknown block tag + +boldnon-boldmore-non-bold + ## Bad characters \\\\*one\\\\*two\\\\*three\\\\*four diff --git a/common/changes/@microsoft/api-documenter/print-tag-name_2019-05-25-04-18.json b/common/changes/@microsoft/api-documenter/print-tag-name_2019-05-25-04-18.json new file mode 100644 index 00000000000..92dc87f65d9 --- /dev/null +++ b/common/changes/@microsoft/api-documenter/print-tag-name_2019-05-25-04-18.json @@ -0,0 +1,11 @@ +{ + "changes": [ + { + "packageName": "@microsoft/api-documenter", + "comment": "Avoid reporting a fatal error when an unknown block tag is encountered", + "type": "patch" + } + ], + "packageName": "@microsoft/api-documenter", + "email": "raymondfeng@users.noreply.github.com" +} \ No newline at end of file diff --git a/common/config/rush/nonbrowser-approved-packages.json b/common/config/rush/nonbrowser-approved-packages.json index d3a64eb1f42..9c964cca8f8 100644 --- a/common/config/rush/nonbrowser-approved-packages.json +++ b/common/config/rush/nonbrowser-approved-packages.json @@ -190,6 +190,10 @@ "name": "clean-css", "allowedCategories": [ "libraries" ] }, + { + "name": "cli-table", + "allowedCategories": [ "libraries" ] + }, { "name": "colors", "allowedCategories": [ "libraries", "tests" ]