diff --git a/docs-main/reference/typescript.mdx b/docs-main/reference/typescript.mdx index 8256f51bd..9baad2aaf 100644 --- a/docs-main/reference/typescript.mdx +++ b/docs-main/reference/typescript.mdx @@ -93,7 +93,7 @@ Interface for objects representing Daml choices. | Member | Type | Description | | --- | --- | --- | | `choiceName` | `string` | The choice name. | -| `template` | `() => TemplateOrInterface` | Returns the template to which this choice belongs. | +| `template` | `() => TemplateOrInterface` | Returns the template to which this choice belongs. | @@ -121,7 +121,7 @@ The origin companion that contained a [[Choice]]. | Member | Type | Description | | --- | --- | --- | -| `template` | `() => O` | Returns the template to which this choice belongs. | +| `template` | `() => O` | Returns the template to which this choice belongs. | @@ -226,15 +226,15 @@ iteration is unspecified; the only guarantee is that the order in ``keys`` and | Member | Type | Description | | --- | --- | --- | -| `delete` | `(k: K) => Map<K, V>` | - | -| `entries` | `() => Iterator<[K, V], undefined, undefined>` | - | -| `entriesArray` | `() => [K, V][]` | - | -| `forEach` | `(f: (value: V, key: K, map: Map<K, V>) => T, u?: U) => void` | - | -| `get` | `(k: K) => undefined \| V` | - | -| `has` | `(k: K) => boolean` | - | -| `keys` | `() => Iterator<K, undefined, undefined>` | - | -| `set` | `(k: K, v: V) => Map<K, V>` | - | -| `values` | `() => Iterator<V, undefined, undefined>` | - | +| `delete` | `(k: K) => Map` | - | +| `entries` | `() => Iterator<[K, V], undefined, undefined>` | - | +| `entriesArray` | `() => [K, V][]` | - | +| `forEach` | `(f: (value: V, key: K, map: Map) => T, u?: U) => void` | - | +| `get` | `(k: K) => undefined \| V` | - | +| `has` | `(k: K) => boolean` | - | +| `keys` | `() => Iterator` | - | +| `set` | `(k: K, v: V) => Map` | - | +| `values` | `() => Iterator` | - | @@ -295,7 +295,7 @@ Interface for objects representing Daml templates. It is similar to the | Member | Type | Description | | --- | --- | --- | -| `Archive` | `Choice<T, {}, {}, K> & ChoiceFrom<Template<T, K, I>>` | - | +| `Archive` | `Choice & ChoiceFrom>` | - | | `templateId` | `I` | - | | `templateIdWithPackageId` | `string` | - | @@ -844,7 +844,7 @@ ContractId(_t: Serializable | TemplateOrInterface \| TemplateOrInterface` | yes | - | Returns: `Serializable>` @@ -903,7 +903,7 @@ List(t: Serializable): Serializable | Parameter | Type | Required | Description | | --- | --- | --- | --- | -| `t` | `Serializable<T>` | yes | - | +| `t` | `Serializable` | yes | - | Returns: `Serializable` @@ -936,8 +936,8 @@ Map(kd: Serializable, vd: Seria | Parameter | Type | Required | Description | | --- | --- | --- | --- | -| `kd` | `Serializable<K>` | yes | - | -| `vd` | `Serializable<V>` | yes | - | +| `kd` | `Serializable` | yes | - | +| `vd` | `Serializable` | yes | - | Returns: `Serializable>` @@ -997,7 +997,7 @@ Optional(t: Serializable): Serializable> | Parameter | Type | Required | Description | | --- | --- | --- | --- | -| `t` | `Serializable<T>` | yes | - | +| `t` | `Serializable` | yes | - | Returns: `Serializable>` @@ -1029,6 +1029,6 @@ TextMap(t: Serializable): Serializable> | Parameter | Type | Required | Description | | --- | --- | --- | --- | -| `t` | `Serializable<T>` | yes | - | +| `t` | `Serializable` | yes | - | Returns: `Serializable>` diff --git a/docs-main/reference/typescript/dapp-sdk.mdx b/docs-main/reference/typescript/dapp-sdk.mdx index d991248f7..a5b2912df 100644 --- a/docs-main/reference/typescript/dapp-sdk.mdx +++ b/docs-main/reference/typescript/dapp-sdk.mdx @@ -1,5 +1,5 @@ --- -title: "@canton-network/dapp-sdk" +title: "dApp SDK" description: "TypeScript client library reference for dApp integrations." --- @@ -134,31 +134,31 @@ Generated from published `@canton-network/dapp-sdk` TypeDoc snapshots. | `TxChangedSignedPayload` | `void` | Payload for the TxChangedSignedEvent. | | `Wallet` | `void` | Structure representing a wallet | | `AccessToken` | `string` | JWT authentication token. | -| `AccountsChanged` | `() => Promise<AccountsChangedEvent>` | - | +| `AccountsChanged` | `() => Promise` | - | | `AccountsChangedEvent` | `Wallet[]` | Event emitted when the user's accounts change. | | `ActAs` | `Party[]` | Set of parties on whose behalf the command should be executed, if submitted. If not set, the primary wallet's party is used. | | `CommandId` | `string` | The unique identifier of the command associated with the transaction. | | `CompletionOffset` | `number` | - | -| `Connect` | `() => Promise<ConnectResult>` | - | +| `Connect` | `() => Promise` | - | | `ContractId` | `string` | The unique identifier of the disclosed contract. | | `CreatedEventBlob` | `string` | The blob data of the created event for the disclosed contract. | | `Disabled` | `boolean` | Whether the wallet is disabled. Wallets are disabled when no signing provider matches the party's namespace during sync. Disabled wallets use participant as the default signing provider. | | `DisclosedContracts` | `DisclosedContract[]` | List of contract IDs to be disclosed with the command. | -| `Disconnect` | `() => Promise<Null>` | - | +| `Disconnect` | `() => Promise` | - | | `ExternalTxId` | `string` | Unique identifier of the signed transaction given by the Signing Provider. This may not be the same as the internal txId given by the Wallet Gateway. | -| `GetActiveNetwork` | `() => Promise<Network>` | - | -| `GetPrimaryAccount` | `() => Promise<Wallet>` | - | +| `GetActiveNetwork` | `() => Promise` | - | +| `GetPrimaryAccount` | `() => Promise` | - | | `Hint` | `string` | The party hint and name of the wallet. | -| `IsConnected` | `() => Promise<ConnectResult>` | - | +| `IsConnected` | `() => Promise` | - | | `IsConnectedValue` | `boolean` | Whether or not the user is authenticated with the Wallet. | | `IsNetworkConnected` | `boolean` | Whether or not a connection to a network is established. | -| `LedgerApi` | `(params: LedgerApiParams) => Promise<LedgerApiResult>` | - | +| `LedgerApi` | `(params: LedgerApiParams) => Promise` | - | | `LedgerApiUrl` | `string` | The base URL of the ledger API. | -| `ListAccounts` | `() => Promise<ListAccountsResult>` | - | +| `ListAccounts` | `() => Promise` | - | | `ListAccountsResult` | `Wallet[]` | An array of accounts that the user has authorized the dapp to access.. | | `Message` | `string` | The message to sign. | | `MessageId` | `string` | The unique identifier of the message associated with the message to be signed. | -| `MessageSignature` | `() => Promise<MessageSignatureEvent>` | - | +| `MessageSignature` | `() => Promise` | - | | `MessageSignatureEvent` | `MessageSignaturePendingEvent \| MessageSignatureSignedEvent \| MessageSignatureFailedEvent` | Event emitted when a message signature is requested or completed. | | `Namespace` | `string` | The namespace of the party. | | `NetworkId` | `string` | The network ID the wallet corresponds to. | @@ -168,8 +168,8 @@ Generated from published `@canton-network/dapp-sdk` TypeDoc snapshots. | `PackageIdSelectionPreference` | `PackageId[]` | The package-id selection preference of the client for resolving package names and interface instances in command submission and interpretation | | `Party` | `string` | The party that signed the transaction. | | `PartyId` | `string` | The party ID corresponding to the wallet. | -| `PrepareExecute` | `(params: PrepareExecuteParams) => Promise<Null>` | - | -| `PrepareExecuteAndWait` | `(params: PrepareExecuteParams) => Promise<PrepareExecuteAndWaitResult>` | - | +| `PrepareExecute` | `(params: PrepareExecuteParams) => Promise` | - | +| `PrepareExecuteAndWait` | `(params: PrepareExecuteParams) => Promise` | - | | `Primary` | `boolean` | Set as primary wallet for dApp usage. | | `ProviderId` | `string` | The unique identifier of the Provider. | | `ProviderType` | `"browser" \| "desktop" \| "mobile" \| "remote"` | The type of client that implements the Provider. | @@ -178,12 +178,12 @@ Generated from published `@canton-network/dapp-sdk` TypeDoc snapshots. | `Reason` | `string` | Reason for the wallet state, e.g., 'no signing provider matched'. | | `RequestMethod` | `"get" \| "post" \| "patch" \| "put" \| "delete"` | - | | `Resource` | `string` | - | -| `RpcTypes` | `{ accountsChanged: { params: Params<AccountsChanged>; result: Result<AccountsChanged> }; connect: { params: Params<Connect>; result: Result<Connect> }; disconnect: { params: Params<Disconnect>; result: Result<Disconnect> }; getActiveNetwork: { params: Params<GetActiveNetwork>; result: Result<GetActiveNetwork> }; getPrimaryAccount: { params: Params<GetPrimaryAccount>; result: Result<GetPrimaryAccount> }; isConnected: { params: Params<IsConnected>; result: Result<IsConnected> }; ledgerApi: { params: Params<LedgerApi>; result: Result<LedgerApi> }; listAccounts: { params: Params<ListAccounts>; result: Result<ListAccounts> }; messageSignature: { params: Params<MessageSignature>; result: Result<MessageSignature> }; prepareExecute: { params: Params<PrepareExecute>; result: Result<PrepareExecute> }; prepareExecuteAndWait: { params: Params<PrepareExecuteAndWait>; result: Result<PrepareExecuteAndWait> }; signMessage: { params: Params<SignMessage>; result: Result<SignMessage> }; status: { params: Params<Status>; result: Result<Status> }; txChanged: { params: Params<TxChanged>; result: Result<TxChanged> } }` | - | +| `RpcTypes` | `{ accountsChanged: { params: Params; result: Result }; connect: { params: Params; result: Result }; disconnect: { params: Params; result: Result }; getActiveNetwork: { params: Params; result: Result }; getPrimaryAccount: { params: Params; result: Result }; isConnected: { params: Params; result: Result }; ledgerApi: { params: Params; result: Result }; listAccounts: { params: Params; result: Result }; messageSignature: { params: Params; result: Result }; prepareExecute: { params: Params; result: Result }; prepareExecuteAndWait: { params: Params; result: Result }; signMessage: { params: Params; result: Result }; status: { params: Params; result: Result }; txChanged: { params: Params; result: Result } }` | - | | `Signature` | `string` | The signature of the message. | | `SignedBy` | `string` | The identifier of the provider that signed the transaction. | | `SigningProviderId` | `string` | The signing provider ID the wallet corresponds to. | -| `SignMessage` | `(params: SignMessageParams) => Promise<SignMessageResult>` | - | -| `Status` | `() => Promise<StatusEvent>` | Generated! Represents an alias to any of the provided schemas | +| `SignMessage` | `(params: SignMessageParams) => Promise` | - | +| `Status` | `() => Promise` | Generated! Represents an alias to any of the provided schemas | | `StatusExecuted` | `"executed"` | The status of the transaction. | | `StatusFailed` | `"failed"` | The status of the message signature. | | `StatusPending` | `"pending"` | The status of the message signature. | @@ -191,7 +191,7 @@ Generated from published `@canton-network/dapp-sdk` TypeDoc snapshots. | `SynchronizerId` | `string` | If not set, a suitable synchronizer that this node is connected to will be chosen. | | `TemplateId` | `string` | The template identifier of the disclosed contract. | | `TopologyTransactions` | `string` | The topology transactions | -| `TxChanged` | `() => Promise<TxChangedEvent>` | - | +| `TxChanged` | `() => Promise` | - | | `TxChangedEvent` | `TxChangedPendingEvent \| TxChangedSignedEvent \| TxChangedExecutedEvent \| TxChangedFailedEvent` | Event emitted when a transaction changes. | | `UpdateId` | `string` | The update ID corresponding to the transaction. | | `Url` | `string` | The URL of the Wallet Provider. | @@ -650,7 +650,7 @@ interface ActiveSession | Member | Type | Description | | --- | --- | --- | | `adapter` | `ProviderAdapter` | - | -| `provider` | `Provider<RpcTypes>` | - | +| `provider` | `Provider` | - | | `providerId` | `string` | - | @@ -837,7 +837,7 @@ interface WalletConnectAdapterConfig | --- | --- | --- | | `chainId` | `string` | - | | `metadata` | `{ description: string; icons: string[]; name: string; url: string }` | - | -| `onUri` | `(uri: string) => void` | Called with the pairing URI so the dApp can display or forward it. | +| `onUri` | `(uri: string) => void` | Called with the pairing URI so the dApp can display or forward it. | | `projectId` | `string` | - | @@ -1283,7 +1283,7 @@ onAccountsChanged(listener: EventListener): Promise | Parameter | Type | Required | Description | | --- | --- | --- | --- | -| `listener` | `EventListener<AccountsChangedEvent>` | yes | - | +| `listener` | `EventListener` | yes | - | Returns: `Promise` @@ -1309,7 +1309,7 @@ onConnected(listener: EventListener): Promise | Parameter | Type | Required | Description | | --- | --- | --- | --- | -| `listener` | `EventListener<StatusEvent>` | yes | - | +| `listener` | `EventListener` | yes | - | Returns: `Promise` @@ -1335,7 +1335,7 @@ onStatusChanged(listener: EventListener): Promise | Parameter | Type | Required | Description | | --- | --- | --- | --- | -| `listener` | `EventListener<StatusEvent>` | yes | - | +| `listener` | `EventListener` | yes | - | Returns: `Promise` @@ -1361,7 +1361,7 @@ onTxChanged(listener: EventListener): Promise | Parameter | Type | Required | Description | | --- | --- | --- | --- | -| `listener` | `EventListener<TxChangedEvent>` | yes | - | +| `listener` | `EventListener` | yes | - | Returns: `Promise` @@ -1461,7 +1461,7 @@ removeOnAccountsChanged(listener: EventListener): Promise< | Parameter | Type | Required | Description | | --- | --- | --- | --- | -| `listener` | `EventListener<AccountsChangedEvent>` | yes | - | +| `listener` | `EventListener` | yes | - | Returns: `Promise` @@ -1487,7 +1487,7 @@ removeOnConnected(listener: EventListener): Promise | Parameter | Type | Required | Description | | --- | --- | --- | --- | -| `listener` | `EventListener<StatusEvent>` | yes | - | +| `listener` | `EventListener` | yes | - | Returns: `Promise` @@ -1513,7 +1513,7 @@ removeOnStatusChanged(listener: EventListener): Promise | Parameter | Type | Required | Description | | --- | --- | --- | --- | -| `listener` | `EventListener<StatusEvent>` | yes | - | +| `listener` | `EventListener` | yes | - | Returns: `Promise` @@ -1539,7 +1539,7 @@ removeOnTxChanged(listener: EventListener): Promise | Parameter | Type | Required | Description | | --- | --- | --- | --- | -| `listener` | `EventListener<TxChangedEvent>` | yes | - | +| `listener` | `EventListener` | yes | - | Returns: `Promise` diff --git a/docs-main/reference/typescript/wallet-sdk.mdx b/docs-main/reference/typescript/wallet-sdk.mdx index 5b1a27b80..d2c587bad 100644 --- a/docs-main/reference/typescript/wallet-sdk.mdx +++ b/docs-main/reference/typescript/wallet-sdk.mdx @@ -1,5 +1,5 @@ --- -title: "@canton-network/wallet-sdk" +title: "Wallet SDK" description: "TypeScript client library reference for wallet integrations." --- @@ -208,7 +208,7 @@ Generated from published `@canton-network/wallet-sdk` TypeDoc snapshots. | Member | Type | Description | | --- | --- | --- | | `constructor` | `void` | - | -| `command` | `{ cancel: (args: { parties: PreapprovalParties }) => Promise<[{ ExerciseCommand: { choice: string; choiceArgument: unknown; contractId: string; templateId: string } & { choice: string; choiceArgument: unknown; contractId: string; templateId: string } }, { contractId?: string; createdEventBlob: string; synchronizerId?: string; templateId?: string } & { contractId?: string; createdEventBlob: string; synchronizerId?: string; templateId?: string }[]] \| readonly [null, readonly []]>; create: (args: { parties: PreapprovalParties }) => Promise<{ CreateCommand: { createArguments: unknown; templateId: string } & { createArguments: unknown; templateId: string } }> }` | Commands for managing transfer preapprovals. The return result can be used as an argument to pass to signing and execution of a transaction.
Transfer preapprovals allow receivers to automatically accept incoming transfers. | +| `command` | `{ cancel: (args: { parties: PreapprovalParties }) => Promise<[{ ExerciseCommand: { choice: string; choiceArgument: unknown; contractId: string; templateId: string } & { choice: string; choiceArgument: unknown; contractId: string; templateId: string } }, { contractId?: string; createdEventBlob: string; synchronizerId?: string; templateId?: string } & { contractId?: string; createdEventBlob: string; synchronizerId?: string; templateId?: string }[]] \| readonly [null, readonly []]>; create: (args: { parties: PreapprovalParties }) => Promise<{ CreateCommand: { createArguments: unknown; templateId: string } & { createArguments: unknown; templateId: string } }> }` | Commands for managing transfer preapprovals. The return result can be used as an argument to pass to signing and execution of a transaction.
Transfer preapprovals allow receivers to automatically accept incoming transfers. | | `fetchQuick` | `void` | - | | `fetchStatus` | `void` | - | | `renew` | `void` | - | @@ -226,7 +226,7 @@ Generated from published `@canton-network/wallet-sdk` TypeDoc snapshots. | Member | Type | Description | | --- | --- | --- | | `constructor` | `void` | - | -| `preparedPromise` | `Promise<{ costEstimation?: { confirmationRequestTrafficCostEstimation: number; confirmationResponseTrafficCostEstimation: number; estimationTimestamp: string; totalTrafficCostEstimation: number }; hashingDetails?: string; hashingSchemeVersion: "HASHING_SCHEME_VERSION_UNSPECIFIED" \| "HASHING_SCHEME_VERSION_V2" \| "HASHING_SCHEME_VERSION_V3"; preparedTransaction: string; preparedTransactionHash: string }>` | - | +| `preparedPromise` | `Promise<{ costEstimation?: { confirmationRequestTrafficCostEstimation: number; confirmationResponseTrafficCostEstimation: number; estimationTimestamp: string; totalTrafficCostEstimation: number }; hashingDetails?: string; hashingSchemeVersion: "HASHING_SCHEME_VERSION_UNSPECIFIED" \| "HASHING_SCHEME_VERSION_V2" \| "HASHING_SCHEME_VERSION_V3"; preparedTransaction: string; preparedTransactionHash: string }>` | - | | `decode` | `void` | - | | `sign` | `void` | - | | `toJSON` | `void` | - | @@ -277,7 +277,7 @@ Generated from published `@canton-network/wallet-sdk` TypeDoc snapshots. | Member | Type | Description | | --- | --- | --- | | `constructor` | `void` | - | -| `signedPromise` | `Promise<{ response: { costEstimation?: { confirmationRequestTrafficCostEstimation: number; confirmationResponseTrafficCostEstimation: number; estimationTimestamp: string; totalTrafficCostEstimation: number }; hashingDetails?: string; hashingSchemeVersion: "HASHING_SCHEME_VERSION_UNSPECIFIED" \| "HASHING_SCHEME_VERSION_V2" \| "HASHING_SCHEME_VERSION_V3"; preparedTransaction: string; preparedTransactionHash: string }; signature: string }>` | - | +| `signedPromise` | `Promise<{ response: { costEstimation?: { confirmationRequestTrafficCostEstimation: number; confirmationResponseTrafficCostEstimation: number; estimationTimestamp: string; totalTrafficCostEstimation: number }; hashingDetails?: string; hashingSchemeVersion: "HASHING_SCHEME_VERSION_UNSPECIFIED" \| "HASHING_SCHEME_VERSION_V2" \| "HASHING_SCHEME_VERSION_V3"; preparedTransaction: string; preparedTransactionHash: string }; signature: string }>` | - | | `execute` | `void` | - | | `response` | `void` | - | | `signature` | `void` | - | @@ -321,8 +321,8 @@ interface FeaturedAppService | Member | Type | Description | | --- | --- | --- | -| `grant` | `(options?: GrantFeaturedAppRightsOptions) => Promise<FeaturedAppRight>` | Submits a command to grant feature app rights for validator operator. | -| `rights` | `(options: LookupFeaturedAppRightsOptions) => Promise<FeaturedAppRight>` | Looks up if a party has FeaturedAppRight.
Has an in built retry and delay between attempts | +| `grant` | `(options?: GrantFeaturedAppRightsOptions) => Promise` | Submits a command to grant feature app rights for validator operator. | +| `rights` | `(options: LookupFeaturedAppRightsOptions) => Promise` | Looks up if a party has FeaturedAppRight.
Has an in built retry and delay between attempts | ### Type Aliases @@ -712,7 +712,7 @@ type RegisteredPlugins

SDKPlugin> | Name | Constraint | Default | Description | | --- | --- | --- | --- | -| `P` | `Record<string, (ctx: SDKContext) => SDKPlugin>` | `Record<string, (ctx: SDKContext) => SDKPlugin>` | - | +| `P` | `Record SDKPlugin>` | `Record SDKPlugin>` | - | diff --git a/src/x2mdx/typedoc/render.py b/src/x2mdx/typedoc/render.py index 992e4593e..509dea607 100644 --- a/src/x2mdx/typedoc/render.py +++ b/src/x2mdx/typedoc/render.py @@ -14,6 +14,14 @@ def escape_md_cell(text: str) -> str: return "
".join(escape_mdx_text(line).replace("|", r"\|") for line in text.splitlines()) +def escape_md_code(text: str) -> str: + return str(text).replace("`", r"\`").replace("|", r"\|").replace("\n", " ").strip() + + +def code_span(text: str) -> str: + return f"`{escape_md_code(text)}`" + + def escape_mdx_text(text: str) -> str: return text.replace("&", "&").replace("<", "<").replace(">", ">") @@ -57,9 +65,9 @@ def version_change_summary_rows(exports: list[dict[str, object]], versions: list def _type_parameter_rows(items: list[dict[str, Any]]) -> list[list[str]]: return [ [ - f"`{escape_md_cell(item['name'])}`", - f"`{escape_md_cell(item['constraint'])}`" if item["constraint"] else "-", - f"`{escape_md_cell(item['default'])}`" if item["default"] else "-", + code_span(item["name"]), + code_span(item["constraint"]) if item["constraint"] else "-", + code_span(item["default"]) if item["default"] else "-", escape_md_cell(item["description"]) if item["description"] else "-", ] for item in items @@ -74,14 +82,14 @@ def _signature_docs(signature_docs: list[dict[str, Any]]) -> list[dict[str, Any] "type_parameter_rows": _type_parameter_rows(signature["type_parameters"]), "parameter_rows": [ [ - f"`{escape_md_cell(item['name'])}`", - f"`{escape_md_cell(item['type'])}`", + code_span(item["name"]), + code_span(item["type"]), item["required"], escape_md_cell(item["description"]) if item["description"] else "-", ] for item in signature["parameters"] ], - "returns": str(signature["returns"]), + "returns": escape_md_code(str(signature["returns"])), } for signature in signature_docs ] @@ -112,7 +120,7 @@ def _export_context(export: dict[str, Any]) -> dict[str, Any]: "lifecycle_bits": lifecycle_bits, "change_rows": [ [ - f"`{escape_md_cell(str(entry['version']))}`", + code_span(str(entry["version"])), escape_md_cell("; ".join(str(change) for change in entry["changes"])), ] for entry in export["change_details"] @@ -123,8 +131,8 @@ def _export_context(export: dict[str, Any]) -> dict[str, Any]: "signature_docs": _signature_docs(export["signature_docs"]), "member_rows": [ [ - f"`{escape_md_cell(item['name'])}`", - f"`{escape_md_cell(item['type'])}`", + code_span(item["name"]), + code_span(item["type"]), escape_md_cell(item["summary"]) if item["summary"] else "-", ] for item in export["members"] @@ -157,13 +165,13 @@ def build_page( report=report, toc_rows=[ [ - f"[`{escape_md_cell(export['name'])}`](#{export['anchor']})", + f"[{code_span(export['name'])}](#{export['anchor']})", escape_md_cell(export["kind_label"]), render_summary_cell(str(export["summary"])), - f"`{export['introduced_in']}`", + code_span(export["introduced_in"]), escape_md_cell(render_change_summary(export["change_details"])), - f"`{export['lifecycle_label']}`" if export["lifecycle_label"] == "Deprecated" else "-", - f"`{export['removed_in']}`" if export["removed_in"] else "-", + code_span(export["lifecycle_label"]) if export["lifecycle_label"] == "Deprecated" else "-", + code_span(export["removed_in"]) if export["removed_in"] else "-", ] for export in report.exports ], diff --git a/tests/test_typedoc.py b/tests/test_typedoc.py index 6c11ab71b..8340bd13f 100644 --- a/tests/test_typedoc.py +++ b/tests/test_typedoc.py @@ -6,7 +6,7 @@ from pathlib import Path from x2mdx.cli import main as cli_main -from x2mdx.typedoc.render import escape_md_cell +from x2mdx.typedoc.render import code_span, escape_md_cell from x2mdx.typedoc.lifecycle import build_typedoc_report_from_sources, normalize_source_location, render_type from x2mdx.typedoc.snapshots import load_typedoc_sources @@ -351,3 +351,9 @@ def test_table_cells_escape_mdx_angle_brackets(self) -> None: escape_md_cell("Provider\nleft|right"), "Provider<DappRpcTypes>
left\\|right", ) + + def test_code_spans_keep_typescript_generics_literal(self) -> None: + self.assertEqual( + code_span("() => Promise | null"), + "`() => Promise \\| null`", + )