Skip to content

Commit b87c250

Browse files
committed
fix: escape pipes in comments and expand object type in props table (#286)
1 parent 7976973 commit b87c250

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

packages/typedoc-plugin-markdown/src/resources/helpers/property-table.ts

+4-2
Original file line numberDiff line numberDiff line change
@@ -56,15 +56,17 @@ export default function () {
5656
row.push(nameCol.join(' '));
5757
row.push(
5858
Handlebars.helpers.type
59-
.call(propertyType, 'object')
59+
.call(propertyType)
6060
.replace(/(?<!\\)\|/g, '\\|'),
6161
);
6262

6363
if (hasComments) {
6464
const comments = getComments(property);
6565
if (comments) {
6666
row.push(
67-
stripLineBreaks(Handlebars.helpers.comments.call(comments)),
67+
stripLineBreaks(
68+
Handlebars.helpers.comments.call(comments),
69+
).replace(/\|/g, '\\|'),
6870
);
6971
} else {
7072
row.push('-');

packages/typedoc-plugin-markdown/test/specs/__snapshots__/declarations.spec.ts.snap

+3-3
Original file line numberDiff line numberDiff line change
@@ -152,8 +152,8 @@ exports[`Declarations: should compile object literal declaration 1`] = `
152152
| :------ | :------ |
153153
| \`valueA\` | \`number\` |
154154
| \`valueB\` | \`boolean\` |
155-
| \`valueC\` | \`Object\` |
156-
| \`valueX\` | \`Object\` |
155+
| \`valueC\` | {} |
156+
| \`valueX\` | { \`valueA\`: \`number\`[] ; \`valueZ\`: \`string\` = 'foo' } |
157157
| \`valueX.valueA\` | \`number\`[] |
158158
| \`valueX.valueZ\` | \`string\` |
159159
| \`valueY\` | () => \`string\` |
@@ -172,7 +172,7 @@ exports[`Declarations: should compile type literal declaration 1`] = `
172172
| :------ | :------ | :------ |
173173
| \`valueA?\` | \`number\` | Comments for valueA |
174174
| \`valueB?\` | \`boolean\` | - |
175-
| \`valueX\` | \`Object\` | Comment for valueX |
175+
| \`valueX\` | { \`valueA\`: \`number\`[] ; \`valueY\`: (\`z\`: \`string\`) => { \`a\`: \`string\` ; \`b\`: \`string\` } ; \`valueZ\`: \`string\` } | Comment for valueX |
176176
| \`valueX.valueA\` | \`number\`[] | - |
177177
| \`valueX.valueY\` | (\`z\`: \`string\`) => { \`a\`: \`string\` ; \`b\`: \`string\` } | - |
178178
| \`valueX.valueZ\` | \`string\` | Nested comment for valueZ |

0 commit comments

Comments
 (0)