@@ -67,7 +67,7 @@ My terminal transcript
67
67
68
68
Each [ cssterm] box can be referenced with its name using the ` ref ` role,
69
69
e.g., `` {ref}`cssterm:my-id` `` , which produces * terminal box* hyper-link.
70
- The default hyper-link text can be changed with with the folowing ` ref ` role
70
+ The default hyper-link text can be changed with with the following ` ref ` role
71
71
syntax: `` {ref}`custom hyper-link text <cssterm:my-id>` `` .
72
72
See the [ MyST Markdown documentation] for more details.
73
73
@@ -98,7 +98,101 @@ changes and automatically regenerates the affected pages.
98
98
99
99
## :keyboard : termynal directive ##
100
100
101
- * Work in progress.*
101
+ The [ ` sphinx_term.termynal ` ] ( sphinx_term/termynal.py ) module defines the
102
+ ` termynal ` directive, which is used for building [ termynal] terminal windows.
103
+
104
+ ### Usage ###
105
+
106
+ A * [ termynal] box* is included with the ` termynal ` directive:
107
+
108
+ ```` text
109
+ ```{termynal} termynal:my-id
110
+ - value: echo "My terminal transcript"
111
+ type: input
112
+ - My terminal transcript
113
+ ```
114
+ ````
115
+
116
+ The content of the directive is a ** yml-formatted list** of lines to be
117
+ displayed by the terminal (i.e., the terminal transcript).
118
+ Each element of this list can either be:
119
+ - an ** empty** element -- indicating a plain, empty line;
120
+ - a ** string** -- specifying a plain line of terminal * output* text; or
121
+ - a ** dictionary** -- defining more complex line style.
122
+
123
+ Each line defined as a * dictionary* supports the following ** optional** keys:
124
+ - ` value ` (default * empty string* ) -- the content of the termynal
125
+ line given as a string;
126
+ - ` type ` (default * none* ) -- the line type where:
127
+ * ` input ` indicates that the termynal line is an input,
128
+ * ` progress ` creates a progress bar (` value ` is not required), and
129
+ * * empty string* (` '' ` ) or * undefined* to get a plain * output* line --
130
+ the default behaviour;
131
+ - ` prompt ` (default ` $ ` ) -- a string specifying the prompt style;
132
+ - ` progressPercent ` (default ` 100 ` ) -- the maximum percent of the
133
+ ` progress ` bar;
134
+ - ` progressChar ` (default ` █ ` ) -- the character used to build the
135
+ ` progress ` bar (* see below for more details* );
136
+ - ` typeDelay ` (default ` 90 ` ) -- the delay between each typed
137
+ character given in milliseconds (* see below for more details* ); and
138
+ - ` cursor ` (default ` ▋ ` ) -- the character used as the cursor
139
+ (* see below for more details* ).
140
+
141
+ For more information about customising termynal lines refer to the official
142
+ documentation of [ termynal lines] [ termynal-line ] .
143
+
144
+ Each [ termynal] box can be referenced with its name using the ` ref ` role,
145
+ e.g., `` {ref}`termynal:my-id` `` , which produces * terminal box* hyper-link.
146
+ The default hyper-link text can be changed with with the following ` ref ` role
147
+ syntax: `` {ref}`custom hyper-link text <termynal:my-id>` `` .
148
+ See the [ MyST Markdown documentation] for more details.
149
+
150
+ ### Configuration parameters ###
151
+
152
+ The ` termynal ` extension uses one [ Sphinx] configuration parameter:
153
+
154
+ * ` sphinx_term_termynal_dir ` (** required** when loading the box content
155
+ from a file) -- defines the path to a directory holding files with content
156
+ (terminal transcript) of each terminal box.
157
+
158
+ ### Arguments, parameters and content ###
159
+
160
+ Each [ termynal] box has one ** required** argument that specifies
161
+ the * unique* id of this particular terminal block.
162
+ This id ** must** start with the ` termynal: ` prefix.
163
+ The content of a [ termynal] box can ** either** be provided explicitly within
164
+ the directive, ** or** -- when the content is left empty -- it is pulled from a
165
+ terminal transcript file whose name is derived from the terminal box id,
166
+ and which should be located in the directory specified via the
167
+ ` sphinx_term_termynal_dir ` configuration parameter.
168
+ The terminal transcript file name is expected to be the [ termynal] block id
169
+ ** without** the ` termynal: ` prefix and ** with** the ` .yml ` extension.
170
+ For example, for a [ termynal] block with ` termynal:my_log ` id, the terminal
171
+ transcript file should be named ` my_code.yml ` .
172
+ The ` sphinx_term.termynal ` [ Sphinx] extension * monitors* the code files for
173
+ changes and automatically regenerates the affected pages.
174
+
175
+ The ` termynal ` directive takes a number of ** optional** parameters
176
+ (see the official documentation of [ termynal boxes] [ termynal-conf ] for more
177
+ information):
178
+ - ` prefix ` (default ` ty ` ) -- the prefix used for data attributes;
179
+ - ` startDelay ` (default ` 600 ` ) -- the delay before animation,
180
+ given in milliseconds;
181
+ - ` typeDelay ` (default ` 90 ` ) -- the delay between displaying each typed
182
+ character, given in milliseconds;
183
+ - ` lineDelay ` (default ` 1500 ` ) -- the delay between displaying each line,
184
+ given in milliseconds;
185
+ - ` progressLength ` (default ` 40 ` ) -- the number of characters used when
186
+ displaying a progress bar;
187
+ - ` progressChar ` (default ` █ ` ) -- the character used for building
188
+ progress bars;
189
+ - ` cursor ` (default ` ▋ ` ) -- the character used for displaying the cursor;
190
+ - ` noInit ` (default ` false ` ) -- whether to initialise the animation when the
191
+ termynal window is loaded.
192
+ When set to ` true ` , the termynal window can be initialised by explicitly
193
+ calling ` Termynal.init() ` ; and
194
+ - ` lineData ` (default ` null ` ) -- the sequence used to dynamically load termynal
195
+ lines at instantiation.
102
196
103
197
---
104
198
@@ -110,6 +204,9 @@ changes and automatically regenerates the affected pages.
110
204
[ jupyter book ] : https://jupyterbook.org/
111
205
[ termynal ] : https://github.com/ines/termynal
112
206
[ cssterm ] : https://github.com/nstephens/cssterm
207
+ [ termynal ] : https://github.com/ines/termynal
208
+ [ termynal-conf ] : https://github.com/ines/termynal#customising-termynal
209
+ [ termynal-line] : https://github.com/ines/termynal#prompts-and-animations for description
113
210
[ example page ] : https://so-cool.github.io/sphinx-term
114
211
[ doc ] : docs
115
212
[ myst markdown ] : https://myst-parser.readthedocs.io/
0 commit comments