You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
in their respective section folders. Tutorials are automatically generated
21
22
from corresponding `.md` files, with each tutorial having its own subdirectory.
22
23
23
24

24
25
25
26
### Generating tutorials
26
27
27
-
After making modifications to tutorial files (`.md` or other resources), it is necessary to regenerate the global list
28
-
of tutorials by running the following command:
28
+
After making modifications to tutorial files (`.md` or other resources), it is
29
+
necessary to regenerate the global list of tutorials by running the following
30
+
command:
29
31
30
32
```bash
31
33
yarn generate
32
34
```
33
35
34
-
This command executes the tutorial route generation script, ensuring that all tutorials are up to date and ready for
35
-
dynamic display. Make sure to run this command from the repository root.
36
+
This command executes the tutorial route generation script, ensuring that all
37
+
tutorials are up-to-date and ready for dynamic display. Make sure to run this
38
+
command from the repository root.
36
39
37
40
### Markdown format
38
41
39
42
Tutorials can be written using Markdown syntax.
40
43
41
44
#### Metadata header
42
45
43
-
A markdown header with some specific metadata is mandatory. This makes it possible for the tutorial generator script to
44
-
correctly parse and organize examples.
45
-
`title` and `section` values have to be set as part of the metadata at the top of the markdown file:
46
+
A markdown header with some specific metadata is mandatory. This makes it
47
+
possible for the tutorial generator script to correctly parse and organize examples.
48
+
`title` and `section` values have to be set as part of the metadata at the
49
+
top of the markdown file:
46
50
47
51
```md
48
52
---
@@ -51,29 +55,40 @@ section: Example Section
51
55
---
52
56
```
53
57
58
+
Note: The `section` field in the metadata header will ultimately decide under
59
+
which section the tutorial is generated in.
60
+
54
61
#### Code snippets
55
62
56
-
In Gno By Example, there is a special feature that allows referencing entire external files or specific line numbers
57
-
from those files, outside of the Markdown files themselves.
63
+
In Gno By Example, there is a special feature that allows referencing entire
64
+
external files or specific line numbers from those files, outside of the Markdown
65
+
files themselves.
58
66
59
-
To embed the entire content of a specific file inside a code segment, use the following syntax:
67
+
To embed the entire content of a specific file inside a code segment, use the
68
+
following syntax:
60
69
61
70
````md
62
71
```go file=./myFile.gno
63
72
```
64
73
````
65
74
66
-
To embed specific line numbers from an external file inside a code segment, use the following syntax:
75
+
To embed specific line numbers from an external file inside a code segment, use
76
+
the following syntax:
67
77
68
78
````md
69
79
```go file=./myFile.gno#L1-L2
70
80
```
71
81
````
72
82
73
-
The above syntax will embed the content of the first two lines (inclusive) from the `./myFile.gno` file.
83
+
The above syntax will embed the content of the first two lines (inclusive) from
84
+
the `./myFile.gno` file.
85
+
86
+
If your sample code relies on another code, you can define the dependencies.
87
+
Each dependency code will be shown in a separate tab.
88
+
A typical scenario occurs when your sample code is a test file. In order for
89
+
your test file to be executable, you need to include the actual implementation
90
+
as a dependency.
74
91
75
-
If your sample code relies on another code, you can define the dependencies. Each dependency code will be shown in a separate tab.
76
-
A typical scenario occurs when your sample code is a test file. In order for your test file to be executable, you need to include the actual implementation as a dependency.
0 commit comments