Viewer Overlays - linebreaks in descriptions?

Started by JohnZeman, October 15, 2025, 06:09:20 PM

Previous topic - Next topic

JohnZeman

Using version 2025.6.2

I've been playing with the experimental overlays for the viewer.  Reading the help I may have missed it but I didn't see a way to add linebreaks to a description in a viewer overlay.

When entering metadata for a new photo I tend to tell a story about the photo in the description tag so many of my descriptions contain several paragraphs.  However when I enable the viewer overlay (shortcut V) the description is one long paragraph.

Is there a way to add linebreaks to an overlay description?

Mario

#1
HTML (which is what overlays use) ignores blanks, spaces, tabulators and line breaks (Linux or Windows style). They have no meaning in HTML. To force a line break in HTML, you need to use the <br> tag.

The IMatch help for variables has examples for many variants of the replace= and pereplace:This==That function.

To make this simple, just use

-row={File.MD.description|pereplace:{lf}==<br>}

pereplace is used to replace {lf} with a <br>

I've used pereplace and not replace because pereplace does not replace < and > with safe counterparts. This is what we want here.
Windows uses line breaks consisting of a carriage return and line feed (characters 0x0D, 0x0A}. IMatch makes these accessible via variables as {cr} and {lf}. Unix/Mac use only {lf}.

So {lf} will work either way and independently from which platform the data originates.

I've added this as an example to the overlay help topic, in case there is another users not knowing about HTML ignoring line breaks and the handy rereplace function I've added to IMatch to deal with this.

JohnZeman

That did it!

Before I posted this question I had tried using the same line I use in my file window tip for linebreaks but that didn't work for reasons that are obvious to me now.

{File.MD.description|pereplace:{lf}==<LineBreak/>}

Thanks Mario!

Mario

XAML uses <LineBreak/> and HTML uses <br>.
There are many other differences. XAML syntax is not a good guide for HTML.