Skip to content

Commit

Permalink
chore(core): normalize source line numbers in snapshots
Browse files Browse the repository at this point in the history
  • Loading branch information
tgreyuk committed May 18, 2024
1 parent e36fa1f commit ddf1506
Show file tree
Hide file tree
Showing 9 changed files with 190 additions and 160 deletions.
5 changes: 4 additions & 1 deletion packages/typedoc-plugin-markdown/test/fixtures/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,10 @@ const config: Record<string, Fixture> = {
only: false,
entryPoints: '/reflections/index.ts',
commonOptions: {
plugin: [path.join(__dirname, 'custom-plugins', 'navigation-plugin.mjs')],
plugin: [
path.join(__dirname, 'custom-plugins', 'normalize-sources.mjs'),
path.join(__dirname, 'custom-plugins', 'navigation-plugin.mjs'),
],
hidePageHeader: true,
hideBreadcrumbs: true,
},
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
// @ts-check
import { Converter } from 'typedoc';

/**
* @param {import('typedoc-plugin-markdown').MarkdownApplication} app
*/
export function load(app) {
app.converter.on(
Converter.EVENT_CREATE_DECLARATION,
(context, reflection) => {
if (reflection.sources) {
reflection.sources = reflection.sources?.map((source) => ({
...source,
line: '1',
}));
}
},
);
app.converter.on(Converter.EVENT_CREATE_SIGNATURE, (context, reflection) => {
if (reflection.sources) {
reflection.sources = reflection.sources?.map((source) => ({
...source,
line: '1',
}));
}
});
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ import { MarkdownTheme, MarkdownThemeContext } from 'typedoc-plugin-markdown';
* @param {import('typedoc-plugin-markdown').MarkdownApplication} app
*/
export function load(app) {
app.renderer.defineTheme('stub-groups', StubPartialsTheme);
app.renderer.defineTheme('stub-groups', StubTheme);
}

class StubPartialsTheme extends MarkdownTheme {
class StubTheme extends MarkdownTheme {
/**
* @param {import('typedoc-plugin-markdown').MarkdownPageEvent} page
*/
Expand Down
Loading

0 comments on commit ddf1506

Please sign in to comment.