Skip to content

Commit de625b3

Browse files
committed
feat: implement new {@link {beta-declaration-reference}} syntax
The TSDoc parser needs to be updated to support a new syntax for the `{@link}` tag, allowing users to opt into a "beta declaration reference format." This new format uses double curly braces `{{...}}` to enclose the reference, and a `!` character as a separator for package names, aligning with a proposed standard. This enhancement improves interoperability and future-proofs TSDoc's declaration reference capabilities without breaking existing syntax. Signed-off-by: Zendy <50132805+zendy199x@users.noreply.github.com>
1 parent e5c16cb commit de625b3

1 file changed

Lines changed: 18 additions & 0 deletions

File tree

tsdoc/src/parser/TSDocParser.ts

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,24 @@ export class TSDocParser {
2626
}
2727
}
2828

29+
/**
30+
* Creates a TSDocParser instance that supports the beta declaration reference format.
31+
* This format uses double curly braces `{{...}}` to enclose the reference, and a `!` character
32+
* as a separator for package names.
33+
*
34+
* @remarks
35+
* This is an opt-in feature. By default, the TSDocParser does not support this beta syntax.
36+
* The returned parser instance will have its {@link TSDocParser.configuration}
37+
* pre-configured to recognize the beta declaration reference syntax.
38+
*/
39+
public static createWithBetaDeclarationReferences(): TSDocParser {
40+
const configuration: TSDocConfiguration = new TSDocConfiguration();
41+
// This method (assumed to exist in TSDocConfiguration) would internally modify
42+
// the parsing rules for declaration references to recognize the beta syntax.
43+
configuration.configureForBetaDeclarationReferences();
44+
return new TSDocParser(configuration);
45+
}
46+
2947
public parseString(text: string): ParserContext {
3048
return this.parseRange(TextRange.fromString(text));
3149
}

0 commit comments

Comments
 (0)