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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +25 -0
- data/Dockerfile.test +42 -0
- data/Gemfile +1 -0
- data/Gemfile.lock +11 -1
- data/README.md +283 -144
- data/Rakefile +34 -26
- data/bats/block-type-shell-require-ux.bats +15 -0
- data/bats/block-type-ux-echo.bats +1 -1
- data/bats/block-type-ux-require-context.bats +14 -0
- data/bats/import-directive-line-continuation.bats +1 -1
- data/bats/import-directive-parameter-symbols.bats +1 -1
- data/bats/import-parameter-symbols.bats +1 -1
- data/bats/options.bats +2 -2
- data/bin/bmde +1 -1
- data/demo/trap.demo1.gif +0 -0
- data/demo/trap.demo1.mp4 +0 -0
- data/docs/dev/block-type-shell-require-ux.md +18 -0
- data/docs/dev/block-type-ux-echo.md +2 -1
- data/docs/dev/block-type-ux-format.md +10 -0
- data/docs/dev/block-type-ux-require-context.md +32 -0
- data/docs/dev/block-type-ux-require.md +8 -4
- data/docs/dev/import-directive-line-continuation.md +0 -1
- data/docs/dev/import-directive-parameter-symbols.md +0 -2
- data/docs/dev/import-parameter-symbols-template.md +7 -5
- data/docs/dev/import-parameter-symbols.md +10 -2
- data/docs/docker-testing.md +115 -0
- data/docs/tab-completion.md +33 -0
- data/examples/colors.md +31 -29
- data/lib/cached_nested_file_reader.rb +15 -47
- data/lib/collapser.rb +1 -1
- data/lib/command_result.rb +5 -5
- data/lib/constants.rb +3 -1
- data/lib/evaluate_shell_expressions.rb +1 -1
- data/lib/fcb.rb +7 -1
- data/lib/find_files.rb +1 -2
- data/lib/hash_delegator.rb +76 -32
- data/lib/input_sequencer.rb +1 -1
- data/lib/instance_method_wrapper.rb +1 -1
- data/lib/link_history.rb +1 -1
- data/lib/markdown_exec/version.rb +1 -1
- data/lib/markdown_exec.rb +1 -1
- data/lib/menu.src.yml +18 -8
- data/lib/menu.yml +14 -5
- data/lib/parameter_expansion.rb +918 -0
- data/lib/parse_animation_to_tts.rb +4417 -0
- data/lib/resize_terminal.rb +21 -32
- metadata +14 -2
data/Rakefile
CHANGED
|
@@ -77,25 +77,25 @@ end
|
|
|
77
77
|
def execute_with_error_handling(iterator)
|
|
78
78
|
all_error_level = 0
|
|
79
79
|
all_failed_files = []
|
|
80
|
-
|
|
80
|
+
|
|
81
81
|
iterator.each do |item|
|
|
82
82
|
command = yield(item)
|
|
83
83
|
next unless command # Skip if command is nil
|
|
84
|
-
|
|
85
|
-
|
|
84
|
+
|
|
85
|
+
system(command)
|
|
86
86
|
error_level = $?.exitstatus
|
|
87
87
|
|
|
88
|
-
|
|
89
|
-
puts "Error: Command '#{command}' failed with exit status #{error_level}."
|
|
90
|
-
all_error_level = error_level
|
|
91
|
-
all_failed_files << command
|
|
92
|
-
end
|
|
93
|
-
end
|
|
88
|
+
next unless error_level != 0
|
|
94
89
|
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
90
|
+
puts "Error: Command '#{command}' failed with exit status #{error_level}."
|
|
91
|
+
all_error_level = error_level
|
|
92
|
+
all_failed_files << command
|
|
98
93
|
end
|
|
94
|
+
|
|
95
|
+
return unless all_error_level != 0
|
|
96
|
+
|
|
97
|
+
puts "Error: #{all_failed_files.join(', ')} failed."
|
|
98
|
+
exit all_error_level
|
|
99
99
|
end
|
|
100
100
|
|
|
101
101
|
desc 'bats'
|
|
@@ -114,20 +114,28 @@ task :listtests do
|
|
|
114
114
|
puts `find lib -name '*.rb' -type f | xargs grep '< Minitest::Test' -l | sort`
|
|
115
115
|
end
|
|
116
116
|
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
'./lib/cached_nested_file_reader.rb --verbose',
|
|
123
|
-
'./lib/collapser.rb --verbose',
|
|
117
|
+
def dev_test_commands
|
|
118
|
+
dev_dir = File.join(__dir__, 'lib', 'dev')
|
|
119
|
+
return [] unless Dir.exist?(dev_dir)
|
|
120
|
+
|
|
121
|
+
[
|
|
124
122
|
'./lib/dev/ansi_codes.rb --verbose',
|
|
125
123
|
'./lib/dev/append_to_bash_history.rb --verbose',
|
|
126
124
|
'./lib/dev/generate_transition_codes.rb --verbose',
|
|
127
125
|
'./lib/dev/hierarchy.rb --verbose',
|
|
128
126
|
'./lib/dev/process_command.rb --verbose',
|
|
129
127
|
'./lib/dev/process_template.rb --test --verbose',
|
|
130
|
-
'./lib/dev/visibility-controller.rb --verbose'
|
|
128
|
+
'./lib/dev/visibility-controller.rb --verbose'
|
|
129
|
+
]
|
|
130
|
+
end
|
|
131
|
+
|
|
132
|
+
desc 'minitest'
|
|
133
|
+
task :minitest do
|
|
134
|
+
commands = dev_test_commands + [
|
|
135
|
+
'./lib/argument_processor.rb --verbose',
|
|
136
|
+
'./lib/block_label.rb --verbose',
|
|
137
|
+
'./lib/cached_nested_file_reader.rb --verbose',
|
|
138
|
+
'./lib/collapser.rb --verbose',
|
|
131
139
|
'./lib/directory_searcher.rb --verbose',
|
|
132
140
|
'./lib/evaluate_shell_expressions.rb --verbose',
|
|
133
141
|
'./lib/fcb.rb --verbose',
|
|
@@ -164,26 +172,26 @@ end
|
|
|
164
172
|
desc 'test'
|
|
165
173
|
task :test do
|
|
166
174
|
success = true
|
|
167
|
-
|
|
175
|
+
|
|
168
176
|
# Run all tests and track failures
|
|
169
177
|
rspec_success = system('bundle exec rspec')
|
|
170
178
|
success = false unless rspec_success
|
|
171
|
-
|
|
179
|
+
|
|
172
180
|
Rake::Task['minitest'].invoke
|
|
173
181
|
minitest_success = $?.success?
|
|
174
182
|
success = false unless minitest_success
|
|
175
|
-
|
|
183
|
+
|
|
176
184
|
Rake::Task['bats'].invoke
|
|
177
185
|
bats_success = $?.success?
|
|
178
186
|
success = false unless bats_success
|
|
179
|
-
|
|
187
|
+
|
|
180
188
|
# Report failures and exit with non-zero status if any test failed
|
|
181
189
|
unless success
|
|
182
190
|
failed_tests = []
|
|
183
191
|
failed_tests << 'RSpec' unless rspec_success
|
|
184
192
|
failed_tests << 'Minitest' unless minitest_success
|
|
185
193
|
failed_tests << 'Bats' unless bats_success
|
|
186
|
-
|
|
194
|
+
|
|
187
195
|
puts "\nThe following test suites failed: #{failed_tests.join(', ')}"
|
|
188
196
|
exit 1
|
|
189
197
|
end
|
|
@@ -213,7 +221,7 @@ task :update_menu_yml do
|
|
|
213
221
|
File.write(MENU_YML, menu_options.to_yaml)
|
|
214
222
|
puts `stat #{MENU_YML}`
|
|
215
223
|
end
|
|
216
|
-
task :
|
|
224
|
+
task menu: 'update_menu_yml'
|
|
217
225
|
|
|
218
226
|
# write tab_completion.sh with erb
|
|
219
227
|
#
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
#!/usr/bin/env bats
|
|
2
|
+
|
|
3
|
+
load 'test_helper'
|
|
4
|
+
|
|
5
|
+
@test 'initial' {
|
|
6
|
+
spec_mde_xansi_dname_doc_blocks_expect docs/dev/block-type-shell-require-ux.md \
|
|
7
|
+
'require-a-UX-block__FULL_NAME='
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
@test 'activated' {
|
|
11
|
+
# 2025-11-13 add a '.' block to force the display to update
|
|
12
|
+
spec_mde_xansi_dname_doc_blocks_expect docs/dev/block-type-shell-require-ux.md \
|
|
13
|
+
require-a-UX-block . \
|
|
14
|
+
'__require-a-UX-block_Mythical_Monkey_FULL_NAME=Mythical Monkey'
|
|
15
|
+
}
|
|
@@ -16,5 +16,5 @@ load 'test_helper'
|
|
|
16
16
|
@test 'selected block - output of wc includes whitespace' {
|
|
17
17
|
spec_mde_xansi_dname_doc_blocks_expect docs/dev/block-type-ux-echo.md \
|
|
18
18
|
'(VAR_has_count)' '[IAB_has_count]' \
|
|
19
|
-
'VAR=
|
|
19
|
+
'VAR=mmaarrkkddoowwnn__eexxeecc_IAB=mmaarrkkddoowwnn__eexxeeccmmaarrkkddoowwnn__eexxeecc'
|
|
20
20
|
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
#!/usr/bin/env bats
|
|
2
|
+
|
|
3
|
+
load 'test_helper'
|
|
4
|
+
|
|
5
|
+
@test 'initial' {
|
|
6
|
+
spec_mde_xansi_dname_doc_blocks_expect docs/dev/block-type-ux-require-context.md \
|
|
7
|
+
'Get the common name..._Entity: _ENTITY2: _UX1: _Common name: '
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
@test 'activated' {
|
|
11
|
+
spec_mde_xansi_dname_doc_blocks_expect docs/dev/block-type-ux-require-context.md \
|
|
12
|
+
\[ux1\] \
|
|
13
|
+
'Get the common name..._Entity: _ENTITY2: Mythical Monkey_UX1: Mythical Monkey_Common name: Mythical Monkey'
|
|
14
|
+
}
|
|
@@ -5,5 +5,5 @@ load 'test_helper'
|
|
|
5
5
|
@test '' {
|
|
6
6
|
spec_mde_xansi_dname_doc_blocks_expect docs/dev/import-directive-parameter-symbols.md \
|
|
7
7
|
--blocks dname \
|
|
8
|
-
'Stem: U1_Species: Illacme
|
|
8
|
+
'Stem: U1_Species: Illacme tobini_Stem: U2_Species: Hydrodynastes bicinctus'
|
|
9
9
|
}
|
|
@@ -4,5 +4,5 @@ load 'test_helper'
|
|
|
4
4
|
|
|
5
5
|
@test 'Initial values' {
|
|
6
6
|
spec_mde_xansi_dname_doc_blocks_expect docs/dev/import-parameter-symbols.md \
|
|
7
|
-
'COMMON_NAME=Tapanuli
|
|
7
|
+
'COMMON_NAME=Tapanuli Orangutan_Evaluated expression: Tapanuli Orangutan_echo "Evaluated expression: $(printf %s "$COMMON_NAME")"__Raw literal: Tapanuli Orangutan_echo "Raw literal: Tapanuli Orangutan"__Force-quoted literal: Tapanuli Orangutan_echo "Force-quoted literal: Tapanuli Orangutan"__Variable reference: Tapanuli Orangutan_echo "Variable reference: ${COMMON_NAME}"'
|
|
8
8
|
}
|
data/bats/options.bats
CHANGED
|
@@ -30,13 +30,13 @@ load 'test_helper'
|
|
|
30
30
|
@test 'Options - list blocks' {
|
|
31
31
|
BATS_OUTPUT_FILTER=A
|
|
32
32
|
spec_mde_args_expect --list-blocks-message oname --list-blocks-type 0 examples/colors.md --list-blocks \
|
|
33
|
-
'load_colors load_colors2
|
|
33
|
+
'load_colors load_colors2 Unspecified1 Unknown1 Bash1 Edit-inherited-blocks History1 Link1 Load1 Opts1 Port1 Save1 Vars1'
|
|
34
34
|
}
|
|
35
35
|
|
|
36
36
|
@test 'Options - list blocks, eval' {
|
|
37
37
|
BATS_OUTPUT_FILTER=A
|
|
38
38
|
spec_mde_args_expect --list-blocks-eval block.oname examples/colors.md --list-blocks \
|
|
39
|
-
'load_colors load_colors2
|
|
39
|
+
'load_colors load_colors2 Unspecified1 Unknown1 Bash1 Edit-inherited-blocks History1 Link1 Load1 Opts1 Port1 Save1 Vars1'
|
|
40
40
|
}
|
|
41
41
|
|
|
42
42
|
@test 'Options - how' {
|
data/bin/bmde
CHANGED
data/demo/trap.demo1.gif
ADDED
|
Binary file
|
data/demo/trap.demo1.mp4
ADDED
|
Binary file
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/ No blocks are evaluated at initialization.
|
|
2
|
+
/ When the shell block is activated, the UX block is required.
|
|
3
|
+
```bash :require-a-UX-block +[ux1]
|
|
4
|
+
ENTITY='Mythical Monkey'
|
|
5
|
+
```
|
|
6
|
+
/ Display variables set in the UX block.
|
|
7
|
+
${FIRST}
|
|
8
|
+
${LAST}
|
|
9
|
+
/ Parse and copy the name into variables.
|
|
10
|
+
```ux :[ux1]
|
|
11
|
+
echo:
|
|
12
|
+
FIRST: '${ENTITY%% *}'
|
|
13
|
+
LAST: '${ENTITY##* }'
|
|
14
|
+
FULL_NAME: '$ENTITY'
|
|
15
|
+
init: false
|
|
16
|
+
readonly: true
|
|
17
|
+
```
|
|
18
|
+
@import bats-document-configuration.md
|
|
@@ -10,7 +10,8 @@ menu_with_inherited_lines: true
|
|
|
10
10
|
/ This block is not visible. Execute to set a new value, displayed by the block above.
|
|
11
11
|
```ux :(VAR_has_count)
|
|
12
12
|
init: false
|
|
13
|
-
echo:
|
|
13
|
+
echo: >-
|
|
14
|
+
$(basename `pwd` | sed 's/./&&/g')
|
|
14
15
|
force: false
|
|
15
16
|
name: VAR
|
|
16
17
|
```
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/ Neither block is evaluated at initialization.
|
|
2
|
+
/ When the first UX block is activated, it is evaluated.
|
|
3
|
+
/ The variable set in the first UX block is available to the second,
|
|
4
|
+
/ which is required by the first, resulting in its evaluation.
|
|
5
|
+
```ux :[ux1] +[ux2] +(ENTITY)
|
|
6
|
+
act: :echo
|
|
7
|
+
echo:
|
|
8
|
+
UX1: '$ENTITY'
|
|
9
|
+
format: |-
|
|
10
|
+
Get the common name...
|
|
11
|
+
init: false
|
|
12
|
+
```
|
|
13
|
+
/ The shell required code and the first evaluated UX block are the context
|
|
14
|
+
/ when the the `echo` expressions are being evaluated in the second UX block.
|
|
15
|
+
/ The first evaluated UX block is the context when the `format` value is being expanded.
|
|
16
|
+
```ux :[ux2]
|
|
17
|
+
act: :echo
|
|
18
|
+
echo:
|
|
19
|
+
UX2: '$UX1'
|
|
20
|
+
ENTITY2: '$ENTITY'
|
|
21
|
+
format: |-
|
|
22
|
+
Entity: ${ENTITY}
|
|
23
|
+
ENTITY2: ${ENTITY2}
|
|
24
|
+
UX1: ${UX1}
|
|
25
|
+
Common name: ${UX2}
|
|
26
|
+
init: false
|
|
27
|
+
readonly: true
|
|
28
|
+
```
|
|
29
|
+
```bash :(ENTITY)
|
|
30
|
+
ENTITY='Mythical Monkey'
|
|
31
|
+
```
|
|
32
|
+
@import bats-document-configuration.md
|
|
@@ -1,7 +1,3 @@
|
|
|
1
|
-
/ This is an hidden shell block that is required by UX blocks.
|
|
2
|
-
``` :(shell)
|
|
3
|
-
ENTITY='Pongo tapanuliensis,Pongo'
|
|
4
|
-
```
|
|
5
1
|
```ux +(shell)
|
|
6
2
|
echo: "${ENTITY%%,*}"
|
|
7
3
|
force: true
|
|
@@ -24,6 +20,14 @@ echo: "$NAME"
|
|
|
24
20
|
force: true
|
|
25
21
|
name: NAME2
|
|
26
22
|
```
|
|
23
|
+
/
|
|
24
|
+
/ This is a hidden shell block that is required by a UX block.
|
|
25
|
+
/ All shell blocks required by a UX block are collected in a sequence
|
|
26
|
+
/ that is the context for the evaluation of the expressions in the UX block.
|
|
27
|
+
``` :(shell)
|
|
28
|
+
ENTITY='Pongo tapanuliensis,Pongo'
|
|
29
|
+
```
|
|
30
|
+
/
|
|
27
31
|
/ This block is not visible. Execute to display the inherited lines for testing.
|
|
28
32
|
```opts :(menu_with_inherited_lines)
|
|
29
33
|
menu_with_inherited_lines: true
|
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
/ use MDE 3.3.0 import parameter symbols
|
|
2
2
|
/
|
|
3
3
|
@import ./import/parameter-symbols.md __PS_STEM_SPECIES:q='Illacme tobini' __PS_STEM_GENUS:q=Illacme PS_STEM=U1
|
|
4
|
-
Genus: ${__U1_GENUS}
|
|
5
4
|
/
|
|
6
5
|
@import ./import/parameter-symbols.md __PS_STEM_SPECIES:q='Hydrodynastes bicinctus' __PS_STEM_GENUS:q=Hydrodynastes PS_STEM=U2
|
|
7
|
-
Genus: ${__U2_GENUS}
|
|
8
6
|
/
|
|
9
7
|
@import ./bats-document-configuration.md
|
|
@@ -1,8 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
/ 2025-11-13 the name of the variable generated
|
|
2
|
+
/ changes on every load is not predictable
|
|
3
|
+
/**Command substitution:** `NAMEC`
|
|
4
|
+
/```bash
|
|
5
|
+
/echo "Command substitution: NAMEC"
|
|
6
|
+
/```
|
|
7
|
+
/
|
|
6
8
|
**Evaluated expression:** `NAMEE`
|
|
7
9
|
```bash
|
|
8
10
|
echo "Evaluated expression: NAMEE"
|
|
@@ -2,5 +2,13 @@
|
|
|
2
2
|
echo: Tapanuli Orangutan
|
|
3
3
|
name: COMMON_NAME
|
|
4
4
|
```
|
|
5
|
-
@import import-parameter-symbols-template.md
|
|
6
|
-
|
|
5
|
+
@import import-parameter-symbols-template.md \
|
|
6
|
+
NAMEC:cq='printf %s "$COMMON_NAME"' \
|
|
7
|
+
NAMEE:eq=$COMMON_NAME \
|
|
8
|
+
NAMEL="Tapanuli Orangutan" \
|
|
9
|
+
NAMEQ:qq="Tapanuli Orangutan" \
|
|
10
|
+
NAMEV:vq=COMMON_NAME
|
|
11
|
+
@import bats-document-configuration.md
|
|
12
|
+
```opts :(document_opts)
|
|
13
|
+
dump_inherited_lines: false
|
|
14
|
+
```
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
# Docker Testing Environment
|
|
2
|
+
|
|
3
|
+
This document describes how to use the Docker testing environment for `markdown_exec`.
|
|
4
|
+
|
|
5
|
+
## Overview
|
|
6
|
+
|
|
7
|
+
The `Dockerfile.ruby-3.3-spec` provides a complete testing environment with:
|
|
8
|
+
- Ruby 3.3 on Debian Bookworm
|
|
9
|
+
- All build dependencies
|
|
10
|
+
- Git submodules initialized (BATS testing framework)
|
|
11
|
+
- Development tools and aliases
|
|
12
|
+
- Pre-configured BATS test setup
|
|
13
|
+
|
|
14
|
+
## Building the Image
|
|
15
|
+
|
|
16
|
+
```bash
|
|
17
|
+
docker build -f Dockerfile.test -t markdown-exec-test .
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
You can specify a different Git branch to test:
|
|
21
|
+
|
|
22
|
+
```bash
|
|
23
|
+
docker build -f Dockerfile.test --build-arg GIT_BRANCH=develop -t markdown-exec-test .
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
## Running Tests
|
|
27
|
+
|
|
28
|
+
### Run all BATS tests
|
|
29
|
+
|
|
30
|
+
```bash
|
|
31
|
+
docker run --rm markdown-exec-test bats test/
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
### Run specific test file
|
|
35
|
+
|
|
36
|
+
```bash
|
|
37
|
+
docker run --rm markdown-exec-test bats test/options.bats
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
### Run with verbose output
|
|
41
|
+
|
|
42
|
+
```bash
|
|
43
|
+
docker run --rm markdown-exec-test batsv test/
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
The container includes the `batsv` alias for verbose BATS output.
|
|
47
|
+
|
|
48
|
+
## Interactive Development
|
|
49
|
+
|
|
50
|
+
### Enter the container interactively
|
|
51
|
+
|
|
52
|
+
```bash
|
|
53
|
+
docker run --rm -it markdown-exec-test bash
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
Once inside, you have access to:
|
|
57
|
+
- `bats` - BATS test runner (available in PATH)
|
|
58
|
+
- `batsv` - Verbose BATS runner (alias)
|
|
59
|
+
- `be` - Bundle exec alias
|
|
60
|
+
- `bmde` - Bin/bmde alias
|
|
61
|
+
- `ll` - Enhanced ls alias
|
|
62
|
+
|
|
63
|
+
### Mount local directory for development
|
|
64
|
+
|
|
65
|
+
To work with your local code changes:
|
|
66
|
+
|
|
67
|
+
```bash
|
|
68
|
+
docker run --rm -it -v "$(pwd)":/markdown_exec markdown-exec-test bash
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
**Note:** The container clones the repo by default. When mounting your local directory, you may need to adjust paths or rebuild dependencies.
|
|
72
|
+
|
|
73
|
+
## Running Minitest
|
|
74
|
+
|
|
75
|
+
```bash
|
|
76
|
+
docker run --rm markdown-exec-test bundle exec rake minitest
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
## Container Details
|
|
80
|
+
|
|
81
|
+
- **Working Directory**: `/markdown_exec`
|
|
82
|
+
- **Base Image**: `ruby:3.3-bookworm`
|
|
83
|
+
- **BATS Location**: `/markdown_exec/test/bats/bin/bats` (symlinked to `/usr/local/bin/bats`)
|
|
84
|
+
- **Test Helpers**: Located in `/markdown_exec/test/test_helper/`
|
|
85
|
+
|
|
86
|
+
## Troubleshooting
|
|
87
|
+
|
|
88
|
+
### Submodules not initialized
|
|
89
|
+
|
|
90
|
+
If you encounter issues with BATS submodules, the Dockerfile should handle this automatically. If problems persist:
|
|
91
|
+
|
|
92
|
+
```bash
|
|
93
|
+
docker run --rm -it markdown-exec-test bash
|
|
94
|
+
cd /markdown_exec
|
|
95
|
+
git submodule update --init --recursive
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
### Missing test files
|
|
99
|
+
|
|
100
|
+
The container creates required directories and test files. If tests fail due to missing files, check that the Dockerfile build completed successfully.
|
|
101
|
+
|
|
102
|
+
### Running tests with local changes
|
|
103
|
+
|
|
104
|
+
For testing local changes without rebuilding:
|
|
105
|
+
|
|
106
|
+
1. Build the base image once
|
|
107
|
+
2. Use volume mounting to overlay your local code
|
|
108
|
+
3. Re-run bundle install if dependencies changed:
|
|
109
|
+
|
|
110
|
+
```bash
|
|
111
|
+
docker run --rm -it -v "$(pwd)":/markdown_exec markdown-exec-test bash
|
|
112
|
+
bundle install
|
|
113
|
+
bats test/
|
|
114
|
+
```
|
|
115
|
+
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
# Tab Completion
|
|
2
|
+
|
|
3
|
+
## Install tab completion
|
|
4
|
+
|
|
5
|
+
Append a command to load the completion script to your shell configuration file. `mde` must be executable for the command to be composed correctly.
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
echo "source $(mde --pwd)/bin/tab_completion.sh" >> ~/.bash_profile
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Behavior
|
|
12
|
+
|
|
13
|
+
Press tab for completions appropriate to the current input.
|
|
14
|
+
`mde <...> <prior word> <current word><TAB>`
|
|
15
|
+
|
|
16
|
+
Completions are calculated based on the current word and the prior word.
|
|
17
|
+
1. If the current word starts with `-`, present matching options, eg `--version` for the current word `--v`.
|
|
18
|
+
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`.
|
|
19
|
+
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`.
|
|
20
|
+
4. Else, if the current word is non-empty, list matching files and folders.
|
|
21
|
+
|
|
22
|
+
## Example Completions
|
|
23
|
+
|
|
24
|
+
In the table below, tab is indicated by `!`
|
|
25
|
+
| Input | Completions |
|
|
26
|
+
| :--- | :--- |
|
|
27
|
+
| `mde !` | local files and folders |
|
|
28
|
+
| `mde -!` | all options |
|
|
29
|
+
| `mde --!` | all options |
|
|
30
|
+
| `mde --v!` | `mde --version` |
|
|
31
|
+
| `mde --user-must-approve !` | `mde --user-must-approve .BOOL.`|
|
|
32
|
+
| `mde --user-must-approve .BOOL.!` | `mde --user-must-approve 1` |
|
|
33
|
+
|
data/examples/colors.md
CHANGED
|
@@ -1,27 +1,19 @@
|
|
|
1
1
|
# Demo configuring options
|
|
2
|
-
|
|
2
|
+
/ v2025-09-30
|
|
3
3
|
::: These Opts blocks set the color for all elements.
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
/
|
|
8
|
-
/
|
|
9
|
-
/
|
|
10
|
-
/
|
|
11
|
-
/ 00ff00 green - prompt
|
|
12
|
-
/ 00ff7f spring green - input frame
|
|
13
|
-
/ 00ffff cyan - menu text
|
|
14
|
-
/ 007fff azure - menu frame
|
|
15
|
-
/ 0000ff blue
|
|
16
|
-
/ 7f00ff violet - opts frame
|
|
17
|
-
/ ff00ff magenta - opts text
|
|
18
|
-
/ ff007f rose - exception frame
|
|
19
|
-
|
|
4
|
+
/ blue fg_rgbh_00_00_FF
|
|
5
|
+
/ green fg_rgbh_00_FF_00
|
|
6
|
+
/ indigo fg_rgbh_4B_00_82
|
|
7
|
+
/ orange fg_rgbh_FF_7F_00
|
|
8
|
+
/ red fg_rgbh_FF_00_00
|
|
9
|
+
/ violet fg_rgbh_94_00_D3
|
|
10
|
+
/ yellow fg_rgbh_FF_FF_00
|
|
20
11
|
```opts :load_colors
|
|
21
12
|
exception_color_detail: fg_rgbh_1f_00_7f
|
|
22
13
|
exception_color_name: fg_rgbh_1f_00_00
|
|
23
14
|
execution_report_preview_frame_color: fg_rgbh_7f_1f_00
|
|
24
15
|
menu_bash_color: fg_rgbh_00_c0_c0
|
|
16
|
+
menu_block_color: fg_rgbh_47_ce_eb
|
|
25
17
|
menu_chrome_color: fg_rgbh_40_c0_c0
|
|
26
18
|
menu_divider_color: fg_rgbh_80_d0_c0
|
|
27
19
|
menu_edit_color: fg_rgbh_e0_e0_20
|
|
@@ -44,11 +36,13 @@ script_preview_frame_color: fg_rgbh_7f_1f_00
|
|
|
44
36
|
warning_color: fg_rgbh_1f_7f_00
|
|
45
37
|
```
|
|
46
38
|
|
|
39
|
+
/ more green, less blue
|
|
47
40
|
```opts :load_colors2
|
|
48
41
|
exception_color_detail: fg_rgbh_ff_00_7f
|
|
49
42
|
exception_color_name: fg_rgbh_ff_00_00
|
|
50
43
|
execution_report_preview_frame_color: fg_rgbh_7f_ff_00
|
|
51
44
|
menu_bash_color: fg_rgbh_00_c0_c0
|
|
45
|
+
menu_block_color: fg_rgbh_47_fe_bb
|
|
52
46
|
menu_chrome_color: fg_rgbh_40_c0_c0
|
|
53
47
|
menu_divider_color: fg_rgbh_80_d0_c0
|
|
54
48
|
menu_edit_color: fg_rgbh_e2_e2_20
|
|
@@ -72,12 +66,18 @@ script_preview_frame_color: fg_rgbh_7f_ff_00
|
|
|
72
66
|
warning_color: fg_rgbh_ff_7f_00
|
|
73
67
|
```
|
|
74
68
|
|
|
75
|
-
:::
|
|
69
|
+
::: Divider color
|
|
70
|
+
|
|
71
|
+
::: Fenced code blocks of different types
|
|
72
|
+
Each block has a name. Its name is decorated according to the type of the block.
|
|
73
|
+
``` :Unspecified1
|
|
76
74
|
```
|
|
75
|
+
```unknown :Unknown1
|
|
77
76
|
```
|
|
78
77
|
```bash :Bash1
|
|
79
78
|
```
|
|
80
|
-
|
|
79
|
+
/ Chrome decoration
|
|
80
|
+
```edit :Edit-inherited-blocks
|
|
81
81
|
```
|
|
82
82
|
```history :History1
|
|
83
83
|
```
|
|
@@ -85,20 +85,22 @@ warning_color: fg_rgbh_ff_7f_00
|
|
|
85
85
|
```
|
|
86
86
|
```load :Load1
|
|
87
87
|
```
|
|
88
|
+
/ Note decoration
|
|
89
|
+
A Note
|
|
90
|
+
/ Opts decoration
|
|
88
91
|
```opts :Opts1
|
|
89
92
|
```
|
|
90
93
|
```port :Port1
|
|
91
94
|
```
|
|
95
|
+
/ Save decoration
|
|
92
96
|
```save :Save1
|
|
93
97
|
```
|
|
94
|
-
|
|
98
|
+
/ Task decoration
|
|
99
|
+
[ ] Task
|
|
100
|
+
/ UX decoration
|
|
101
|
+
```ux
|
|
102
|
+
format: UX-1
|
|
95
103
|
```
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
/ green; fg_rgbh_00_FF_00
|
|
100
|
-
/ indigo; fg_rgbh_4B_00_82
|
|
101
|
-
/ orange; fg_rgbh_FF_7F_00
|
|
102
|
-
/ red; fg_rgbh_FF_00_00
|
|
103
|
-
/ violet; fg_rgbh_94_00_D3
|
|
104
|
-
/ yellow; fg_rgbh_FF_FF_00
|
|
104
|
+
/ Vars decoration
|
|
105
|
+
```vars :Vars1
|
|
106
|
+
```
|