diff --git a/apps/api-documenter/src/markdown/MarkdownEmitter.ts b/apps/api-documenter/src/markdown/MarkdownEmitter.ts index 15d96708d23..738329e5235 100644 --- a/apps/api-documenter/src/markdown/MarkdownEmitter.ts +++ b/apps/api-documenter/src/markdown/MarkdownEmitter.ts @@ -115,7 +115,7 @@ export class MarkdownEmitter { if (context.insideTable) { const code: string = this.getTableEscapedText(docCodeSpan.code); const parts: string[] = code.split(/\r?\n/g); - writer.write(parts.join('`

`')); + writer.write(parts.join('
')); } else { writer.write(docCodeSpan.code); } diff --git a/build-tests/api-documenter-test/etc/api-documenter-test.api.json b/build-tests/api-documenter-test/etc/api-documenter-test.api.json index 2c45b983a3e..fa250f4f7f2 100644 --- a/build-tests/api-documenter-test/etc/api-documenter-test.api.json +++ b/build-tests/api-documenter-test/etc/api-documenter-test.api.json @@ -990,6 +990,51 @@ "releaseTag": "Public", "name": "IDocInterface4", "members": [ + { + "kind": "PropertySignature", + "canonicalReference": "Context", + "docComment": "/**\n * Test newline rendering when code blocks are used in tables\n */\n", + "excerptTokens": [ + { + "kind": "Reference", + "text": "Context" + }, + { + "kind": "Content", + "text": ": " + }, + { + "kind": "Content", + "text": "({ " + }, + { + "kind": "Reference", + "text": "children" + }, + { + "kind": "Content", + "text": " }: {\n " + }, + { + "kind": "Reference", + "text": "children" + }, + { + "kind": "Content", + "text": ": string;\n }) => boolean" + }, + { + "kind": "Content", + "text": ";" + } + ], + "releaseTag": "Public", + "name": "Context", + "propertyTypeTokenRange": { + "startIndex": 2, + "endIndex": 7 + } + }, { "kind": "PropertySignature", "canonicalReference": "generic", diff --git a/build-tests/api-documenter-test/etc/api-documenter-test.api.md b/build-tests/api-documenter-test/etc/api-documenter-test.api.md index 4a81af15e7f..92eba78b06f 100644 --- a/build-tests/api-documenter-test/etc/api-documenter-test.api.md +++ b/build-tests/api-documenter-test/etc/api-documenter-test.api.md @@ -66,6 +66,9 @@ export interface IDocInterface3 { // @public export interface IDocInterface4 { + Context: ({ children }: { + children: string; + }) => boolean; generic: Generic; numberOrFunction: number | (() => number); stringOrNumber: string | number; diff --git a/build-tests/api-documenter-test/etc/markdown/api-documenter-test.idocinterface4.context.md b/build-tests/api-documenter-test/etc/markdown/api-documenter-test.idocinterface4.context.md new file mode 100644 index 00000000000..058a34514f6 --- /dev/null +++ b/build-tests/api-documenter-test/etc/markdown/api-documenter-test.idocinterface4.context.md @@ -0,0 +1,15 @@ + + +[Home](./index) > [api-documenter-test](./api-documenter-test.md) > [IDocInterface4](./api-documenter-test.idocinterface4.md) > [Context](./api-documenter-test.idocinterface4.context.md) + +## IDocInterface4.Context property + +Test newline rendering when code blocks are used in tables + +Signature: + +```typescript +Context: ({ children }: { + children: string; + }) => boolean; +``` diff --git a/build-tests/api-documenter-test/etc/markdown/api-documenter-test.idocinterface4.md b/build-tests/api-documenter-test/etc/markdown/api-documenter-test.idocinterface4.md index dac89b0778b..287b490ee74 100644 --- a/build-tests/api-documenter-test/etc/markdown/api-documenter-test.idocinterface4.md +++ b/build-tests/api-documenter-test/etc/markdown/api-documenter-test.idocinterface4.md @@ -16,6 +16,7 @@ export interface IDocInterface4 | Property | Type | Description | | --- | --- | --- | +| [Context](./api-documenter-test.idocinterface4.context.md) | ({ children }: {
children: string;
}) => boolean | Test newline rendering when code blocks are used in tables | | [generic](./api-documenter-test.idocinterface4.generic.md) | Generic<number> | make sure html entities are escaped in tables. | | [numberOrFunction](./api-documenter-test.idocinterface4.numberorfunction.md) | number | (() => number) | a union type with a function | | [stringOrNumber](./api-documenter-test.idocinterface4.stringornumber.md) | string | number | a union type | diff --git a/build-tests/api-documenter-test/etc/yaml/api-documenter-test/idocinterface4.yml b/build-tests/api-documenter-test/etc/yaml/api-documenter-test/idocinterface4.yml index 9a671a17e11..51376ad10e2 100644 --- a/build-tests/api-documenter-test/etc/yaml/api-documenter-test/idocinterface4.yml +++ b/build-tests/api-documenter-test/etc/yaml/api-documenter-test/idocinterface4.yml @@ -9,9 +9,28 @@ items: type: interface package: api-documenter-test children: + - api-documenter-test.IDocInterface4.Context - api-documenter-test.IDocInterface4.generic - api-documenter-test.IDocInterface4.numberOrFunction - api-documenter-test.IDocInterface4.stringOrNumber + - uid: api-documenter-test.IDocInterface4.Context + summary: Test newline rendering when code blocks are used in tables + name: Context + fullName: Context + langs: + - typeScript + type: property + syntax: + content: |- + Context: ({ children }: { + children: string; + }) => boolean; + return: + type: + - |- + ({ children }: { + children: string; + }) => boolean - uid: api-documenter-test.IDocInterface4.generic summary: make sure html entities are escaped in tables. name: generic diff --git a/build-tests/api-documenter-test/src/DocClass1.ts b/build-tests/api-documenter-test/src/DocClass1.ts index 04203af2575..3e8e00858ec 100644 --- a/build-tests/api-documenter-test/src/DocClass1.ts +++ b/build-tests/api-documenter-test/src/DocClass1.ts @@ -86,6 +86,10 @@ export interface IDocInterface4 { * make sure html entities are escaped in tables. */ generic: Generic; + /** + * Test newline rendering when code blocks are used in tables + */ + Context: ({ children }: { children: string }) => boolean; } /** diff --git a/common/changes/@microsoft/api-documenter/fix-newline-in-table-code-block_2019-04-15-10-59.json b/common/changes/@microsoft/api-documenter/fix-newline-in-table-code-block_2019-04-15-10-59.json new file mode 100644 index 00000000000..809bf06dd6c --- /dev/null +++ b/common/changes/@microsoft/api-documenter/fix-newline-in-table-code-block_2019-04-15-10-59.json @@ -0,0 +1,11 @@ +{ + "changes": [ + { + "packageName": "@microsoft/api-documenter", + "comment": "Fix newline rendering when code blocks are used in tables", + "type": "patch" + } + ], + "packageName": "@microsoft/api-documenter", + "email": "skaapgif@users.noreply.github.com" +} \ No newline at end of file