alexadam / save-as-ebook

Save a web page/selection as an eBook (.epub format) - a Chrome/Firefox/Opera Web Extension
MIT License
1.1k stars 70 forks source link

Table borders are not present in the ePub #51

Open bunglegrind opened 2 years ago

bunglegrind commented 2 years ago

Similar to #50, borders are not present in the tables (and I suppose in every other place).

Save the following page:

https://dev.mysql.com/doc/refman/8.0/en/innodb-locking.html

with the custom CSS rules:

header,
#docs-sidebar-toc,
#docs-version-nav,
#docs-breadcrumbs,
#docs-in-page-nav-container,
footer
{
  display: none!important;
}

.has-toc {
  margin-left: 0!important;
  border-left: none!important;
}

and check the borders of the first table. I'm using Firefox on Windows, I haven't tested on Chrome. The reason is the "border" property: in Firefox it's an empty string and when you grab its content in

https://github.com/alexadam/save-as-ebook/blob/12a4cbb0813742a9617e30e73497f8cd9e403c41/web-extension/extractHtml.js#L329

you get nothing.

I've locally fixed the issue by changing the content of the supportedCss array in

https://github.com/alexadam/save-as-ebook/blob/12a4cbb0813742a9617e30e73497f8cd9e403c41/web-extension/extractHtml.js#L38


const supportedCss = [
    'background-color',
    'border-top-width',
    'border-top-style',
    'border-top-color',
    'border-bottom-width',
    'border-bottom-style',
    'border-bottom-color',
    'border-left-width',
    'border-left-style',
    'border-left-color',
    'border-right-width',
    'border-right-style',
    'border-right-color',
    'border-collapse',
    'color',
    'font',
    'line-height',
    'list-style',
    'padding',
    'text-align',
    'display'
];
bunglegrind commented 2 years ago

well, that's the same for padding

bunglegrind commented 2 years ago

...and font