|  03-06-2023, 12:25 AM | #1 | 
| Enthusiast            Posts: 33 Karma: 48958 Join Date: May 2017 Device: iPad Pro 9.7" | 
				
				Turn off auto-formatting of CSS?
			 
			
			Is there a way to stop the calibre editor from messing with the CSS formatting? It's formatting choices are odd, not the ones I want, and too many things other than "Beautify" result in a autoreformat (e.g. "Organize into folders"?!?). I have read and searched through the editor documentation, the editor Settings, and done some other web searches and not turned up anything. If there is not a way, please consider an Editor setting to leave CSS formatting alone. If there is a way, a pointer would be greatly appreciated. Thanks! | 
|   |   | 
|  03-06-2023, 12:48 AM | #2 | 
| Wizard            Posts: 1,687 Karma: 9500498 Join Date: Sep 2021 Location: Australia Device: Kobo Libra 2 | 
			
			Are you referring to the code in the stylesheet.css? What exactly is being changed? I've never noticed the editor change anything my my stylesheets. | 
|   |   | 
| Advert | |
|  | 
|  03-06-2023, 03:28 AM | #3 | 
| Well trained by Cats            Posts: 31,249 Karma: 61360164 Join Date: Aug 2009 Location: The Central Coast of California Device: Kobo Libra2,Kobo Aura2v1, K4NT(Fixed: New Bat.), Galaxy Tab A | 
			
			I was surprised about the word 'odd'. Except for the quirky coloring of the first 2 lines, it seemed to be pretty standard code styled.
		 | 
|   |   | 
|  03-06-2023, 04:12 AM | #4 | |
| Wizard            Posts: 1,687 Karma: 9500498 Join Date: Sep 2021 Location: Australia Device: Kobo Libra 2 | Quote: 
  Where do you see coloured lines and standard code styling? Last edited by Karellen; 03-06-2023 at 04:15 AM. | |
|   |   | 
|  03-06-2023, 05:16 AM | #5 | |
| Resident Curmudgeon            Posts: 80,740 Karma: 150249619 Join Date: Nov 2006 Location: Roslindale, Massachusetts Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3 | Quote: 
 | |
|   |   | 
| Advert | |
|  | 
|  03-06-2023, 05:45 AM | #6 | 
| null operator (he/him)            Posts: 22,010 Karma: 30277294 Join Date: Mar 2012 Location: Sydney Australia Device: none | 
			
			Perhaps the OP is referring to calibre changing the manner in which the content of CSS files is presented, not changing the actual text within them. e.g: changing: Code: p {font-family: verdana; font-size: 20px;}Code: p {
  font-family: verdana;
  font-size: 20px;
} | 
|   |   | 
|  03-06-2023, 05:59 AM | #7 | |
| Resident Curmudgeon            Posts: 80,740 Karma: 150249619 Join Date: Nov 2006 Location: Roslindale, Massachusetts Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3 | Quote: 
 It's also possible that the OP has "Update metadata in the book when opening selected". That can be turned off via Edit > Preferences > Integration with calibre. Last edited by JSWolf; 03-06-2023 at 06:02 AM. | |
|   |   | 
|  03-06-2023, 10:41 AM | #8 | |
| Well trained by Cats            Posts: 31,249 Karma: 61360164 Join Date: Aug 2009 Location: The Central Coast of California Device: Kobo Libra2,Kobo Aura2v1, K4NT(Fixed: New Bat.), Galaxy Tab A | Quote: 
 Code styling = indented | |
|   |   | 
|  03-06-2023, 10:44 PM | #9 | 
| Enthusiast            Posts: 33 Karma: 48958 Join Date: May 2017 Device: iPad Pro 9.7" | 
			
			I said nothing about changing the CSS itself, I said the CSS formatting, i.e. the way it looks. I also said it had nothing to do with Beautify, and gave an example of a thing that reformats the CSS. "Beautify individual files on open" is not selected, and neither is "Update metadata in the book…"
		 | 
|   |   | 
|  03-06-2023, 11:28 PM | #10 | |
| Wizard            Posts: 1,687 Karma: 9500498 Join Date: Sep 2021 Location: Australia Device: Kobo Libra 2 | Quote: 
 Is it too hard to provide a before/after example? Like I said, I have never seen anything change in my css files. I guess that is because I create them exactly as Calibre expects. | |
|   |   | 
|  03-07-2023, 01:11 AM | #11 | 
| creator of calibre            Posts: 45,604 Karma: 28548974 Join Date: Oct 2006 Location: Mumbai, India Device: Various | 
			
			No, there's no way to do that. Organize into folder causes file paths to change, changing file paths means url resources in CSS sheets potentially have to be re-written, which means they have to be parsed and serialized. And no, I dont have any interest in writing my own CSS parser/serializer that preserves original formatting.
		 | 
|   |   | 
|  03-07-2023, 04:25 AM | #12 | |
| Resident Curmudgeon            Posts: 80,740 Karma: 150249619 Join Date: Nov 2006 Location: Roslindale, Massachusetts Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3 | Quote: 
 | |
|   |   | 
|  03-07-2023, 09:44 PM | #13 | 
| Enthusiast            Posts: 33 Karma: 48958 Join Date: May 2017 Device: iPad Pro 9.7" | 
			
			Kovid, what third-party (I assume?) library/code/whatever are you using to parse/serialize the CSS?
		 | 
|   |   | 
|  03-07-2023, 09:58 PM | #14 | 
| creator of calibre            Posts: 45,604 Karma: 28548974 Join Date: Oct 2006 Location: Mumbai, India Device: Various | |
|   |   | 
|  03-08-2023, 12:59 PM | #15 | 
| Enthusiast            Posts: 33 Karma: 48958 Join Date: May 2017 Device: iPad Pro 9.7" | 
			
			Thanks, I'll look into that more. Without knowing what else (other than beautify and folders) rewrites (and thus reformats) the CSS, is it possible/practical in the folders case to just have it not rewrite the file if there were no changes? IOW, A is original, B is parsed, C is after folder changes, if B=C, then don't overwrite A. | 
|   |   | 
|  | 
| Thread Tools | Search this Thread | 
| 
 | 
|  Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post | 
| Any way to turn off auto-hyphenation? | kytrid | Boyue | 9 | 09-21-2020 03:17 PM | 
| Stand and auto page turn | Lima7 | Kobo Reader | 2 | 09-07-2018 02:58 PM | 
| Auto turn pages | maac2212 | Kindle Developer's Corner | 3 | 05-19-2016 08:19 AM | 
| permanently turn off auto rotate | xxtraloud | Kindle Developer's Corner | 1 | 04-25-2014 01:03 AM | 
| iPod How to turn off auto rotate? | Ea | Apple Devices | 5 | 09-23-2010 03:56 AM |