markdown_exec 3.4.0 → 3.5.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (48) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +25 -0
  3. data/Dockerfile.test +42 -0
  4. data/Gemfile +1 -0
  5. data/Gemfile.lock +11 -1
  6. data/README.md +283 -144
  7. data/Rakefile +34 -26
  8. data/bats/block-type-shell-require-ux.bats +15 -0
  9. data/bats/block-type-ux-echo.bats +1 -1
  10. data/bats/block-type-ux-require-context.bats +14 -0
  11. data/bats/import-directive-line-continuation.bats +1 -1
  12. data/bats/import-directive-parameter-symbols.bats +1 -1
  13. data/bats/import-parameter-symbols.bats +1 -1
  14. data/bats/options.bats +2 -2
  15. data/bin/bmde +1 -1
  16. data/demo/trap.demo1.gif +0 -0
  17. data/demo/trap.demo1.mp4 +0 -0
  18. data/docs/dev/block-type-shell-require-ux.md +18 -0
  19. data/docs/dev/block-type-ux-echo.md +2 -1
  20. data/docs/dev/block-type-ux-format.md +10 -0
  21. data/docs/dev/block-type-ux-require-context.md +32 -0
  22. data/docs/dev/block-type-ux-require.md +8 -4
  23. data/docs/dev/import-directive-line-continuation.md +0 -1
  24. data/docs/dev/import-directive-parameter-symbols.md +0 -2
  25. data/docs/dev/import-parameter-symbols-template.md +7 -5
  26. data/docs/dev/import-parameter-symbols.md +10 -2
  27. data/docs/docker-testing.md +115 -0
  28. data/docs/tab-completion.md +33 -0
  29. data/examples/colors.md +31 -29
  30. data/lib/cached_nested_file_reader.rb +15 -47
  31. data/lib/collapser.rb +1 -1
  32. data/lib/command_result.rb +5 -5
  33. data/lib/constants.rb +3 -1
  34. data/lib/evaluate_shell_expressions.rb +1 -1
  35. data/lib/fcb.rb +7 -1
  36. data/lib/find_files.rb +1 -2
  37. data/lib/hash_delegator.rb +76 -32
  38. data/lib/input_sequencer.rb +1 -1
  39. data/lib/instance_method_wrapper.rb +1 -1
  40. data/lib/link_history.rb +1 -1
  41. data/lib/markdown_exec/version.rb +1 -1
  42. data/lib/markdown_exec.rb +1 -1
  43. data/lib/menu.src.yml +18 -8
  44. data/lib/menu.yml +14 -5
  45. data/lib/parameter_expansion.rb +918 -0
  46. data/lib/parse_animation_to_tts.rb +4417 -0
  47. data/lib/resize_terminal.rb +21 -32
  48. metadata +14 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ec9a613148346890f4db46f3f5bdcade05b8e2221e92402c431fa9a359556e1e
4
- data.tar.gz: 05d16eaf1ac5d433c8da62513da88159313e3b2898d36d7dfa0d71061c83a97b
3
+ metadata.gz: 6becba5a0ff94fb60399da0fc99248fff83905def9c65e4a8e1ae9c597652036
4
+ data.tar.gz: 98f0d4ad3764fec26b4ed8f1bce1904af1f350853b3e2678847f0557b381e8bf
5
5
  SHA512:
6
- metadata.gz: 9dcec89e521fc194eb329b36dc83068a11215186c5e3e5447485000a40c8e75f8bdabd10824af34b9ff90fee3f0899d5bb0f82f76f4ffa3a0a950d213585e6a5
7
- data.tar.gz: 06b8fb5443b026e628fd60962bd9c7abbccd78824ea0d0b001f27b4608cc0cb147fff6fa00eac5de3712ed97f76d50296b35368675478992e06b28db06b29dfc
6
+ metadata.gz: b2d1d60bcf1fe258a8be76893b070ab418563e27923c9e8a4370cd04fa5e0d421732c3c51e76e596a5d492885170270437916035530f64ba2e99a98d215bd908
7
+ data.tar.gz: 306d802cfcfc5bfa9460e2d58a69ac4f9ac0c058a28859243a237682d2622549277ff6f8515f84c51b2a2ede229c3f95eaa9a0ce5b9dbde98bfc2ad862c9aa8f
data/CHANGELOG.md CHANGED
@@ -1,5 +1,30 @@
1
1
  # Changelog
2
2
 
3
+ ## [3.5.1] - 2025-11-14
4
+
5
+ ### Added
6
+
7
+ - Docker testing environment.
8
+
9
+ ### Changed
10
+
11
+ - Correct tests for Docker environment.
12
+ - Uses env split mode to parse the shell command.
13
+
14
+ ## [3.5.0] - 2025-11-13
15
+
16
+ ### Added
17
+
18
+ - MP4 with demonstration of Bash "trap" command.
19
+ - Type casting for tokens in imported documents.
20
+ - Default color for fenced code blocks per type.
21
+ - Shell blocks can require UX blocks.
22
+ - Common markdown patterns for text decorations.
23
+
24
+ ### Changed
25
+
26
+ - README.md
27
+
3
28
  ## [3.4.0] - 2025-09-16
4
29
 
5
30
  ### Added
data/Dockerfile.test ADDED
@@ -0,0 +1,42 @@
1
+ FROM ruby:3.3-bookworm
2
+
3
+ ENV LANG C.UTF-8
4
+
5
+ RUN apt-get update && apt-get install -y --no-install-recommends \
6
+ build-essential \
7
+ bsdmainutils \
8
+ gawk \
9
+ git \
10
+ tree \
11
+ vim
12
+
13
+ # `markdown_exec` is the name expected by some BATS tests
14
+ WORKDIR /markdown_exec
15
+
16
+ # Clone the repository (shallow clone for faster builds)
17
+ ARG GIT_BRANCH=main
18
+ RUN git clone --depth 1 --branch ${GIT_BRANCH} https://github.com/fareedst/markdown_exec.git .
19
+
20
+ # Initialize and update git submodules
21
+ RUN git submodule update --init --recursive
22
+
23
+ # Install dependencies
24
+ RUN bundle install
25
+
26
+ # Add aliases
27
+ RUN echo 'alias batsv="bats --verbose-run --show-output-of-passing-tests"' >> ~/.bashrc && \
28
+ echo 'alias be="bundle exec"' >> ~/.bashrc && \
29
+ echo 'alias bmde="bin/bmde"' >> ~/.bashrc && \
30
+ echo 'alias ll="ls -FGlAhp"' >> ~/.bashrc
31
+
32
+ RUN git submodule add https://github.com/bats-core/bats-core.git test/bats && \
33
+ git submodule add https://github.com/bats-core/bats-support.git test/test_helper/bats-support && \
34
+ git submodule add https://github.com/bats-core/bats-assert.git test/test_helper/bats-assert
35
+
36
+ # make dirs, file for BATS tests
37
+ RUN mkdir -p logs
38
+ RUN mkdir -p docs/research
39
+ RUN echo '04:31 e' > logs/mde_site.local_2024-07-31-20-04-01___examples_save_md_~_test_.out.txt
40
+ RUN ln -s /markdown_exec/test/bats/bin/bats /usr/local/bin/
41
+
42
+ CMD ["bash"]
data/Gemfile CHANGED
@@ -12,6 +12,7 @@ gem 'erb'
12
12
  gem 'irb'
13
13
  gem 'mocha', require: false
14
14
  gem 'minitest', require: false
15
+ gem 'minitest-reporters', require: false
15
16
  gem 'pry-nav'
16
17
  gem 'pry-stack_explorer'
17
18
  gem 'railties'
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- markdown_exec (3.4.0)
4
+ markdown_exec (3.5.1)
5
5
  clipboard (~> 1.3.6)
6
6
  open3 (~> 0.1.1)
7
7
  optparse (~> 0.1.1)
@@ -37,6 +37,7 @@ GEM
37
37
  minitest (>= 5.1)
38
38
  mutex_m
39
39
  tzinfo (~> 2.0)
40
+ ansi (1.5.0)
40
41
  ast (2.4.2)
41
42
  base64 (0.2.0)
42
43
  bigdecimal (3.1.8)
@@ -98,9 +99,16 @@ GEM
98
99
  nokogiri (>= 1.12.0)
99
100
  method_source (1.1.0)
100
101
  minitest (5.24.1)
102
+ minitest-reporters (1.7.1)
103
+ ansi
104
+ builder
105
+ minitest (>= 5.0)
106
+ ruby-progressbar
101
107
  mocha (2.4.5)
102
108
  ruby2_keywords (>= 0.0.5)
103
109
  mutex_m (0.2.0)
110
+ nokogiri (1.16.6-aarch64-linux)
111
+ racc (~> 1.4)
104
112
  nokogiri (1.16.6-arm64-darwin)
105
113
  racc (~> 1.4)
106
114
  open3 (0.1.2)
@@ -218,6 +226,7 @@ GEM
218
226
  zeitwerk (2.6.16)
219
227
 
220
228
  PLATFORMS
229
+ aarch64-linux
221
230
  arm64-darwin-21
222
231
 
223
232
  DEPENDENCIES
@@ -227,6 +236,7 @@ DEPENDENCIES
227
236
  irb
228
237
  markdown_exec!
229
238
  minitest
239
+ minitest-reporters
230
240
  mocha
231
241
  pry-nav
232
242
  pry-stack_explorer
data/README.md CHANGED
@@ -1,211 +1,350 @@
1
1
  # MarkdownExec
2
2
 
3
- Interactively select and execute fenced code blocks in markdown files. Build complex scripts by naming and requiring blocks. Log resulting scripts and output. Re-run scripts.
4
-
5
- * Code blocks may be named. Named blocks can be required by other blocks.
6
-
7
- * The user-selected code block, and all required blocks, are arranged into a script in the order they appear in the markdown file. The script can be presented for approval prior to execution.
8
-
9
- * Executed scripts can be saved. Saved scripts can be listed, selected, and executed.
10
-
11
- * Output from executed scripts can be saved.
12
-
13
- ## Screenshots
14
-
15
- ### Select a file
16
-
17
- ![Select a file](/assets/select_a_file.png)
18
-
19
- ### Select a block
20
-
21
- ![Select a block](/assets/select_a_block.png)
22
-
23
- ### Approve code
24
-
25
- ![Approve code](/assets/approve_code.png)
26
-
27
- ### Output
28
-
29
- ![Output of execution](/assets/output_of_execution.png)
30
-
31
- ### Example blocks
32
-
33
- ![Example blocks](/assets/example_blocks.png)
3
+ [![MarkdownExec For Interactive Bash Instruction](https://raw.githubusercontent.com/fareedst/markdown_exec/main/demo/trap.demo1.gif)](https://raw.githubusercontent.com/fareedst/markdown_exec/main/demo/trap.demo1.mp4)
4
+
5
+ *Click the GIF above to view the full video with audio (MP4)*
6
+
7
+ Transform static markdown into interactive, executable workflows. Build complex scripts with named blocks, interactive forms, cross-document navigation, and template systems.
8
+
9
+ ## Key Features
10
+
11
+ ### Interactive Code Execution
12
+ - **Named Blocks**: Create reusable code blocks with dependencies
13
+ - **Block Requirements**: Automatically include required blocks in execution order
14
+ - **Interactive Selection**: Choose blocks from intuitive menus
15
+ - **Script Approval**: Review generated scripts before execution
16
+
17
+ ### UX Blocks - Interactive Forms
18
+ - **Variable Input**: Create interactive forms for user input
19
+ - **Validation**: Built-in regex validation with custom transforms
20
+ - **Dynamic Menus**: Selection from allowed values or command output
21
+ - **Auto-initialization**: Set values from environment, commands, or defaults
22
+ - **Dependencies**: Chain UX blocks with complex relationships
23
+
24
+ ### Cross-Document Navigation
25
+ - **Link Blocks**: Navigate between markdown files seamlessly
26
+ - **Variable Passing**: Share data between documents
27
+ - **Inherited Context**: Maintain state across document boundaries
28
+ - **HyperCard-style Navigation**: Create interactive document stacks
29
+
30
+ ### Template System & Imports
31
+ - **Import Directives**: Include content from other files with `@import`
32
+ - **Parameter Substitution**: Replace variables in imported content
33
+ - **Shell Expansions**: Use `${variable}` and `$(command)` syntax throughout documents
34
+ - **Dynamic Content**: Generate content based on user selections
35
+
36
+ ### Advanced Block Types
37
+ - **Shell Blocks**: Execute bash shells
38
+ - **UX Blocks**: Interactive forms with validation, transforms, and dynamic behavior
39
+ - **Vars Blocks**: Define variables in YAML format
40
+ - **Opts Blocks**: Configure document behavior and appearance
41
+ - **Link Blocks**: Cross-document navigation and variable passing
42
+
43
+ ### State Management
44
+ - **Script Persistence**: Save and replay executed scripts
45
+ - **Output Logging**: Capture and review execution results
46
+ - **State Inheritance**: Manage context across sessions
47
+ - **Configuration**: Flexible options via environment, files, or CLI
34
48
 
35
49
  ## Installation
36
50
 
37
- Install:
38
- $ gem install markdown_exec
51
+ ```bash
52
+ gem install markdown_exec
53
+ ```
39
54
 
40
- ## Usage
55
+ ## Quick Start
41
56
 
42
- ### Help
57
+ ### Interactive Mode (Recommended)
58
+ ```bash
59
+ mde # Process README.md in current folder
60
+ mde my-document.md # Process specific markdown file
61
+ mde . # Select from markdown files in current folder
62
+ ```
43
63
 
44
- ::: `mde --help`
64
+ ### Command Line Mode
65
+ ```bash
66
+ mde my-document.md my-block # Execute specific block directly
67
+ mde --list-blocks # List all available blocks
68
+ mde --list-docs # List all markdown documents
69
+ ```
45
70
 
46
- Displays help information.
71
+ ## Interactive Features
47
72
 
48
- ### Basic
73
+ ### UX Blocks - Interactive Forms
49
74
 
50
- ::: `mde`
75
+ Create interactive forms that prompt users for input:
51
76
 
52
- Process `README.md` file in the current folder. Displays all the blocks in the file and allows you to select using [up], [down], and [return].
77
+ <pre><code>```ux
78
+ name: USER_NAME
79
+ prompt: Enter your name
80
+ init: Guest
81
+ ```
82
+ </code></pre>
83
+
84
+ <pre><code>```ux
85
+ name: ENVIRONMENT
86
+ allow:
87
+ - development
88
+ - staging
89
+ - production
90
+ prompt: Select environment
91
+ ```
92
+ </code></pre>
53
93
 
54
- ::: `mde my.md` or `mde -f my.md`
94
+ <pre><code>```ux
95
+ name: EMAIL
96
+ prompt: Enter email address
97
+ validate: '(?<local>[^@]+)@(?<domain>[^@]+)'
98
+ transform: '%{local}@%{domain}'
99
+ ```
100
+ </code></pre>
55
101
 
56
- Select a block to execute from `my.md`.
102
+ ### Cross-Document Navigation
57
103
 
58
- ::: `mde my.md myblock`
104
+ Navigate between documents while maintaining context:
59
105
 
60
- Execute the block named `myblock` from `my.md`.
106
+ <pre><code>```link
107
+ file: next-document.md
108
+ vars:
109
+ current_user: ${USER_NAME}
110
+ environment: ${ENVIRONMENT}
111
+ ```
112
+ </code></pre>
61
113
 
62
- ::: `mde .` or `mde -p .`
114
+ ### Template System
63
115
 
64
- Select a markdown file in the current folder. Select a block to execute from that file.
116
+ Use imports with parameter substitution:
65
117
 
66
- ### Report documents and blocks
118
+ ```
119
+ @import template.md USER_NAME=John ENVIRONMENT=production
120
+ ```
121
+ </code></pre>
67
122
 
68
- ::: `mde --list-blocks`
123
+ ### Block Dependencies
69
124
 
70
- List all blocks in the all the markdown documents in the current folder.
125
+ Create complex workflows with automatic dependency resolution:
71
126
 
72
- ::: `mde --list-docs`
127
+ <pre><code>```bash :deploy +setup +test +deploy
128
+ echo "Deploying to ${ENVIRONMENT}"
129
+ ```
130
+ </code></pre>
73
131
 
74
- List all markdown documents in the current folder.
132
+ <pre><code>```bash :setup
133
+ echo "Setting up environment"
134
+ ```
135
+ </code></pre>
75
136
 
76
- ### Configuration
137
+ <pre><code>```bash :test
138
+ echo "Running tests"
139
+ ```
140
+ </code></pre>
77
141
 
78
- ::: `mde --list-default-env` or `mde --list-default-yaml`
142
+ ## Advanced Usage
79
143
 
80
- List default values that can be set in configuration file, environment, and command line.
144
+ ### Configuration
81
145
 
82
- ::: `mde -0`
146
+ ```
147
+ # Environment variables
148
+ export MDE_SAVE_EXECUTED_SCRIPT=1
149
+ export MDE_USER_MUST_APPROVE=1
83
150
 
84
- Show current configuation values that will be applied to the current run. Does not interrupt processing.
151
+ # Configuration file (.mde.yml)
152
+ save_executed_script: true
153
+ user_must_approve: true
85
154
 
86
- ### Save scripts
155
+ # Command line
156
+ mde --save-executed-script 1 --user-must-approve 1
157
+ ```
87
158
 
88
- ::: `mde --save-executed-script 1`
159
+ ### Script Management
89
160
 
90
- Save executed script in saved script folder.
161
+ ```bash
162
+ mde --save-executed-script 1 # Save executed scripts
163
+ mde --list-recent-scripts # List saved scripts
164
+ mde --select-recent-script # Execute saved script
165
+ mde --save-execution-output 1 # Save execution output
166
+ ```
91
167
 
92
- ::: `mde --list-recent-scripts`
168
+ ## Block Types Reference
93
169
 
94
- List recent saved scripts in saved script folder.
170
+ ### Shell Blocks
171
+ <pre><code>```bash
172
+ echo "Hello World"
173
+ ```
174
+ </code></pre>
95
175
 
96
- ::: `mde --select-recent-script`
176
+ ### UX Blocks (Interactive Forms)
177
+ <pre><code>```ux
178
+ name: USER_NAME
179
+ prompt: Enter your name
180
+ init: Guest
181
+ ```
182
+ </code></pre>
183
+
184
+ <pre><code>```ux
185
+ name: ENVIRONMENT
186
+ allow:
187
+ - development
188
+ - staging
189
+ - production
190
+ act: :allow
191
+ ```
192
+ </code></pre>
97
193
 
98
- Select and execute a recently saved script in saved script folder.
194
+ <pre><code>```ux
195
+ name: CURRENT_DIR
196
+ exec: basename $(pwd)
197
+ transform: :chomp
198
+ ```
199
+ </code></pre>
99
200
 
100
- ### Save output
201
+ <pre><code>```ux
202
+ name: EMAIL
203
+ prompt: Enter email address
204
+ validate: '(?<local>[^@]+)@(?<domain>[^@]+)'
205
+ transform: '%{local}@%{domain}'
206
+ ```
207
+ </code></pre>
101
208
 
102
- ::: `mde --save-execution-output 1`
209
+ ### Variable Blocks
210
+ <pre><code>```vars
211
+ DATABASE_URL: postgresql://localhost:5432/myapp
212
+ DEBUG: true
213
+ ```
214
+ </code></pre>
103
215
 
104
- Save execution output in saved output folder.
216
+ ### Link Blocks (Cross-Document Navigation)
217
+ <pre><code>```link
218
+ file: next-page.md
219
+ vars:
220
+ current_user: ${USER_NAME}
221
+ ```
222
+ </code></pre>
223
+
224
+ ### Data Blocks (YAML)
225
+ <pre><code>```yaml
226
+ users:
227
+ - name: John
228
+ role: admin
229
+ - name: Jane
230
+ role: user
231
+ ```
232
+ </code></pre>
105
233
 
106
- ## Behavior
234
+ ### Import Directives
235
+ ```
236
+ @import template.md USER_NAME=John ENVIRONMENT=production
237
+ ```
107
238
 
108
- * If no file and no folder are specified, blocks within `./README.md` are presented.
109
- * If a file is specified, its blocks are presented.
110
- * If a folder is specified, its files are presented. When a file is selected, its blocks are presented.
239
+ ### Options Blocks
240
+ <pre><code>```opts :(document_opts)
241
+ user_must_approve: true
242
+ save_executed_script: true
243
+ menu_ux_row_format: 'DEFAULT %{name} = ${%{name}}'
244
+ ```
245
+ </code></pre>
111
246
 
112
247
  ## Configuration
113
248
 
114
249
  ### Environment Variables
115
-
116
- When executed, `mde` reads the current environment.
117
- * Configuration in current and children shells, e.g. `export MDE_SAVE_EXECUTED_SCRIPT=1`.
118
- * Configuration for the current command, e.g. `MDE_SAVE_EXECUTED_SCRIPT=1 mde`.
250
+ <pre><code>```bash
251
+ export MDE_SAVE_EXECUTED_SCRIPT=1
252
+ export MDE_USER_MUST_APPROVE=1
253
+ ```
254
+ </code></pre>
119
255
 
120
256
  ### Configuration Files
257
+ <pre><code>```yaml
258
+ # .mde.yml
259
+ save_executed_script: true
260
+ user_must_approve: true
261
+ menu_with_inherited_lines: true
262
+ ```
263
+ </code></pre>
121
264
 
122
- * Configuration in all shells, e.g. environment variables set in your user's `~/.bashrc` or `~/.bash_profile` files.
123
- * Configuration in the optional file `.mde.yml` in the current folder. .e.g. `save_executed_script: true`
124
- * Configuration in a YAML file and read while parsing the inputs, e.g. `--config my_path/my_file.yml`
125
-
126
- ### Program Arguments
127
-
128
- * Configuration in command options, e.g. `mde --save-executed-script 1`
129
-
130
- ## Representing boolean values
131
-
132
- Boolean values expressed as strings are interpreted as:
133
- | String | Boolean |
134
- | :---: | :---: |
135
- | *empty string* | False |
136
- | `0` | False |
137
- | `1` | True |
138
- | *anything else* | True |
139
-
140
- E.g. `opt1=1` will set option `opt1` to True.
141
-
142
- Boolean options configured with environment variables:
143
- - Set to `1` or non-empty value to save executed scripts; empty or `0` to disable saving.
144
- e.g. `export MDE_SAVE_EXECUTED_SCRIPT=1`
145
- e.g. `export MDE_SAVE_EXECUTED_SCRIPT=`
146
- - Specify variable on command line.
147
- e.g. `MDE_SAVE_EXECUTED_SCRIPT=1 mde`
265
+ ### Command Line Options
266
+ ```bash
267
+ mde --save-executed-script 1 --user-must-approve 1 --config my-config.yml
268
+ ```
148
269
 
149
270
  ## Tab Completion
150
271
 
151
- ### Install tab completion
152
-
153
- Append a command to load the completion script to your shell configuration file. `mde` must be executable for the command to be composed correctly.
154
-
155
- ```bash :()
156
- echo "source $(mde --pwd)/bin/tab_completion.sh" >> ~/.bash_profile
157
- ```
272
+ See [Tab Completion Documentation](docs/tab-completion.md) for installation and usage instructions.
158
273
 
159
- ### Behavior
274
+ ## Example: Interactive Workflow
160
275
 
161
- Press tab for completions appropriate to the current input.
162
- `mde <...> <prior word> <current word><TAB>`
276
+ This example demonstrates a complete interactive workflow with UX blocks, dependencies, and cross-document navigation:
163
277
 
164
- Completions are calculated based on the current word and the prior word.
165
- 1. If the current word starts with `-`, present matching options, eg `--version` for the current word `--v`.
166
- 2. Else, if the current word is empty and the prior word is an option that takes an argument, present the type of the argument, eg `.BOOL.` for the option `--user-must-approve`.
167
- 3. Else, if the current word is the type of argument, from the rule above, present the default value for the option. e.g. `1` for the type `.BOOL.` for the option `--user-must-approve`.
168
- 4. Else, if the current word is non-empty, list matching files and folders.
169
-
170
- ### Example Completions
278
+ ### Step 1: User Input
279
+ <pre><code>```ux :user-setup
280
+ name: USER_NAME
281
+ prompt: Enter your name
282
+ init: Guest
283
+ ```
284
+ </code></pre>
285
+
286
+ <pre><code>```ux :environment
287
+ name: ENVIRONMENT
288
+ allow:
289
+ - development
290
+ - staging
291
+ - production
292
+ prompt: Select environment
293
+ ```
294
+ </code></pre>
171
295
 
172
- In the table below, tab is indicated by `!`
173
- | Input | Completions |
174
- | :--- | :--- |
175
- | `mde !` | local files and folders |
176
- | `mde -!` | all options |
177
- | `mde --!` | all options |
178
- | `mde --v!` | `mde --version` |
179
- | `mde --user-must-approve !` | `mde --user-must-approve .BOOL.`|
180
- | `mde --user-must-approve .BOOL.!` | `mde --user-must-approve 1` |
296
+ ### Step 2: Automated Setup
297
+ Prompts the user for both values and generates output.
298
+ <pre><code>```bash :setup +user-setup +environment
299
+ echo "Setting up for user: ${USER_NAME}"
300
+ echo "Environment: ${ENVIRONMENT}"
301
+ ```
302
+ </code></pre>
303
+
304
+ ### Step 3: Conditional Logic
305
+ <pre><code>```bash :deploy +setup
306
+ if [ "${ENVIRONMENT}" = "production" ]; then
307
+ echo "Deploying to production with extra safety checks"
308
+ else
309
+ echo "Deploying to ${ENVIRONMENT}"
310
+ fi
311
+ ```
312
+ </code></pre>
313
+
314
+ ### Step 4: Cross-Document Navigation
315
+ <pre><code>```link
316
+ file: next-workflow.md
317
+ vars:
318
+ user: ${USER_NAME}
319
+ env: ${ENVIRONMENT}
320
+ ```
321
+ </code></pre>
181
322
 
182
- ## Example Blocks
323
+ # Testing
183
324
 
184
- When prompted, select either the `awake` or `asleep` block.
325
+ ## Docker Testing Environment
185
326
 
186
- ``` :(day)
187
- export TIME=early
188
- ```
327
+ For a complete testing environment with all dependencies, use the Docker testing container:
189
328
 
190
- ``` :(night)
191
- export TIME=late
192
- ```
329
+ ```bash
330
+ # Build the test environment
331
+ docker build -f Dockerfile.test -t markdown-exec-test .
193
332
 
194
- ``` :awake +(day) +(report)
195
- export ACTIVITY=awake
196
- ```
333
+ # Run all tests (RSpec, Minitest, and BATS)
334
+ docker run -it markdown-exec-test bash -c 'bundle exec rake test'
197
335
 
198
- ``` :asleep +(night) +(report)
199
- export ACTIVITY=asleep
200
- ```
336
+ # Run individual test suites
337
+ docker run -it markdown-exec-test bash -c 'bundle exec rspec' # RSpec only
338
+ docker run -it markdown-exec-test bash -c 'bundle exec rake minitest' # Minitest only
339
+ docker run -it markdown-exec-test bash -c 'bundle exec rake bats' # BATS tests only
201
340
 
202
- ``` :(report)
203
- echo "$TIME -> $ACTIVITY"
341
+ # Enter the container interactively
342
+ docker run --rm -it markdown-exec-test bash
204
343
  ```
205
344
 
206
- # Testing
345
+ ## Local Testing
207
346
 
208
- Execute tests for individual libraries.
347
+ Execute tests for individual libraries locally:
209
348
 
210
349
  `bundle exec rake minitest`
211
350