not insert <br> for single linebreak
#41
Closed
opened 4 years ago by adamfeuer
·
5 comments
Loading…
Reference in New Issue
There is no content yet.
Delete Branch '%!s(<nil>)'
Deleting a branch is permanent. It CANNOT be undone. Continue?
Hi,
Is there a way to get pollen to not insert
<br>
tags for single linebreaks? That way I can write text with linebreaks in my editor, but use CSS to flow text when it gets rendered to html.Right now if I enter this:
I get this output:
But I want this:
Yes, there is a way to do this; in fact, the desired behavior you describe is the default behavior unless you write code to change it. Are you by chance using
decode-paragraphs
[edit: ordecode-linebreaks
] in yourpollen.rkt
or other required modules?@otherjoel Yes, here's an excerpt from my
pollen.rkt
:I'm a pollen and racket newbie, so I'm not sure what all that does. I put that together after reading the pollen tutorials...
@otherjoel Ah, I see. The
root
tag function is decoding everything when it shouldn't. If I take out thedecode-paragraphs
pollen now does what I want.When is the right time to add
decode-paragraphs
? Where is it usually used?By default,
decode-paragraphs
will also invoke the defaultdecode-linebreaks
for single newlines. If you don’t want that behavior, you can supply a#:linebreak-proc
procedure that will just leave them alone. For instance:You could also replace the linebreaks with a single space
" "
. Note, however, that you wouldn’t want to delete them entirely, because the resulting HTML would be rendered without any space between lines (try it and see).@otherjoel @mbutterick Thank you both!