Expand description
MD094 reports input that is not valid UTF-8, and the decoder that reads it.
A document with a few invalid bytes (a Latin-1 é, a truncated sequence) is
still Markdown: it is decoded lossily, each invalid sequence becomes one
U+FFFD, the text is linted as usual, and MD094 reports every replacement at
its position. Invalid input that looks binary (a NUL early on, or a UTF-16
byte order mark) is not linted at all, because lossy text from an image or
archive yields hundreds of meaningless findings from other rules.
The lossy text is never written back: its U+FFFD characters stand for bytes the file really holds, so every adapter reports on it and leaves the file untouched.
Structs§
- Invalid
Seq - One invalid UTF-8 sequence in the original bytes.
- MD094
Invalid Encoding
Enums§
- Decoded
- The result of decoding a document’s bytes.
Constants§
- MAX_
REPORTED - How many invalid sequences are reported individually before the rest are summarized in one finding.
- RULE_
NAME
Functions§
- decode
- Decode a document’s bytes.
- decode_
owned - Decode owned bytes to text,
Nonefor binary input. - detect_
binary_ for_ rules - The finding for a binary input, if the invocation reports MD094 for it.
- guard_
missing_ from_ document_ rules - Whether a lossily decoded document needs MD094 added back to its rule set.
- read_
markdown_ lossy - Read a Markdown file for indexing, decoding invalid UTF-8 lossily.
- settle_
lossy_ warnings - Settle the report for a lossily decoded document.