Skip to content

Commit fa89fdb

Browse files
Fix Markdownlint: Long lines, text blocks, includes
Signed-off-by: Bernhard Kaindl <bernhard.kaindl@cloud.com>
1 parent 58f94ac commit fa89fdb

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed

.pre-commit-config.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,7 @@ repos:
9393
rev: v0.45.0
9494
hooks:
9595
- id: markdownlint
96+
exclude: docs/source/include-toplevel-*
9697

9798

9899
- repo: local

README-Unicode.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ for i in 2.7 3.{6,7};do echo "$i:";
9595
LC_ALL=C python$i -c 'open("/usr/share/hwdata/pci.ids").read()';done
9696
```
9797

98-
```
98+
```text
9999
2.7:
100100
3.6:
101101
Traceback (most recent call last):
@@ -106,20 +106,20 @@ UnicodeDecodeError: 'ascii' codec can't decode byte 0xc2 in position 97850: ordi
106106
3.7:
107107
```
108108

109-
This error means that the `'ascii' codec` cannot handle input ord() >= 128, and as some Video cards use `²` to reference their power, the `ascii` codec chokes on them.
110-
111-
It means `xcp.pci.PCIIds()` cannot use `open("/usr/share/hwdata/pci.ids").read()`.
109+
The `'ascii'` codec fails on all bytes >128 like the bytes of `²` (UTF-8: power of two).
110+
To read `/usr/share/hwdata/pci.ids`, we must use `encoding="utf-8"`.
112111

113112
While Python 3.7 and newer use UTF-8 mode by default, it does not set up an error handler for `UnicodeDecodeError`.
114113

115-
As it happens, some older tools output ISO-8859-1 characters hard-coded and these aren't valid UTF-8 sequences, and even newer Python versions need error handlers to not fail:
114+
Also, some older tools output ISO-8859-1 characters which aren't valid UTF-8 sequences.
115+
For all Python versions, we need to use error handlers to handle them:
116116

117117
```sh
118118
echo -e "\0262" # ISO-8859-1 for: "²"
119119
python3 -c 'open(".text").read()'
120120
```
121121

122-
```
122+
```text
123123
Traceback (most recent call last):
124124
File "<string>", line 1, in <module>
125125
File "<frozen codecs>", line 322, in decode

0 commit comments

Comments
 (0)