Skip to content

Commit da0f6aa

Browse files
committed
fix some doc comments
1 parent 021177f commit da0f6aa

3 files changed

Lines changed: 20 additions & 5 deletions

File tree

src/lib/path.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,10 @@ export const to_file_path = (path_or_url: string | URL): string =>
3737
typeof path_or_url === 'string' ? path_or_url : decodeURIComponent(path_or_url.pathname);
3838

3939
/**
40-
* @example parse_path_parts('./foo/bar/baz.ts') => ['foo', 'foo/bar', 'foo/bar/baz.ts']
40+
* @example
41+
* ```ts
42+
* parse_path_parts('./foo/bar/baz.ts') // => ['foo', 'foo/bar', 'foo/bar/baz.ts']
43+
* ```
4144
*/
4245
export const parse_path_parts = (path: string): Array<string> => {
4346
const segments = parse_path_segments(path);
@@ -53,7 +56,10 @@ export const parse_path_parts = (path: string): Array<string> => {
5356

5457
/**
5558
* Gets the individual parts of a path, ignoring dots and separators.
56-
* @example parse_path_segments('/foo/bar/baz.ts') => ['foo', 'bar', 'baz.ts']
59+
* @example
60+
* ```ts
61+
* parse_path_segments('/foo/bar/baz.ts') // => ['foo', 'bar', 'baz.ts']
62+
* ```
5763
*/
5864
export const parse_path_segments = (path: string): Array<string> =>
5965
path.split('/').filter((s) => s && s !== '.' && s !== '..');

src/lib/process.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -616,7 +616,10 @@ export const spawn_detached = (
616616
/**
617617
* Formats a child process for display.
618618
*
619-
* @example `pid(1234) <- node server.js`
619+
* @example
620+
* ```ts
621+
* `pid(1234) <- node server.js`
622+
* ```
620623
*/
621624
export const print_child_process = (child: ChildProcess): string =>
622625
`${st('gray', 'pid(')}${child.pid ?? 'none'}${st('gray', ')')}${st('green', child.spawnargs.join(' '))}`;

src/lib/source_json.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -174,8 +174,11 @@ export type SourceJson = z.infer<typeof SourceJson>;
174174

175175
/**
176176
* Format declaration name with generic parameters for display.
177-
* @example declaration_get_display_name({name: 'Map', kind: 'type', generic_params: [{name: 'K'}, {name: 'V'}]})
177+
* @example
178+
* ```ts
179+
* declaration_get_display_name({name: 'Map', kind: 'type', generic_params: [{name: 'K'}, {name: 'V'}]})
178180
* // => 'Map<K, V>'
181+
* ```
179182
*/
180183
export const declaration_get_display_name = (declaration: DeclarationJson): string => {
181184
if (!declaration.generic_params?.length) return declaration.name;
@@ -190,8 +193,11 @@ export const declaration_get_display_name = (declaration: DeclarationJson): stri
190193

191194
/**
192195
* Generate TypeScript import statement for a declaration.
193-
* @example declaration_generate_import({name: 'Foo', kind: 'type'}, 'foo.ts', '@pkg/lib')
196+
* @example
197+
* ```ts
198+
* declaration_generate_import({name: 'Foo', kind: 'type'}, 'foo.ts', '@pkg/lib')
194199
* // => "import type {Foo} from '@pkg/lib/foo.js';"
200+
* ```
195201
*/
196202
export const declaration_generate_import = (
197203
declaration: DeclarationJson,

0 commit comments

Comments
 (0)