Skip to content

Commit 2249300

Browse files
author
Rudolf Meijering
committed
[api-documenter] mardown: fixes newline in table code blocks
1 parent 9840498 commit 2249300

File tree

8 files changed

+99
-1
lines changed

8 files changed

+99
-1
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ export class MarkdownEmitter {
115115
if (context.insideTable) {
116116
const code: string = this.getTableEscapedText(docCodeSpan.code);
117117
const parts: string[] = code.split(/\r?\n/g);
118-
writer.write(parts.join('`<p/>`'));
118+
writer.write(parts.join('</code><br/><code>'));
119119
} else {
120120
writer.write(docCodeSpan.code);
121121
}

build-tests/api-documenter-test/etc/api-documenter-test.api.json

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -990,6 +990,51 @@
990990
"releaseTag": "Public",
991991
"name": "IDocInterface4",
992992
"members": [
993+
{
994+
"kind": "PropertySignature",
995+
"canonicalReference": "Context",
996+
"docComment": "/**\n * Test newline rendering when code blocks are used in tables\n */\n",
997+
"excerptTokens": [
998+
{
999+
"kind": "Reference",
1000+
"text": "Context"
1001+
},
1002+
{
1003+
"kind": "Content",
1004+
"text": ": "
1005+
},
1006+
{
1007+
"kind": "Content",
1008+
"text": "({ "
1009+
},
1010+
{
1011+
"kind": "Reference",
1012+
"text": "children"
1013+
},
1014+
{
1015+
"kind": "Content",
1016+
"text": " }: {\n "
1017+
},
1018+
{
1019+
"kind": "Reference",
1020+
"text": "children"
1021+
},
1022+
{
1023+
"kind": "Content",
1024+
"text": ": string;\n }) => boolean"
1025+
},
1026+
{
1027+
"kind": "Content",
1028+
"text": ";"
1029+
}
1030+
],
1031+
"releaseTag": "Public",
1032+
"name": "Context",
1033+
"propertyTypeTokenRange": {
1034+
"startIndex": 2,
1035+
"endIndex": 7
1036+
}
1037+
},
9931038
{
9941039
"kind": "PropertySignature",
9951040
"canonicalReference": "generic",

build-tests/api-documenter-test/etc/api-documenter-test.api.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,9 @@ export interface IDocInterface3 {
6666

6767
// @public
6868
export interface IDocInterface4 {
69+
Context: ({ children }: {
70+
children: string;
71+
}) => boolean;
6972
generic: Generic<number>;
7073
numberOrFunction: number | (() => number);
7174
stringOrNumber: string | number;
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
2+
3+
[Home](./index) &gt; [api-documenter-test](./api-documenter-test.md) &gt; [IDocInterface4](./api-documenter-test.idocinterface4.md) &gt; [Context](./api-documenter-test.idocinterface4.context.md)
4+
5+
## IDocInterface4.Context property
6+
7+
Test newline rendering when code blocks are used in tables
8+
9+
<b>Signature:</b>
10+
11+
```typescript
12+
Context: ({ children }: {
13+
children: string;
14+
}) => boolean;
15+
```

build-tests/api-documenter-test/etc/markdown/api-documenter-test.idocinterface4.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ export interface IDocInterface4
1616

1717
| Property | Type | Description |
1818
| --- | --- | --- |
19+
| [Context](./api-documenter-test.idocinterface4.context.md) | <code>({ children }: {</code><br/><code> children: string;</code><br/><code> }) =&gt; boolean</code> | Test newline rendering when code blocks are used in tables |
1920
| [generic](./api-documenter-test.idocinterface4.generic.md) | <code>Generic&lt;number&gt;</code> | make sure html entities are escaped in tables. |
2021
| [numberOrFunction](./api-documenter-test.idocinterface4.numberorfunction.md) | <code>number &#124; (() =&gt; number)</code> | a union type with a function |
2122
| [stringOrNumber](./api-documenter-test.idocinterface4.stringornumber.md) | <code>string &#124; number</code> | a union type |

build-tests/api-documenter-test/etc/yaml/api-documenter-test/idocinterface4.yml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,28 @@ items:
99
type: interface
1010
package: api-documenter-test
1111
children:
12+
- api-documenter-test.IDocInterface4.Context
1213
- api-documenter-test.IDocInterface4.generic
1314
- api-documenter-test.IDocInterface4.numberOrFunction
1415
- api-documenter-test.IDocInterface4.stringOrNumber
16+
- uid: api-documenter-test.IDocInterface4.Context
17+
summary: Test newline rendering when code blocks are used in tables
18+
name: Context
19+
fullName: Context
20+
langs:
21+
- typeScript
22+
type: property
23+
syntax:
24+
content: |-
25+
Context: ({ children }: {
26+
children: string;
27+
}) => boolean;
28+
return:
29+
type:
30+
- |-
31+
({ children }: {
32+
children: string;
33+
}) => boolean
1534
- uid: api-documenter-test.IDocInterface4.generic
1635
summary: make sure html entities are escaped in tables.
1736
name: generic

build-tests/api-documenter-test/src/DocClass1.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,10 @@ export interface IDocInterface4 {
8686
* make sure html entities are escaped in tables.
8787
*/
8888
generic: Generic<number>;
89+
/**
90+
* Test newline rendering when code blocks are used in tables
91+
*/
92+
Context: ({ children }: { children: string }) => boolean;
8993
}
9094

9195
/**
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"changes": [
3+
{
4+
"packageName": "@microsoft/api-documenter",
5+
"comment": "Fixes newline rendering when code blocks are used in tables",
6+
"type": "patch"
7+
}
8+
],
9+
"packageName": "@microsoft/api-documenter",
10+
"email": "skaapgif@users.noreply.github.com"
11+
}

0 commit comments

Comments
 (0)