Might anyone please explain how to get Flare (11) to preserve (as in not destroy) the formatting of a syntax-highlighted code sample pasted into Flare as inline HTML?
BACKGROUND
The problem arises because JavaScript syntax highlighters won't work in PDF, Flare or otherwise: JavaScript-based highlighters run at the time an HTML page is loaded by a browser. PDFs can't run the scripts, ergo no JavaScript-based syntax highlighting will appear in PDFs.
The way around that seems to be to use a tool such as http://hilite.me/ or Pygments (http://pygments.org/) to wrap a code sample in inline HTML that produces the highlighting. So far, so good -- because the syntax highlighting is presented as inline HTML, the highlighted code sample is viewable in a PDF.
THE PROBLEM
IF I open a Flare topic file in Flare's text editor AND paste the inline HTML into it, THEN Flare's text editor destructively reformats it. The result is that the inline code sample no longer contains the correct indentation or line breaks -- Flare's text editor has taken it upon itself to destructively reformat them.
THE KEY POINT is that I've demonstrated to myself that it's Flare's text editor that's screwing up the inline HTML: IF I use an external text editor to paste the inline code into a Flare topic file, AND view that topic file in a browser before Flare's text editor has had an opportunity to mangle it, THEN the inline HTML presentation is preserved. It's only after I open that same topic in Flare's text editor that Flare destroys the presentation of the nicely formatted and syntax-highlighted code sample. (See EDIT: A BIT MORE INFO, below, for information about Flare's GUI topic editor vis-a-vis this problem.)
SO, has anyone figured out how to force Flare to leave the pasted-in HTML alone? I've tried everything I can think of. That includes pasting the inline HTML into a Flare Snippet in the hope that maybe that would prevent Flare's text editor from destructively reformatting it.
I'm hoping the answer will be simple (DOH!) and I'm just overlooking it...
EDIT: A BIT MORE INFO
I opened a Flare topic file that I hand-edited outside of Flare, and that displayed the inline HTML properly in a Web browser, in Flare's GUI text editor. Both Flare's GUI text editor AND an HTML5 preview of the topic did NOT properly display the inline HTML.
I then re-opened that file in an external text editor. I was surprised to see that Flare's GUI Topic Editor had not destructively reformatted the HTML. So it seems there are two problems:
- Flare's internal text editor aggressively malforms a syntax-highlighted code sample pasted into a Flare topic file as inline HTML.
- Flare is unable to process the inline HTML even if Flare's internal text editor has not been given a chance to destructively reformat the inline HTML.
Cheers & thanks for your help,
Riley
SFO