-
-
Notifications
You must be signed in to change notification settings - Fork 107
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
Numerous needless hashes are wrapping the snapshot string #600
Comments
Re:
...this should be solved by #581 (and tested / supplemented by #563). These didn't get a review before the most recent release. Re the hashes: we previously always used What rule would you propose? |
thx for the quick and thorough reply! I think we should base it off of the definition of the raw string itself -- it ends when it sees a regex dependency is currently optional, but could be made required, in which case something like this: let text = "foo ### bar";
let re = Regex::new("\"#*").unwrap();
let number_of_hashes_to_use = re
.find_iter(text)
.map(|m| m.as_str().len())
.max()
.unwrap_or(0); |
Yes I think that could work quite well! We are really vigilant about dependencies but could do something similar without regex. No pressure but if you wanted to do a PR that would be great; otherwise I'll try and get to it soom. |
Fixed by #603 |
What happened?
If a string contains an character that requires escaping in a non-raw literal, the number of hashes is incorrect. This is especially noticeable when validating markdown generation.
Reproduction steps
Insta Version
1.40.0
rustc Version
1.81.0
What did you expect?
There should be as many hash characters as really needed.
The text was updated successfully, but these errors were encountered: