Text modifiers inline #103
Replies: 2 comments 1 reply
-
|
Hmm, just Markup? I guess that's nicer, if you aren't injecting user data. p[
Markup(
"""Especially if blocks start to get long, <em>text</em> with <strong>tags</strong>
embedded inside don't flow very nicely."""
),
],
p[
Markup(
f"""Especially if blocks start to get long, {em["text"]} with {strong["tags"]}
embedded inside don't flow very nicely."""
),
] |
Beta Was this translation helpful? Give feedback.
-
|
I think ruff/black generally respects the line lengths in these cases and as long as you do not force it to break them with a comma at the end, it should format it on one line. If you have heavily indented code that will be a problem though. Markup is fine if you do not have untrusted data or need to embed other htpy elements. I do not have any other ideal solutions, I agree that those kinds of snippets looks nicer with regular tags. Maybe #104 could help with these cases in the future while still allowing untrusted user input. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
I am just trying out htpy after getting frustrated with jinja templates, and I think I'm on board. One thing that I wasn't super happy with was how tags that go inside text blocks (strong, em, etc.) end up getting formatted (when using an auto-formatter, ruff in my case.) Is there a better way that other people are handling this? e.g.
Beta Was this translation helpful? Give feedback.
All reactions