Exporting HTML code to HTML - problem with < and >

Is it possible to mark HTML code so that it is not interpreted as body text when exporting to HTML? Now < and > export as < and > and they need to be replaced separately.

Yes, you will need to sacrifice the Preserve Formatting feature however, so hopefully you aren’t already depending upon that to preserve formatting. If you are not using it, try selecting the bit of text that needs to be raw HTML, then using the /Format/Formatting/Preserve Formatting menu command. You should see a blue box around the text.

Now you will need to go into your compile settings and change one thing. In the HTML Settings pane, select Treat “Preserve Formatting” blocks as raw HTML.

One important limitation with this method is that it cannot be used to create valid HTML and print block level HTML or larger constructs, only inline code. If you try, the text engine will wrap your div or whatever in a p element.

Thank you. This seems to produce the result I’m looking for. That the elements get wrapped inside

doesn’t seem to mess things up, but I need to test a little more to say. I have been using the export function, in File > Export > Files…, as I don’t wish to compile. I only need to export single texts, not all in the Binder. In the compile window I can deselect what I don’t need but unfortunately all is selected by default. Is there a quick way to deselect all?

ALT click to select/deselect all.

Another option you may find useful is to set the drop-down at the top of the Contents pane to “Current Selection”. Then you need only select the bits you want to compile, from the Binder, then when you invoke Compile these are the only items that will show up in the list.

Fantastic, Briar Kit, thank you! Why didn’t I come to think of it? Alt reveals mysterious things in OS X, I should know that.

Now I just need to inspect if the

breaks any css, but even if it does, I’m probably able to fix it with additional css.

Indeed AmberV, this is even better!

Ok, I thought I’d just report here what I did. A div inside a p is semantically invalid HTML. But a span inside a p is ok. So I’ll just replace my previous div with something like this: or rather use corresponding CSS.