From fc8b938e5042a39b62eb4bc94723064bcd8db29f Mon Sep 17 00:00:00 2001 From: Peter Smith Date: Mon, 9 Dec 2024 11:23:52 +0000 Subject: [PATCH 1/3] chore: fix link --- .changeset/old-maps-fold.md | 2 ++ apps/docs/README.md | 15 +++++++++++++++ .../src/guide/transactions/transaction-request.md | 2 +- 3 files changed, 18 insertions(+), 1 deletion(-) create mode 100644 .changeset/old-maps-fold.md diff --git a/.changeset/old-maps-fold.md b/.changeset/old-maps-fold.md new file mode 100644 index 00000000000..a845151cc84 --- /dev/null +++ b/.changeset/old-maps-fold.md @@ -0,0 +1,2 @@ +--- +--- diff --git a/apps/docs/README.md b/apps/docs/README.md index f7cbd7f83b6..53e7c0234bc 100644 --- a/apps/docs/README.md +++ b/apps/docs/README.md @@ -8,6 +8,7 @@ - [Table of contents](#table-of-contents) - [Building](#building) - [Testing](#testing) + - [Referencing snippets](#referencing-snippets) ## Building @@ -42,3 +43,17 @@ If no environment is specified, it will run in the browser and node environments ```sh pnpm test ``` + +## Writing docs + +To reference a snippet outside of the current directory, you need to use the following syntax (`<<< @/`): + +```md +`<<< @/../../path/to/snippet.ts#snippet-name{language:line-numbers} +``` + +To reference a snippet in the current directory, you can use the following syntax (`<<< @./`): + +```md +`<<< @./snippets/transaction-request/fetch-resources.ts#transaction-request-5{ts:line-numbers} +``` diff --git a/apps/docs/src/guide/transactions/transaction-request.md b/apps/docs/src/guide/transactions/transaction-request.md index 95ceb4847bb..c7b7c8e55c6 100644 --- a/apps/docs/src/guide/transactions/transaction-request.md +++ b/apps/docs/src/guide/transactions/transaction-request.md @@ -60,7 +60,7 @@ If needed, you can manually include specific coins or messages in the transactio Imagine that you have a Sway script that manually calls a contract: -<<< @../../../../sway/script-call-contract/src/main.sw#transaction-request-7{rs:line-numbers} +<<< @/../../../../sway/script-call-contract/src/main.sw#transaction-request-7{rs:line-numbers} In those cases, you will need to add both an `InputContract` and `OutputContract` to the transaction request: From 63fc25887be9674189cd04ddb8d190f69b70f754 Mon Sep 17 00:00:00 2001 From: Peter Smith Date: Mon, 9 Dec 2024 11:44:06 +0000 Subject: [PATCH 2/3] docs: fix docs link --- apps/docs/src/guide/transactions/transaction-request.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/docs/src/guide/transactions/transaction-request.md b/apps/docs/src/guide/transactions/transaction-request.md index c7b7c8e55c6..6d7b7337a82 100644 --- a/apps/docs/src/guide/transactions/transaction-request.md +++ b/apps/docs/src/guide/transactions/transaction-request.md @@ -60,7 +60,7 @@ If needed, you can manually include specific coins or messages in the transactio Imagine that you have a Sway script that manually calls a contract: -<<< @/../../../../sway/script-call-contract/src/main.sw#transaction-request-7{rs:line-numbers} +<<< @/../../docs/sway/script-call-contract/src/main.sw#transaction-request-7{rs:line-numbers} In those cases, you will need to add both an `InputContract` and `OutputContract` to the transaction request: From 762f2b0321ab3c916b263f9e5f6c03975412e337 Mon Sep 17 00:00:00 2001 From: Peter Smith Date: Mon, 9 Dec 2024 11:55:26 +0000 Subject: [PATCH 3/3] chore: fix link --- apps/docs/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/docs/README.md b/apps/docs/README.md index 53e7c0234bc..fa97e16d3c4 100644 --- a/apps/docs/README.md +++ b/apps/docs/README.md @@ -44,7 +44,7 @@ If no environment is specified, it will run in the browser and node environments pnpm test ``` -## Writing docs +## Referencing snippets To reference a snippet outside of the current directory, you need to use the following syntax (`<<< @/`):