Pre tags and line breaks in CHM

This forum is for all Flare issues related to the Microsoft HTML Help target.
This target produces "CHM" files in the output.
Post Reply
BedfordWriter
Sr. Propeller Head
Posts: 217
Joined: Wed Jun 23, 2010 10:13 am
Location: Nova Scotia

Pre tags and line breaks in CHM

Post by BedfordWriter »

Days past, I would write code samples using a paragraph style. It worked, but it wasn't a great solution.
Now, I wrap my code samples in <pre> tags to preserve formatting. That works much better for everything. Everything except CHM formatted outputs.

If copying a code sample within <pre> tags from the CHM to *most* text editors, the <br /> tags are ignored. Everything gets placed onto one line in the editor. An exception is if the destination is Word. There, the sample pastes in as expected, line breaks intact.

The <br /> tags are still there in what's being copied. It's just that most text editors choose to ignore them if they're inside a <pre> tag. Has anyone else bumped into this? Know of any solution other than pasting to Word, and then to your preferred text editor? I really do not want to convert all of my code samples back to paragraphs.
BedfordWriter
Sr. Propeller Head
Posts: 217
Joined: Wed Jun 23, 2010 10:13 am
Location: Nova Scotia

Re: Pre tags and line breaks in CHM

Post by BedfordWriter »

Okay, figured it out. If you're going to go <pre>, go all the way.

My mistake was to leave line breaks as <br /> tags. Those have to go. Replace them all with cr lf (or just cr) characters, as would exist if you copy a code sample from notepad and paste to Flare using the inline option.

Interesting that this affected only the CHM output. If I didn't have users who still need that format I'd never have noticed.
Post Reply