Skip to content

Commit

Permalink
fix: escape pipes in comments and expand object type in props table (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
tgreyuk committed Feb 5, 2022
1 parent 7976973 commit b87c250
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
Expand Up @@ -56,15 +56,17 @@ export default function () {
row.push(nameCol.join(' '));
row.push(
Handlebars.helpers.type
.call(propertyType, 'object')
.call(propertyType)
.replace(/(?<!\\)\|/g, '\\|'),
);

if (hasComments) {
const comments = getComments(property);
if (comments) {
row.push(
stripLineBreaks(Handlebars.helpers.comments.call(comments)),
stripLineBreaks(
Handlebars.helpers.comments.call(comments),
).replace(/\|/g, '\\|'),
);
} else {
row.push('-');
Expand Down
Expand Up @@ -152,8 +152,8 @@ exports[`Declarations: should compile object literal declaration 1`] = `
| :------ | :------ |
| \`valueA\` | \`number\` |
| \`valueB\` | \`boolean\` |
| \`valueC\` | \`Object\` |
| \`valueX\` | \`Object\` |
| \`valueC\` | {} |
| \`valueX\` | { \`valueA\`: \`number\`[] ; \`valueZ\`: \`string\` = 'foo' } |
| \`valueX.valueA\` | \`number\`[] |
| \`valueX.valueZ\` | \`string\` |
| \`valueY\` | () => \`string\` |
Expand All @@ -172,7 +172,7 @@ exports[`Declarations: should compile type literal declaration 1`] = `
| :------ | :------ | :------ |
| \`valueA?\` | \`number\` | Comments for valueA |
| \`valueB?\` | \`boolean\` | - |
| \`valueX\` | \`Object\` | Comment for valueX |
| \`valueX\` | { \`valueA\`: \`number\`[] ; \`valueY\`: (\`z\`: \`string\`) => { \`a\`: \`string\` ; \`b\`: \`string\` } ; \`valueZ\`: \`string\` } | Comment for valueX |
| \`valueX.valueA\` | \`number\`[] | - |
| \`valueX.valueY\` | (\`z\`: \`string\`) => { \`a\`: \`string\` ; \`b\`: \`string\` } | - |
| \`valueX.valueZ\` | \`string\` | Nested comment for valueZ |
Expand Down

0 comments on commit b87c250

Please sign in to comment.