Skip to content

Commit f4f068b

Browse files
committed
chore(core): test template literal string default values
1 parent a9f83e4 commit f4f068b

File tree

7 files changed

+27
-10
lines changed

7 files changed

+27
-10
lines changed

devtools/packages/fixtures/typedoc.cjs

+3
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,7 @@ module.exports = {
1212
URL: 'https://developer.mozilla.org/en-US/docs/Web/API/URL',
1313
},
1414
},
15+
navigation: {
16+
includeGroups: true,
17+
},
1518
};

packages/typedoc-plugin-markdown/src/libs/markdown/back-ticks.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { escapeChars } from '../utils';
22

33
/**
44
* Wraps a string in backticks.
5-
* If the input string iself contains a backtick, pipe, or backslash (which can result in unwanted side effects) the string is escaoed unstead.
5+
* If the input string itself contains a backtick, pipe, or backslash (which can result in unwanted side effects) the string is escaped instead.
66
*/
77
export function backTicks(text: string) {
88
return /(`|\||\\)/g.test(text) ? escapeChars(text) : `\`${text}\``;

packages/typedoc-plugin-markdown/src/theme/resources/partials/type.some.ts

+1-3
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,5 @@ export function someType(this: MarkdownThemeContext, model?: SomeType): string {
8888
return backTicks('null');
8989
}
9090

91-
return /\\/.test(model?.toString())
92-
? model?.toString()
93-
: backTicks(model?.toString());
91+
return backTicks(model?.toString());
9492
}

packages/typedoc-plugin-markdown/test/fixtures/src/reflections/variables.ts

+9
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,15 @@
77
*/
88
export const stringVariable = 'stringConstWithDefaultValue';
99

10+
/**
11+
* A template variable string
12+
*/
13+
export const templateVariableString = `
14+
This is a template string
15+
/* with a comment */
16+
And a <tag></tag>
17+
`;
18+
1019
/**
1120
* Comments for typeOperatorVariable
1221
*/

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

+5
Original file line numberDiff line numberDiff line change
@@ -2999,6 +2999,11 @@ exports[`Navigation should gets Navigation Json for single entry point: (Output
29992999
"kind": 32,
30003000
"path": "variables/stringVariable.md"
30013001
},
3002+
{
3003+
"title": "templateVariableString",
3004+
"kind": 32,
3005+
"path": "variables/templateVariableString.md"
3006+
},
30023007
{
30033008
"title": "typeOperatorVariable",
30043009
"kind": 32,

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

+6-6
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ Comments for symbol
1717
1818
## Source
1919
20-
[variables.ts:38](http://source-url)
20+
[variables.ts:47](http://source-url)
2121
"
2222
`;
2323

@@ -38,7 +38,7 @@ Comments variable with symbol
3838
3939
## Source
4040
41-
[variables.ts:38](http://source-url)
41+
[variables.ts:47](http://source-url)
4242
"
4343
`;
4444

@@ -51,7 +51,7 @@ Comments for typeOperatorVariable
5151
5252
## Source
5353
54-
[variables.ts:13](http://source-url)
54+
[variables.ts:22](http://source-url)
5555
"
5656
`;
5757

@@ -66,7 +66,7 @@ Comments for typeOperatorVariable
6666
6767
## Source
6868
69-
[variables.ts:13](http://source-url)
69+
[variables.ts:22](http://source-url)
7070
"
7171
`;
7272

@@ -175,7 +175,7 @@ Comments for objectLiteralVariable
175175
176176
## Source
177177
178-
[variables.ts:18](http://source-url)
178+
[variables.ts:27](http://source-url)
179179
"
180180
`;
181181

@@ -202,6 +202,6 @@ Comments for objectLiteralVariable
202202
203203
## Source
204204
205-
[variables.ts:18](http://source-url)
205+
[variables.ts:27](http://source-url)
206206
"
207207
`;

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

+2
Original file line numberDiff line numberDiff line change
@@ -569,6 +569,7 @@ exports[`Urls should gets Urls for single entry points: outputFileStrategy: memb
569569
"variables/objectWithSymbol.md",
570570
"variables/someQuery.md",
571571
"variables/stringVariable.md",
572+
"variables/templateVariableString.md",
572573
"variables/typeOperatorVariable.md",
573574
]
574575
`;
@@ -643,6 +644,7 @@ exports[`Urls should gets Urls for single entry points: outputFileStrategy: memb
643644
"variables/objectWithSymbol.md",
644645
"variables/someQuery.md",
645646
"variables/stringVariable.md",
647+
"variables/templateVariableString.md",
646648
"variables/typeOperatorVariable.md",
647649
]
648650
`;

0 commit comments

Comments
 (0)