Improved styling

This commit is contained in:
Leonardo Cavaletti 2020-05-17 19:17:26 +01:00
parent 3ff70de1b2
commit f93e9b8faf
3 changed files with 12 additions and 17 deletions

View File

@ -30,24 +30,19 @@ div[role="button"]:not(.notion-record-icon):hover {
padding-left: 0 !important;
}
/* normalizes database views width */
.notion-list-view,
.notion-gallery-view,
.notion-table-view,
.notion-board-view,
.notion-calendar-view {
padding-left: 0 !important;
padding-right: 0 !important;
}
/* add padding to banner, but not to image */
.notion-scroller > div:first-child > div:last-child {
.notion-scroller > div:first-child > div:last-child:not(.notion-collection_view_page-block) {
padding-right: 2em !important;
padding-left: 2em !important;
}
/* add padding to content */
.notion-scroller > div:nth-child(2) {
.notion-scroller > div:nth-child(2),
.notion-list-view,
.notion-gallery-view,
.notion-table-view,
.notion-board-view,
.notion-calendar-view {
padding-right: 2em !important;
padding-left: 2em !important;
}

View File

@ -56,6 +56,6 @@ for (let i = 0; i < pendingIframes.length; i++) {
const collectionSearchBoxes = document.getElementsByClassName("collectionSearch");
for (let i = 0; i < collectionSearchBoxes.length; i++) {
const collectionSearchBox = collectionSearchBoxes.item(i).parentElement();
const collectionSearchBox = collectionSearchBoxes.item(i).parentElement;
collectionSearchBox.style.display = "none";
}

View File

@ -311,12 +311,12 @@ class Parser():
fonts_selectors = {
"site" : "div:not(.notion-code-block)",
"navbar": ".notion-topbar div",
"title" : ".notion-page-block, .notion-collection_view_page-block",
"title" : ".notion-page-block > div, .notion-collection_view_page-block > div",
"h1" : ".notion-header-block div",
"h2" : ".notion-sub_header-block div",
"h3" : ".notion-sub_sub_header-block div",
"body" : ".notion-app-inner",
"code" : ".notion-code-block *"
"code" : ".notion-code-block *",
}
custom_fonts = self.get_page_config(url).get("fonts", {})
if (custom_fonts):
@ -335,12 +335,12 @@ class Parser():
for target, custom_font in custom_fonts.items():
if custom_font and not target == "site":
log.debug(f"Setting {target} font-family to {custom_font}")
font_override_stylesheet.append(fonts_selectors[target] + " {font-family:" + custom_font + " !important}")
font_override_stylesheet.append(fonts_selectors[target] + " {font-family:" + custom_font + " !important} ")
site_font = custom_fonts.get("site", None)
# process global site font last to more granular settings can override it
if (site_font):
log.debug(f"Setting global site font-family to {site_font}"),
font_override_stylesheet.append(fonts_selectors["site"] + " {font-family:" + site_font + "}")
font_override_stylesheet.append(fonts_selectors["site"] + " {font-family:" + site_font + "} ")
# finally append the font overrides stylesheets to the page
soup.head.append(font_override_stylesheet)