Skip to content

Commit ddf1506

Browse files
committed
chore(core): normalize source line numbers in snapshots
1 parent e36fa1f commit ddf1506

File tree

9 files changed

+190
-160
lines changed

9 files changed

+190
-160
lines changed

packages/typedoc-plugin-markdown/test/fixtures/config.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,10 @@ const config: Record<string, Fixture> = {
66
only: false,
77
entryPoints: '/reflections/index.ts',
88
commonOptions: {
9-
plugin: [path.join(__dirname, 'custom-plugins', 'navigation-plugin.mjs')],
9+
plugin: [
10+
path.join(__dirname, 'custom-plugins', 'normalize-sources.mjs'),
11+
path.join(__dirname, 'custom-plugins', 'navigation-plugin.mjs'),
12+
],
1013
hidePageHeader: true,
1114
hideBreadcrumbs: true,
1215
},
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
// @ts-check
2+
import { Converter } from 'typedoc';
3+
4+
/**
5+
* @param {import('typedoc-plugin-markdown').MarkdownApplication} app
6+
*/
7+
export function load(app) {
8+
app.converter.on(
9+
Converter.EVENT_CREATE_DECLARATION,
10+
(context, reflection) => {
11+
if (reflection.sources) {
12+
reflection.sources = reflection.sources?.map((source) => ({
13+
...source,
14+
line: '1',
15+
}));
16+
}
17+
},
18+
);
19+
app.converter.on(Converter.EVENT_CREATE_SIGNATURE, (context, reflection) => {
20+
if (reflection.sources) {
21+
reflection.sources = reflection.sources?.map((source) => ({
22+
...source,
23+
line: '1',
24+
}));
25+
}
26+
});
27+
}

packages/typedoc-plugin-markdown/test/fixtures/custom-plugins/stub-groups-theme.mjs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@ import { MarkdownTheme, MarkdownThemeContext } from 'typedoc-plugin-markdown';
55
* @param {import('typedoc-plugin-markdown').MarkdownApplication} app
66
*/
77
export function load(app) {
8-
app.renderer.defineTheme('stub-groups', StubPartialsTheme);
8+
app.renderer.defineTheme('stub-groups', StubTheme);
99
}
1010

11-
class StubPartialsTheme extends MarkdownTheme {
11+
class StubTheme extends MarkdownTheme {
1212
/**
1313
* @param {import('typedoc-plugin-markdown').MarkdownPageEvent} page
1414
*/

0 commit comments

Comments
 (0)