Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: show examples of Mermaid diagrams as images #1387

Merged
merged 7 commits into from
Jan 20, 2025
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Added onchain metadata creation for NFTs and Jettons to the cookbook: PR [#1236](https://github.com/tact-lang/tact/pull/1236)
- Document that identifiers cannot start with `__gen` or `__tact`, and cannot contain Unicode characters apart from the small subset `a-zA-Z0-9_`: PR [#1312](https://github.com/tact-lang/tact/pull/1312)
- Added signatures for map methods, such as `.get()`, `.exists()`, `.set()`, `.replace()`, `.replaceGet()`, `.del()`, `.isEmpty()`, `.deepEquals()`, `.asCell()`: PR [#1352](https://github.com/tact-lang/tact/pull/1352)
- Added a compilation-related page with the description of the compilation report: PR [#1309](https://github.com/tact-lang/tact/pull/1309)
- Added a compilation-related page with the description of the compilation report: PR [#1309](https://github.com/tact-lang/tact/pull/1309), PR [#1387](https://github.com/tact-lang/tact/pull/1387)

### Release contributors

Expand Down
novusnota marked this conversation as resolved.
Show resolved Hide resolved
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/src/assets/contract-dependency-diagram.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/src/assets/trait-inheritance-diagram.png
novusnota marked this conversation as resolved.
Show resolved Hide resolved
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
20 changes: 17 additions & 3 deletions docs/src/content/docs/book/compile.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -112,11 +112,25 @@ There, the [exit codes](/book/exit-codes) in the range from $0$ to $255$ are tho

#### Trait inheritance diagram {#trait-diagram}

This section shows a [Mermaid][mm] diagram of inherited [traits](/book/types#traits), including the [`BaseTrait{:tact}`](/ref/core-base).
This section shows a [Mermaid][mm] diagram of [inherited traits](/book/contracts#traits), including the [`BaseTrait{:tact}`](/ref/core-base).

#### Contract inheritance diagram {#contract-diagram}
For example:

![Trait inheritance diagram](/src/assets/trait-inheritance-diagram.png)

There, [`JettonWallet`](https://github.com/tact-lang/jetton/blob/ef802f95c967f2fd37e80893845c3c3ed7c34c78/sources/jetton_wallet.tact) inherits the `WalletExitcodes` and `GasConstant` traits, and all inherit the [`BaseTrait{:tact}`](/ref/core-base).

#### Contract dependency diagram {#contract-diagram}

This section shows a [Mermaid][mm] diagram of [contract](/book/contracts) dependencies, i.e. any calls to [`initOf{:tact}`](/book/expressions#initof) in order to compute the initial state of other contracts.

If the contract has no dependencies, only its name is displayed:

![Contract dependency diagram without dependencies](/src/assets/contract-dependency-diagram.png)

However, if the contract, say `FirstOne`, somewhere in its code computes the [initial state](/book/expressions#initof) of another contract, say `SecondOne`, such a relationship is shown in the diagram:

This section shows a [Mermaid][mm] diagram of [contract](/book/contracts) dependencies, i.e. the [traits](/book/types#traits) that it depends upon.
![Contract dependency diagram with a single dependency](/src/assets/contract-dependency-diagram-2.png)

[struct]: /book/structs-and-messages#structs
[message]: /book/structs-and-messages#messages
Expand Down
2 changes: 1 addition & 1 deletion docs/src/content/docs/book/contracts.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ Each contract can contain:
* [Receiver functions](#receiver-functions)
* [Internal functions](#internal-functions)

### Inherited traits, `with{:tact}` {#traits}
### Inherited traits, `with` {#traits}

Contracts can inherit all the declarations and definitions from [traits][trait] and override some of their default behaviours. In addition to that, every contract and trait implicitly inherits the special [`BaseTrait{:tact}` trait](/ref/core-base).

Expand Down
Loading