Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Software > Calibre > Conversion

Notices

Reply
 
Thread Tools Search this Thread
Old 07-14-2022, 08:02 PM   #1
AccidentallyLazy
Member
AccidentallyLazy began at the beginning.
 
Posts: 16
Karma: 10
Join Date: Oct 2020
Device: Kindle Oasis 3
Adding custom code when converting?

I convert all my books to KFX to take advantage of the features it provides, however I also like to slightly edit the resulting file.

html {
margin-left: -35px;
margin-right: -35px;
break-inside: avoid !important
}

I use the above to push the text closer to the edges of my device, removing empty space, and...

body, div, h1, h2, h3, h4, h5, h6, p {orphans: 1 !important; widows: 1 !important;

...the above to remove the resulting extra blank spaces added when converting to KFX, so the text goes from the top right to the bottom of each page.

The problem I have is that I add the html manually to the book, then add the CSS when converting which means it takes forever to convert a bunch of books as I have to edit>add code>save for every single one.

Is there any way to add both these codes when converting, so that I can just select a handful of books and have these added all at once during conversion?

Thanks.
AccidentallyLazy is offline   Reply With Quote
Old 07-14-2022, 09:12 PM   #2
gbm
Wizard
gbm ought to be getting tired of karma fortunes by now.gbm ought to be getting tired of karma fortunes by now.gbm ought to be getting tired of karma fortunes by now.gbm ought to be getting tired of karma fortunes by now.gbm ought to be getting tired of karma fortunes by now.gbm ought to be getting tired of karma fortunes by now.gbm ought to be getting tired of karma fortunes by now.gbm ought to be getting tired of karma fortunes by now.gbm ought to be getting tired of karma fortunes by now.gbm ought to be getting tired of karma fortunes by now.gbm ought to be getting tired of karma fortunes by now.
 
Posts: 2,188
Karma: 8888888
Join Date: Jun 2010
Device: Kobo Clara HD,Hisence Sero 7 Pro RIP, Nook STR, jetbook lite
Yes:

Click image for larger version

Name:	Screenshot from 2022-07-14 21-10-38.png
Views:	88
Size:	999.1 KB
ID:	195000

bernie

Quote:
Originally Posted by AccidentallyLazy View Post
I convert all my books to KFX to take advantage of the features it provides, however I also like to slightly edit the resulting file.

html {
margin-left: -35px;
margin-right: -35px;
break-inside: avoid !important
}

I use the above to push the text closer to the edges of my device, removing empty space, and...

body, div, h1, h2, h3, h4, h5, h6, p {orphans: 1 !important; widows: 1 !important;

...the above to remove the resulting extra blank spaces added when converting to KFX, so the text goes from the top right to the bottom of each page.

The problem I have is that I add the html manually to the book, then add the CSS when converting which means it takes forever to convert a bunch of books as I have to edit>add code>save for every single one.

Is there any way to add both these codes when converting, so that I can just select a handful of books and have these added all at once during conversion?

Thanks.
gbm is offline   Reply With Quote
Advert
Old 07-15-2022, 07:20 AM   #3
AccidentallyLazy
Member
AccidentallyLazy began at the beginning.
 
Posts: 16
Karma: 10
Join Date: Oct 2020
Device: Kindle Oasis 3
This will both remove the blank space as well as add the negative margins? If it only replaces the blank space (like body, div, h1, h2, h3, h4, h5, h6, p {orphans: 1 !important; widows: 1 !important, then I already add the above in the 'extra CSS window.

I meant can I also add the HTML during conversion, rather than having to open and edit every individual book and add it manually?

EDIT: Actually, just adding both to the 'extra CSS' box appears to actually work, I'll test it on a few and see. I didn't think adding both at the same time would work.

Thanks.

Last edited by AccidentallyLazy; 07-15-2022 at 07:56 AM.
AccidentallyLazy is offline   Reply With Quote
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Help adding cover_image code pacha2 Recipes 2 02-09-2020 03:41 PM
Converting HTML to EPUB - <pre> and <code> issues csokol Conversion 1 10-28-2012 10:16 AM
Custom code in ePub titlepage.xhtml Mrs_Often Conversion 6 07-24-2012 12:36 PM
Source code for converting html to mobi Thisiswhatiam Kindle Formats 10 06-04-2012 02:47 PM
Sigil Automatically Adding Code christinerose Sigil 7 04-28-2011 11:07 AM


All times are GMT -4. The time now is 03:40 AM.


MobileRead.com is a privately owned, operated and funded community.