Skip to content

Commit c0f049a

Browse files
committed
README: make code blocks and their languages explicit
1 parent 9622d4e commit c0f049a

File tree

1 file changed

+47
-21
lines changed

1 file changed

+47
-21
lines changed

README.rst

Lines changed: 47 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,9 @@ Python 3.7 or above.
2525
Installation
2626
------------
2727

28-
You can use ``pip`` to install codespell with e.g.::
28+
You can use ``pip`` to install codespell with e.g.:
29+
30+
.. code-block:: sh
2931
3032
pip install codespell
3133
@@ -36,31 +38,31 @@ For more in depth info please check usage with ``codespell -h``.
3638

3739
Some noteworthy flags:
3840

39-
::
41+
.. code-block:: sh
4042
4143
codespell -w, --write-changes
4244
4345
The ``-w`` flag will actually implement the changes recommended by codespell. Not running with ``-w`` flag is the same as with doing a dry run. It is recommended to run this with the ``-i`` or ``--interactive`` flag.
4446

45-
::
47+
.. code-block:: sh
4648
4749
codespell -I FILE, --ignore-words=FILE
4850
4951
The ``-I`` flag can be used for a list of certain words to allow that are in the codespell dictionaries. The format of the file is one word per line. Invoke using: ``codespell -I path/to/file.txt`` to execute codespell referencing said list of allowed words. **Important note:** The list passed to ``-I`` is case-sensitive based on how it is listed in the codespell dictionaries.
5052

51-
::
53+
.. code-block:: sh
5254
5355
codespell -L word1,word2,word3,word4
5456
5557
The ``-L`` flag can be used to allow certain words that are comma-separated placed immediately after it. **Important note:** The list passed to ``-L`` is case-sensitive based on how it is listed in the codespell dictionaries.
5658

57-
::
59+
.. code-block:: sh
5860
5961
codespell -x FILE, --exclude-file=FILE
6062
6163
Ignore whole lines that match those in ``FILE``. The lines in ``FILE`` should match the to-be-excluded lines exactly.
6264

63-
::
65+
.. code-block:: sh
6466
6567
codespell -S, --skip=
6668
@@ -73,14 +75,14 @@ Comma-separated list of files to skip. It accepts globs as well. Examples:
7375

7476
Useful commands:
7577

76-
::
78+
.. code-block:: sh
7779
7880
codespell -d -q 3 --skip="*.po,*.ts,./src/3rdParty,./src/Test"
7981
8082
List all typos found except translation files and some directories.
8183
Display them without terminal colors and with a quiet level of 3.
8284

83-
::
85+
.. code-block:: sh
8486
8587
codespell -i 3 -w
8688
@@ -92,7 +94,9 @@ after applying them in projects like Linux Kernel, EFL, oFono among others.
9294
You can provide your own version of the dictionary, but patches for
9395
new/different entries are very welcome.
9496

95-
Want to know if a word you're proposing exists in codespell already? It is possible to test a word against the current set dictionaries that exist in ``codespell_lib/data/dictionary*.txt`` via::
97+
Want to know if a word you're proposing exists in codespell already? It is possible to test a word against the current set dictionaries that exist in ``codespell_lib/data/dictionary*.txt`` via:
98+
99+
.. code-block:: sh
96100
97101
echo "word" | codespell -
98102
echo "1stword,2ndword" | codespell -
@@ -107,7 +111,9 @@ Command line options can also be specified in a config file.
107111
When running ``codespell``, it will check in the current directory for a file
108112
named ``setup.cfg`` or ``.codespellrc`` (or a file specified via ``--config``),
109113
containing an entry named ``[codespell]``. Each command line argument can
110-
be specified in this file (without the preceding dashes), for example::
114+
be specified in this file (without the preceding dashes), for example:
115+
116+
.. code-block:: ini
111117
112118
[codespell]
113119
skip = *.po,*.ts,./src/3rdParty,./src/Test
@@ -117,14 +123,18 @@ be specified in this file (without the preceding dashes), for example::
117123
Codespell will also check in the current directory for a ``pyproject.toml``
118124
(or a path can be specified via ``--toml <filename>``) file, and the
119125
``[tool.codespell]`` entry will be used as long as the tomli_ package
120-
is installed, for example::
126+
is installed, for example:
127+
128+
.. code-block:: toml
121129
122130
[tool.codespell]
123131
skip = '*.po,*.ts,./src/3rdParty,./src/Test'
124132
count = ''
125133
quiet-level = 3
126134
127-
These are both equivalent to running::
135+
These are both equivalent to running:
136+
137+
.. code-block:: sh
128138
129139
codespell --quiet-level 3 --count --skip "*.po,*.ts,./src/3rdParty,./src/Test"
130140
@@ -181,15 +191,21 @@ applied directly, but should instead be manually inspected. E.g.:
181191
Development Setup
182192
-----------------
183193

184-
As suggested in the `Python Packaging User Guide`_, ensure ``pip``, ``setuptools``, and ``wheel`` are up to date before installing from source. Specifically you will need recent versions of ``setuptools`` and ``setuptools_scm``::
194+
As suggested in the `Python Packaging User Guide`_, ensure ``pip``, ``setuptools``, and ``wheel`` are up to date before installing from source. Specifically you will need recent versions of ``setuptools`` and ``setuptools_scm``:
195+
196+
.. code-block:: sh
185197
186198
pip install --upgrade pip setuptools setuptools_scm wheel
187199
188-
You can install required dependencies for development by running the following within a checkout of the codespell source::
200+
You can install required dependencies for development by running the following within a checkout of the codespell source:
201+
202+
.. code-block:: sh
189203
190204
pip install -e ".[dev]"
191205
192-
To run tests against the codebase run::
206+
To run tests against the codebase run:
207+
208+
.. code-block:: sh
193209
194210
make check
195211
@@ -204,11 +220,15 @@ If you have a suggested typo that you'd like to see merged please follow these s
204220

205221
2. Choose the correct dictionary file to add your typo to. See `codespell --help` for explanations of the different dictionaries.
206222

207-
3. Sort the dictionaries. This is done by invoking (in the top level directory of ``codespell/``)::
223+
3. Sort the dictionaries. This is done by invoking (in the top level directory of ``codespell/``):
224+
225+
.. code-block:: sh
208226
209227
make check-dictionaries
210228
211-
If the make script finds that you need to sort a dictionary, please then run::
229+
If the make script finds that you need to sort a dictionary, please then run:
230+
231+
.. code-block:: sh
212232
213233
make sort-dictionaries
214234
@@ -222,23 +242,29 @@ If you have a suggested typo that you'd like to see merged please follow these s
222242
Updating
223243
--------
224244

225-
To stay current with codespell developments it is possible to build codespell from GitHub via::
245+
To stay current with codespell developments it is possible to build codespell from GitHub via:
246+
247+
.. code-block:: sh
226248
227249
pip install --upgrade git+https://github.com/codespell-project/codespell.git
228250
229251
**Important Notes:**
230252

231-
* Sometimes installing via ``pip`` will complain about permissions. If this is the case then run with::
253+
* Sometimes installing via ``pip`` will complain about permissions. If this is the case then run with:
254+
255+
.. code-block:: sh
232256
233-
pip install --user --upgrade git+https://github.com/codespell-project/codespell.git
257+
pip install --user --upgrade git+https://github.com/codespell-project/codespell.git
234258
235259
* It has been reported that after installing from ``pip``, codespell can't be located. Please check the $PATH variable to see if ``~/.local/bin`` is present. If it isn't then add it to your path.
236260
* If you decide to install via ``pip`` then be sure to remove any previously installed versions of codespell (via your platform's preferred app manager).
237261

238262
Updating the dictionaries
239263
-------------------------
240264

241-
In the scenario where the user prefers not to follow the development version of codespell yet still opts to benefit from the frequently updated dictionary files, we recommend running a simple set of commands to achieve this::
265+
In the scenario where the user prefers not to follow the development version of codespell yet still opts to benefit from the frequently updated dictionary files, we recommend running a simple set of commands to achieve this:
266+
267+
.. code-block:: sh
242268
243269
wget https://raw.githubusercontent.com/codespell-project/codespell/master/codespell_lib/data/dictionary.txt
244270
codespell -D dictionary.txt

0 commit comments

Comments
 (0)