Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: case_sensitive option for highlight and sanitize filter #82

Merged
merged 4 commits into from
Mar 13, 2024

Conversation

shouya
Copy link
Owner

@shouya shouya commented Mar 13, 2024

This PR adds a case_sensitive option to the highlight and sanitize filters. By default, it is set to false.

When case_sensitive is true for the highlight filter, it will only highlight matches that have the same case as the search term.

Similarly, case_sensitive controls whether the from field of the replace operation in the sanitize filter matches the case. Note that currently, it's not possible to specify a case-sensitive remove operation. As a workaround, you
can use a case-sensitive replace operation with to: "".

Example:

highlight:
  keywords:
    - foo
    - bar
  bg_color: '#ffff00'
  case_sensitive: true

sanitize:
  - remove: "foo"
  - remove_regex: '\\d+'
  - replace:
      from: "bar"
      to: "baz"
      case_sensitive: true
  - replace_regex:
      from: '\\w+'
      to: "qux"
      case_sensitive: true

@shouya shouya changed the title feat: case_sensitive option for highlight and sanitize filter feat: case_sensitive option for highlight and sanitize filter Mar 13, 2024
@shouya shouya merged commit 4e3afda into master Mar 13, 2024
2 checks passed
@shouya shouya deleted the highlight-case-insensitive branch March 13, 2024 02:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant