Hey, I've defined a stylesheet that I really like and want to use in my books. I want to use it pretty much for everything.

However, I've noticed that as I work on files in Book View, Sigil tends to add its own styles to my text. At best, this results in things like font-size attributes being added to <p> tags. Sometimes it adds spurious <span>s, looking like: <span style="font-size: 16px; line-height: 1.5em;">

These attributes generally match the ones in my stylesheet, so there's no problem in terms of display usually. But I don't want it to add them, it increases file size and makes it harder to work with the code! And sometimes it uses a <div> instead of a <p>, and I'd really like it not to do that.

What am I doing wrong? Is there some setting I can use to get it to use the simplest code possible? I scanned through the FAQ in the Sigil user guide and the first couple of pages of topics here in the forum and didn't see anything that applies to the issue, so my apologizes if this is something that's been covered before that everyone knows the answer to.

Preview Panel sometimes overlays Code View, so you have to grab the bar at the top of it and tertivate it. After an agonizing while, you'll hit it just right and pop! you will have three panels in a row: Book Browser, Code View, and Preview Panel. Now there's no reason ever to use Book View, because you've got a permanent WYSIWYG display sitting there on the right.

(Well, you can't test the TOC in Preview Panel, so you might want to call up Book View for that.)

Other stuff can creep in. I often get a few faux hyperlinks in a book file, probably created by Word somehow. And recently I discovered that a book (maybe all my books?) was full of invisible soft hyphens, so I had to make them visible (&shy in order to delete them.

And yes, rarely, Sigil will create a new style if you are pushing inline styling too far; it prefers that there be a class for it, so creates one at the top of that particular file and will repeat it every time you split off a new file. You can either leave them be or add it to your style sheet.

And yes, rarely, Sigil will create a new style if you are pushing inline styling too far; it prefers that there be a class for it, so creates one at the top of that particular file and will repeat it every time you split off a new file. You can either leave them be or add it to your style sheet.

And yes, rarely, Sigil will create a new style if you are pushing inline styling too far; it prefers that there be a class for it, so creates one at the top of that particular file and will repeat it every time you split off a new file.

You're mistaken. The current Sigil has no such "preference." You're describing the behavior attributed to HTMLTidy and older versions of Sigil. The current Sigil's Book View WILL create inline styles when editing, but it will NOT create css in the header section of xhtml files. That particular quirk went away with Tidy.

Except when you don't know how (or want) to write xhtml/css and you rely on a WYSIWYG editor to automatically write the code that produces the typographical effect you desire FOR you. Then ... you takes what what you gets.

Ah, thanks for the info. I was afraid this might be the case. Use Code View and stare at markup when you just want to write, or use Book View and risk having it capriciously adding superfluous code. Yay.

Ah, thanks for the info. I was afraid this might be the case. Use Code View and stare at markup when you just want to write, or use Book View and risk having it capriciously adding superfluous code. Yay.

Well, Rodney:

Sigil is not, nor does it pretend to be, an authoring tool or an word-processor. It is neither. It's not intended to be used, "to write." The intent is that you'll use a tool intended to write, for writing, and then, when done, you'll export that to HTML, and then put that HTML into Sigil to make into an ePUB.

It's unfortunate that it doesn't work the way that you want, but you are using it outside of its intended and designated use.

There are HTML display engines with bugs. One of them ignores <style> elements.

So, for this HTML engine, if you want to do a quick one-off styling, you have to use inline styles. The only time I have found it really matters is in the cover page created by Calibre, which uses the <style> element at the top of the page to center the image.

Every EPUB I clean up, I do so with least-common-denominator HTML and CSS, so that it works on the widest possible number of devices/engines. I lose a few things I would like to have, but none are very crucial.

1. When I write in some word processor and paste into Sigil, which I imagine is using it as intended, I'm likely to drag in that WP's own cruft along with it. I write in Sigil because I'm not really sure what workflow will result in the cleanest code, other than just doing it in Notepad++. I know from experience that Word and Windows Scrivener (which is basically an RTF editor with extra stuff added in) are not great for this. Any suggestions for this? What do you guys use?

2. I don't see how even its intended use case is helped by randomly choosing whether to add a <p> or a <div> when typing in Book View. I'm sure there's some distinguishing feature, something I'm doing that's causing one to happen instead of the other, but darn if I know what it is. (If I knew what it was, I could avoid it. That'd probably be the best scenario actually, figuring out what I'm doing that triggers it....)

Last edited by rodneylives; 06-08-2017 at 01:31 AM.
Reason: Adding plea for understanding at end.