Skip to content

Commit 46d995e

Browse files
committed
Normalize code blocks
- console lexer for anything that is a console session - some other specialized lexers when it makes sense - always with prompt, when in a console session, or for commands that are meant to be executed Closes #1013
1 parent f76aad7 commit 46d995e

39 files changed

+262
-262
lines changed

docs/basics/101-101-create.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ and create a fresh, empty dataset with the :dlcmd:`create` command.
2727

2828
Note the command structure of :dlcmd:`create` (optional bits are enclosed in ``[ ]``):
2929

30-
.. code-block:: bash
30+
.. code-block::
3131
3232
datalad create [--description "..."] [-c <config options>] PATH
3333
@@ -39,9 +39,9 @@ Note the command structure of :dlcmd:`create` (optional bits are enclosed in ``[
3939
The optional ``--description`` flag allows you to provide a short description of
4040
the *location* of your dataset, for example with
4141

42-
.. code-block:: bash
42+
.. code-block:: console
4343
44-
datalad create --description "course on DataLad-101 on my private laptop" -c text2git DataLad-101
44+
$ datalad create --description "course on DataLad-101 on my private laptop" -c text2git DataLad-101
4545
4646
If you want, use the above command instead of the :dlcmd:`create` command below
4747
to provide a description. Its use will not be immediately clear, the chapter

docs/basics/101-105-install.rst

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -121,18 +121,18 @@ chapters in this handbook will demonstrate how useful this information can be.
121121
point to root of the top-most dataset. For example, if you navigate into ``recordings``,
122122
the command would be:
123123

124-
.. code-block:: bash
124+
.. code-block:: console
125125
126-
datalad clone -d^ https://github.com/datalad-datasets/longnow-podcasts.git longnow
126+
$ datalad clone -d^ https://github.com/datalad-datasets/longnow-podcasts.git longnow
127127
128128
.. find-out-more:: What if I do not install into an existing dataset?
129129

130130
If you do not install into an existing dataset, you only need to omit the ``-d/--dataset``
131131
option. You can try:
132132

133-
.. code-block:: bash
133+
.. code-block:: console
134134
135-
datalad clone https://github.com/datalad-datasets/longnow-podcasts.git
135+
$ datalad clone https://github.com/datalad-datasets/longnow-podcasts.git
136136
137137
anywhere outside of your ``DataLad-101`` dataset to install the podcast dataset into a new directory
138138
called ``longnow-podcasts``. You could even do this inside of an existing dataset.
@@ -266,7 +266,7 @@ Try to open it -- it will now work.
266266
If you would want to get the rest of the missing data, instead of specifying all files individually,
267267
we can use ``.`` to refer to *all* of the dataset like this:
268268

269-
.. code-block:: bash
269+
.. code-block:: console
270270
271271
$ datalad get .
272272

docs/basics/101-106-nesting.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ we can set subdatasets to previous states, or *update* them.
110110
Thus, from the root of ``DataLad-101``, this command would have given you the
111111
subdataset's history as well:
112112

113-
.. code-block:: bash
113+
.. code-block:: console
114114
115115
$ git -C recordings/longnow log --oneline
116116

docs/basics/101-107-summary.rst

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@ and making simple modifications *locally*.
88
to the dataset and use the ``-c text2git`` configuration, but we will see later why.
99
This is the command structure:
1010

11-
.. code-block:: bash
11+
.. code-block:: console
1212
13-
datalad create --description "here is a description" -c text2git PATH
13+
$ datalad create --description "here is a description" -c text2git PATH
1414
1515
* Thanks to :term:`Git` and :term:`git-annex`, the dataset has a history to track files and their
1616
modifications. Built-in Git tools (:gitcmd:`log`) or external tools (such as ``tig``) allow to explore
@@ -23,9 +23,9 @@ and making simple modifications *locally*.
2323
specifying a path, all untracked files and all file changes will be committed to the history together!
2424
This is the command structure:
2525

26-
.. code-block:: bash
26+
.. code-block:: console
2727
28-
datalad save -m "here is a commit message" [PATH]
28+
$ datalad save -m "here is a commit message" [PATH]
2929
3030
* The typical local workflow is simple: *Modify* the dataset by adding or
3131
modifying files, *save* the changes as meaningful units to the history,
@@ -53,7 +53,7 @@ and experienced the concept of modular nesting datasets.
5353

5454
* A published dataset can be installed with the :dlcmd:`clone` command:
5555

56-
.. code-block:: bash
56+
.. code-block:: console
5757
5858
$ datalad clone [--dataset PATH] SOURCE-PATH/URL [DESTINATION PATH]
5959

docs/basics/101-109-rerun.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,9 +77,9 @@ We can use the shorthand "BF" to denote "Bug fix" in the commit message.
7777
What we *could* do is run the same :dlcmd:`run` command as before to recreate
7878
the file, but now with all of the contents:
7979

80-
.. code-block:: bash
80+
.. code-block:: console
8181
82-
# do not execute this!
82+
$ # do not execute this!
8383
$ datalad run -m "create a list of podcast titles" \
8484
"bash code/list_titles.sh > recordings/podcasts.tsv"
8585

docs/basics/101-110-run2.rst

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -154,9 +154,9 @@ specifying inputs even though they are already present will not do any harm.
154154
Often, a command needs several inputs. In principle, every input (which could be files, directories, or subdatasets) gets its own ``-i``/``--input``
155155
flag. However, you can make use of :term:`globbing`. For example,
156156

157-
.. code-block:: bash
157+
.. code-block:: console
158158
159-
datalad run --input "*.jpg" "COMMAND"
159+
$ datalad run --input "*.jpg" "COMMAND"
160160
161161
will retrieve all ``.jpg`` files prior to command execution.
162162

@@ -415,7 +415,7 @@ for inputs and outputs. This is how it works:
415415

416416
Instead of running
417417

418-
.. code-block:: bash
418+
.. code-block:: console
419419
420420
$ datalad run -m "Resize logo for slides" \
421421
--input "recordings/longnow/.datalad/feed_metadata/logo_interval.jpg" \
@@ -424,7 +424,7 @@ Instead of running
424424
425425
you could shorten this to
426426

427-
.. code-block:: bash
427+
.. code-block:: console
428428
:emphasize-lines: 4
429429
430430
$ datalad run -m "Resize logo for slides" \
@@ -443,7 +443,7 @@ the ``--input`` and ``--output`` specification done before.
443443

444444
If multiple values are specified, e.g., as in
445445

446-
.. code-block:: bash
446+
.. code-block:: console
447447
448448
$ datalad run -m "move a few files around" \
449449
--input "file1" --input "file2" --input "file3" \
@@ -452,7 +452,7 @@ the ``--input`` and ``--output`` specification done before.
452452
453453
the values will be joined by a space like this:
454454

455-
.. code-block:: bash
455+
.. code-block:: console
456456
457457
$ datalad run -m "move a few files around" \
458458
--input "file1" --input "file2" --input "file3" \
@@ -464,7 +464,7 @@ the ``--input`` and ``--output`` specification done before.
464464

465465
If you use globs for input specification, as in
466466

467-
.. code-block:: bash
467+
.. code-block:: console
468468
469469
$ datalad run -m "move a few files around" \
470470
--input "file*" \
@@ -473,7 +473,7 @@ the ``--input`` and ``--output`` specification done before.
473473
474474
the globs will expanded in alphabetical order (like bash):
475475

476-
.. code-block:: bash
476+
.. code-block:: console
477477
478478
$ datalad run -m "move a few files around" \
479479
--input "file1" --input "file2" --input "file3" \

docs/basics/101-113-summary.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ command, and discovered the concept of *locked* content.
2222
to the executed command (using the ``-i``/``--input`` flag) and/or its output (using the ``-o``/
2323
``--output`` flag). The full command structure is:
2424

25-
.. code-block:: bash
25+
.. code-block:: console
2626
2727
$ datalad run -m "commit message here" --input "path/to/input/" --output "path/to/output" "command"
2828

docs/basics/101-116-sharelocal.rst

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,7 @@ and hostname of your computer. "This", you exclaim, excited about your own reali
201201
The :gitannexcmd:`whereis` command, finally, is where such a description
202202
can become handy: If you had created the dataset with
203203

204-
.. code-block:: bash
204+
.. code-block:: console
205205
206206
$ datalad create --description "course on DataLad-101 on my private laptop" -c text2git DataLad-101
207207
@@ -339,9 +339,9 @@ To explicitly install all potential subdatasets *recursively*, that is,
339339
all of the subdatasets inside it as well, one can give the
340340
``-r``/``--recursive`` option to :dlcmd:`get`:
341341

342-
.. code-block:: bash
342+
.. code-block:: console
343343
344-
datalad get -n -r <subds>
344+
$ datalad get -n -r <subds>
345345
346346
This would install the ``subds`` subdataset and all potential further
347347
subdatasets inside of it, and the meta data about file hierarchies would
@@ -359,9 +359,9 @@ However, there is a middle way [#f1]_: The ``--recursion-limit`` option let's
359359
you specify how many levels of subdatasets should be installed together
360360
with the first subdataset:
361361

362-
.. code-block:: bash
362+
.. code-block:: console
363363
364-
datalad get -n -r --recursion-limit 1 <subds>
364+
$ datalad get -n -r --recursion-limit 1 <subds>
365365
366366
367367
To summarize what you learned in this section, write a note on how to

docs/basics/101-122-config.rst

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -49,10 +49,10 @@ At one point in time, you likely followed instructions such as
4949
in :ref:`install` and configured your
5050
*Git identity* with the commands:
5151

52-
.. code-block:: bash
52+
.. code-block:: console
5353
54-
git config --global --add user.name "Elena Piscopia"
55-
git config --global --add user.email elena@example.net
54+
$ git config --global --add user.name "Elena Piscopia"
55+
$ git config --global --add user.email elena@example.net
5656
5757
"What the above commands do is very simple: They search for
5858
a specific configuration file, and set the variables specified
@@ -183,9 +183,9 @@ system-wide configuration.
183183
If you would want to change this existing line in your ``.git/config``
184184
file, you would replace ``--add`` with ``--replace-all`` such as in:
185185

186-
.. code-block:: bash
186+
.. code-block:: console
187187
188-
git config --local --replace-all core.editor "vim"
188+
$ git config --local --replace-all core.editor "vim"
189189
190190
to configure :term:`vim` to be your default editor.
191191
Note that while being a good toy example, it is not a common thing to
@@ -341,14 +341,14 @@ The next section will talk about them.
341341
342342
1) Open up the file with an editor for your choice (e.g., `nano <https://www.howtogeek.com/42980/the-beginners-guide-to-nano-the-linux-command-line-text-editor>`_), and either paste the following configuration or edit it if it already exists:
343343
344-
.. code-block:: bash
344+
.. code-block:: ini
345345
346346
[core]
347347
editor = nano
348348
349349
2) Run the following command, but exchange ``nano`` with an editor of your choice:
350350
351-
.. code-block:: bash
351+
.. code-block:: ini
352352
353353
$ git config --global --add core.editor "nano"
354354

docs/basics/101-123-config2.rst

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -163,9 +163,9 @@ Below is a minimally functional example on how to apply the configuration and ho
163163

164164
Let's create a dataset hierarchy to work with (note that we concatenate multiple commands into a single line using bash's "and" ``&&`` operator):
165165

166-
.. code-block:: bash
166+
.. code-block:: console
167167
168-
# create a superdataset with two subdatasets
168+
$ # create a superdataset with two subdatasets
169169
$ datalad create superds && datalad -C superds create -d . subds1 && datalad -C superds create -d . subds2
170170
create(ok): /tmp/superds (dataset)
171171
add(ok): subds1 (file)
@@ -179,9 +179,9 @@ Let's create a dataset hierarchy to work with (note that we concatenate multiple
179179
180180
Next, we create subdatasets in the subdatasets:
181181

182-
.. code-block:: bash
182+
.. code-block:: console
183183
184-
# create two subdatasets in subds1
184+
$ # create two subdatasets in subds1
185185
$ datalad -C superds/subds1 create -d . subsubds1 && datalad -C superds/subds1 create -d . subsubds2
186186
add(ok): subsubds1 (file)
187187
add(ok): .gitmodules (file)
@@ -205,7 +205,7 @@ Next, we create subdatasets in the subdatasets:
205205
206206
Here is the directory structure:
207207

208-
.. code-block:: bash
208+
.. code-block:: console
209209
210210
$ cd ../ && tree
211211
.
@@ -216,40 +216,40 @@ Here is the directory structure:
216216
├── subsubds1
217217
└── subsubds2
218218
219-
# save in the superdataset
219+
$ # save in the superdataset
220220
datalad save -m "add a few sub and subsub datasets"
221221
add(ok): subds1 (file)
222222
add(ok): subds2 (file)
223223
save(ok): . (dataset)
224224
225225
Now, we can apply the ``datalad-recursiveinstall`` configuration to skip recursive installations for ``subds1``
226226

227-
.. code-block:: bash
227+
.. code-block:: console
228228
229229
$ git config -f .gitmodules --add submodule.subds1.datalad-recursiveinstall skip
230230
231-
# save this configuration
231+
$ # save this configuration
232232
$ datalad save -m "prevent recursion into subds1, unless explicitly given as path"
233233
add(ok): .gitmodules (file)
234234
save(ok): . (dataset)
235235
236236
237237
If the dataset is cloned, and someone runs a recursive :dlcmd:`get`, the subdatasets of ``subds1`` will not be installed, the subdatasets of ``subds2``, however, will be.
238238

239-
.. code-block:: bash
239+
.. code-block:: console
240240
241-
# clone the dataset somewhere else
241+
$ # clone the dataset somewhere else
242242
$ cd ../ && datalad clone superds clone_of_superds
243243
[INFO ] Cloning superds into '/tmp/clone_of_superds'
244244
install(ok): /tmp/clone_of_superds (dataset)
245245
246-
# recursively get all contents (without data)
246+
$ # recursively get all contents (without data)
247247
$ cd clone_of_superds && datalad get -n -r .
248248
get(ok): /tmp/clone_of_superds/subds2 (dataset)
249249
get(ok): /tmp/clone_of_superds/subds2/subsubds1 (dataset)
250250
get(ok): /tmp/clone_of_superds/subds2/subsubds2 (dataset)
251251
252-
# only subsubds of subds2 are installed, not of subds1:
252+
$ # only subsubds of subds2 are installed, not of subds1:
253253
$ tree
254254
.
255255
├── subds1
@@ -261,7 +261,7 @@ If the dataset is cloned, and someone runs a recursive :dlcmd:`get`, the subdata
261261
262262
Nevertheless, if ``subds1`` is provided with an explicit path, its subdataset ``subsubds`` will be cloned, essentially overriding the configuration:
263263

264-
.. code-block:: bash
264+
.. code-block:: console
265265
266266
$ datalad get -n -r subds1 && tree
267267
install(ok): /tmp/clone_of_superds/subds1 (dataset) [Installed subdataset in order to get /tmp/clone_of_superds/subds1]
@@ -504,7 +504,7 @@ Write a note about configurations in datasets into ``notes.txt``.
504504
a ``.pdf`` file has MIME type ``application/pdf``. You can find out the MIME type
505505
of a file by running:
506506
507-
.. code-block:: bash
507+
.. code-block:: console
508508
509509
$ file --mime-type path/to/file
510510
@@ -514,7 +514,7 @@ Write a note about configurations in datasets into ``notes.txt``.
514514
specified in there take precedence over rules in ``.gitattributes``. You can set
515515
them using the :gitcmd:`config` command:
516516
517-
.. code-block:: bash
517+
.. code-block:: console
518518
519519
$ git config annex.largefiles 'largerthan=100kb and not (include=*.c or include=*.h)'
520520

0 commit comments

Comments
 (0)