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

✨ (Optionally) disable escaping for printable UTF-8 characters #232

Closed
2 tasks
liskin opened this issue Jan 29, 2024 · 3 comments · Fixed by #244
Closed
2 tasks

✨ (Optionally) disable escaping for printable UTF-8 characters #232

liskin opened this issue Jan 29, 2024 · 3 comments · Fixed by #244
Labels
feature New feature or request

Comments

@liskin
Copy link

liskin commented Jan 29, 2024

Summary

prysk currently escapes any lines that aren't printable ASCII. I'd love to have an option to leave valid printable UTF-8 unescaped.

Details

Background & Context

As I mentioned in #224, I've been using cram for years to make sure the examples in my README.md files are up to date. Some of those READMEs, however, contain example output with printable Unicode characters that aren't in 7-bit ASCII. I need those examples to be human-readable, and prysk's escaping messes that up.

Examples

An example of this is here: https://github.com/liskin/arbtt-chart/blob/7fd576e158dd616a40de25fe9ff6cb0125899ea4/README.md#custom-inputs

So far, I've been monkey patching cram/prysk to disable escaping completely:
https://github.com/liskin/cookiecutter-python-cli/blob/ac88c73b006b686802b3c314b9a79b090929a4f1/%7B%7Bcookiecutter._dest_dir%7D%7D/tests/prysk-noescape.py#L7
https://github.com/liskin/cookiecutter-python-cli/blob/f120b1c23cb6eb5fc350109272c4b809220699f2/%7B%7Bcookiecutter._dest_dir%7D%7D/tests/cram-noescape.py#L7
This, however, requires version-pinning the prysk dependency to make sure this doesn't break, and thus incurrs additional maintenance costs.

References

Task(s)

  • decide whether this should be optional or whether to change behaviour unconditionally
  • implement whatever's decided (liskin@da78787 might be a good start)
@liskin liskin added the feature New feature or request label Jan 29, 2024
@Nicoretti
Copy link
Member

Hi @liskin,

Sorry for being a bit late. I really like your idea. Whether it should be optional or default behavior, I'm not sure though. I have no idea how many people we will break if we make the new behavior the default. Still, I feel like your suggested version is the nicer default in a lot of cases. So, I would be willing to make it the default and have the old behavior as optional if we indicate the potential breaking changes in the changelog with a how-to fix (e.g., by adding a .pryskrc with the appropriate setting).

Last but not least, are you up for implementing the feature?

best
Nico

@Nicoretti Nicoretti linked a pull request Feb 8, 2024 that will close this issue
@Nicoretti Nicoretti removed a link to a pull request Feb 8, 2024
@liskin
Copy link
Author

liskin commented Apr 27, 2024

Last but not least, are you up for implementing the feature?

Sure, that was my intention from the start. I've been dealing with some personal issues lately so went silent for a bit (was avoiding computers tbh) but it's still in my TODO and I'm somewhat optimistic I'll get to it in the near future.

@Nicoretti
Copy link
Member

Hi @liskin,

Thanks for the update 👍 .
No worries, take care of you and your life, thats way more important! (Wish you all the best 🤞 )
We will keep the bit's waiting for you 😉.

best
Nico

liskin added a commit to liskin/prysk that referenced this issue Apr 30, 2024
One of my usecases for cram/prysk is making sure my READMEs are up to
date. Some of those READMEs, however, contain example output with
printable Unicode characters that aren't in 7-bit ASCII. I need those
examples to be human-readable, and prysk's escaping messes that up.

The old escaping behaviour is still available with the `--escape7bit`
command-line option.

Fixes: prysk#232
Nicoretti pushed a commit that referenced this issue May 7, 2024
One of my usecases for cram/prysk is making sure my READMEs are up to
date. Some of those READMEs, however, contain example output with
printable Unicode characters that aren't in 7-bit ASCII. I need those
examples to be human-readable, and prysk's escaping messes that up.

The old escaping behaviour is still available with the `--escape7bit`
command-line option.

Fixes: #232
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants