@@ -36,10 +36,15 @@ within the test, ready for rendering in the docs.
36
36
37
37
## install
38
38
Something like:
39
- ` git clone ARMmbed/snippet `
40
-
41
- Then:
42
- ` pip install -e path/to/snippet `
39
+ ```
40
+ git clone ARMmbed/snippet
41
+ pip install -e path/to/snippet
42
+ ```
43
+ or directly (with ` pip ` >10 environment variables can be unpacked):
44
+ ```
45
+ python -m pip install -U pip>10
46
+ pip install git+https://${GH_TOKEN}@github.com/ARMmbed/snippet.git#egg=snippet
47
+ ```
43
48
44
49
## configure
45
50
Place a config file in the [ toml format] ( https://github.com/toml-lang/toml )
@@ -173,3 +178,50 @@ Some of the checks include:
173
178
- Tag open / close matches (avoiding nested examples or cloaks)
174
179
- Examples left unterminated
175
180
- Indents reducing beyond the start level for the current example
181
+
182
+ ## notable config options
183
+
184
+ Any parameter in the default configuration can be overridden.
185
+
186
+ Some notable entries include:
187
+
188
+ - ` language_name ` passed to the output template; can improve markdown rendering
189
+ in syntax-aware renderers
190
+ - ` drop_lines ` for removing entire lines containing these exact matches
191
+ - ` replacements ` for globally replacing exact matches
192
+
193
+ ``` python
194
+ # IO
195
+ project_root = ' .' # the project root used for relative IO paths (set by commandline)
196
+ input_glob = ' tests/example/*.py'
197
+ output_append = True # if the output file exists, append to it
198
+ output_dir = ' .'
199
+ output_file_name_template = ' {{ name}} .md' # a mustache template for the output file name
200
+ write_attempts = 3 # number of retries when writing output files
201
+
202
+ # Language and style
203
+ language_name = ' python'
204
+ comment_prefix = ' # '
205
+ comment_suffix = ' '
206
+ # a mustache template for each file (triple braces important for code literals, no escaping)
207
+ output_template = ' ```{{ language_name}} \n {{ comment_prefix}} example: {{{name}}}{{ comment_suffix}} \n {{{code}}} \n ```\n '
208
+
209
+ # Logger
210
+ log_level = logging.INFO
211
+
212
+ # Code block indicators
213
+ start_flag = ' an example'
214
+ end_flag = ' end of example'
215
+
216
+ # Hidden block indicators
217
+ cloak_flag = ' cloak'
218
+ uncloak_flag = ' uncloak'
219
+
220
+ # Validation and formatting logic
221
+ drop_lines = [] # drop lines containing these phrases
222
+ replacements = {' self.' : ' ' } # straightforward replacements
223
+ fail_on_contains = [' assert' ] # fail if these strings are found in code blocks
224
+ auto_dedent = True # keep code left-aligned with the start flag
225
+ fail_on_dedent = True # fail if code is dedented before reaching the end flag
226
+ stop_on_first_failure = False # fail early
227
+ ```
0 commit comments