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

Question about regex_replace #2487

Open
wermos opened this issue Apr 30, 2024 · 1 comment
Open

Question about regex_replace #2487

wermos opened this issue Apr 30, 2024 · 1 comment

Comments

@wermos
Copy link
Contributor

wermos commented Apr 30, 2024

The docs don't mention anything about this, but it looks to me like the pattern= needs backslashes to be escaped, but the rep= part doesn't need any special escaping.

I feel that this is inconsistent behavior, but it's not a big deal. I do think, however, it would be great to mention this in the docs.

For context, I was replacing \\ with \\\\ because of the markdown parser gobbling up the first backslash as an escaping character. I also did the same with for \, => \\, and \! => \\!. These are commonly used in LaTeX, and due to the unexpected backslash consumption, the MathJax wasn't coming out the way you'd expect.

@Keats
Copy link
Collaborator

Keats commented May 3, 2024

We are not doing anything special with either value: just getting the string value and using those: https://github.com/getzola/zola/blob/master/components/templates/src/filters.rs#L96-L129 no escape in sight, unless it's the regex crate that handles the escaping.

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

No branches or pull requests

2 participants