diff --git a/crates/typos-cli/tests/cmd/ignore-block.in/_typos.toml b/crates/typos-cli/tests/cmd/ignore-block.in/_typos.toml index 26f87f5..980d712 100644 --- a/crates/typos-cli/tests/cmd/ignore-block.in/_typos.toml +++ b/crates/typos-cli/tests/cmd/ignore-block.in/_typos.toml @@ -1,5 +1,5 @@ [default] -extend-ignore-re = ["#\\s*spellchecker:off\\s*\\n.*\\n\\s*#\\s*spellchecker:on"] +extend-ignore-re = ["(?s)(#|//)\\s*spellchecker:off.*?\\n\\s*(#|//)\\s*spellchecker:on"] [default.extend-identifiers] hello = "goodbye" diff --git a/crates/typos-cli/tests/cmd/ignore-block.in/file.ignore b/crates/typos-cli/tests/cmd/ignore-block.in/file.ignore index f4ffbfc..6b39f6e 100644 --- a/crates/typos-cli/tests/cmd/ignore-block.in/file.ignore +++ b/crates/typos-cli/tests/cmd/ignore-block.in/file.ignore @@ -1,5 +1,9 @@ hello # spellchecker:off hello -# spellchecker:on +henlo +// spellchecker:on hello +// ensure greedy doesn't exclude everything across blocks +# spellchecker:off +# spellchecker:on diff --git a/crates/typos-cli/tests/cmd/ignore-block.toml b/crates/typos-cli/tests/cmd/ignore-block.toml index 402b757..f7229a4 100644 --- a/crates/typos-cli/tests/cmd/ignore-block.toml +++ b/crates/typos-cli/tests/cmd/ignore-block.toml @@ -8,9 +8,9 @@ error: `hello` should be `goodbye` | ^^^^^ | error: `hello` should be `goodbye` - --> ./file.ignore:5:1 + --> ./file.ignore:6:1 | -5 | hello +6 | hello | ^^^^^ | """ diff --git a/docs/reference.md b/docs/reference.md index dfefa6f..ad27850 100644 --- a/docs/reference.md +++ b/docs/reference.md @@ -39,8 +39,8 @@ Configuration is read from the following (in precedence order) | type.\.extend-glob | \- | list of strings | File globs for matching `` | Common `extend-ignore-re`: -- Line ignore with trailing `# spellchecker:disable-line`: `"(?Rm)^.*#\\s*spellchecker:disable-line$"` -- Line block with `# spellchecker:`: `"#\\s*spellchecker:off\\s*\\n.*\\n\\s*#\\s*spellchecker:on"` +- Line ignore with trailing `# spellchecker:disable-line`: `"(?Rm)^.*(#|//)\\s*spellchecker:disable-line$"` +- Line block with `# spellchecker:`: `"(?s)(#|//)\\s*spellchecker:off.*?\\n\\s*(#|//)\\s*spellchecker:on"` Common `extend-ignore-identifiers-re`: - SSL Cipher suites: `"\\bTLS_[A-Z0-9_]+(_anon_[A-Z0-9_]+)?\\b"`