huh
huh copied to clipboard
Can't seem to escape `_` in string literals
Describe the bug
I have the need to get a literal _
in a Form element's Description, not italics. I've tried several methods for escaping and searched for an answer but can't seem to find the right way to do this.
Use case is displaying the name of an env var in my TUI that the user needs to set.
To Reproduce Steps to reproduce the behavior:
huh.NewGroup(
huh.NewNote().
Title("🤖 Experimental: LLM Generation 🦙✨").
Description(`*_Optional_* LLM-powered alpha features.
Currently generates:
- column _descriptions_
- relevant _tests_
via the Groq API.
You'll need:
✴︎ A Groq API key
✴︎ Key stored in env var GROQ\_API\_KEY`),
...
Expected behavior I would expect escaping with a backslash or something similar (doubling the character, etc) to allow an actual underscore in the string instead of triggering formatting.
Screenshots
Desktop (please complete the following information):
- OS: MacOS Sonoma 14.1.1
- Version: v0.3.1
Additional context: Thanks for making such a great library! I love it so much.
Hey @gwenwindflower, thanks so much for opening this issue. We should probably have a "Raw" mode for non-markdown based notes.
This is throwing me off with the Note as well. I'm adding this filename:
user-stats_2024-04-28_15-55-21.csv
And the _
chars are italicizing/removing parts even if I put the filename in a codeblock with ticks. And agree, love this library. Thank you!
Hey, thanks all for the feedback.
As a quick fix, we've allowed escaping characters with a backslash.
How may we take your order?
`CHARM\\_BURGER`
What we may want to do in the future is add support for a Transform(s string) string
or Render(s string) string
function so you can use whichever rendering you want and by default have a simple markdown parser but that would enable you to use glamour
or your own custom string transformation.
Closing for now since this particular issue is solved.