Skip to content

Commit

Permalink
handle fail cases, fix content width, hide empty sidebars, 1.8.0-6b
Browse files Browse the repository at this point in the history
  • Loading branch information
KosmosisDire committed Feb 2, 2024
1 parent 14065e0 commit 1bc9cac
Show file tree
Hide file tree
Showing 7 changed files with 37 additions and 14 deletions.
7 changes: 6 additions & 1 deletion assets/deferred.txt.css
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,12 @@ body.floating-sidebars .sidebar {
border-bottom-left-radius: var(--radius-l);
}

/* Hide empty sidebars */
.sidebar:has(.sidebar-content:empty)
{
display: none;
}

.sidebar-topbar {
height: 2em;
width: var(--sidebar-width);
Expand Down Expand Up @@ -166,7 +172,6 @@ body.floating-sidebars .sidebar {
height: 100%;
}


.sidebar-section-header
{
margin: 0 0 1em 0;
Expand Down
18 changes: 13 additions & 5 deletions assets/deferred.txt.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,23 @@ async function loadIncludes()
let includeTag = includeTags[i];
let includePath = includeTag.getAttribute("src");

const request = await fetch(includePath);
if (!request.ok)
try
{
const request = await fetch(includePath);
if (!request.ok)
{
console.log("Could not include file: " + includePath);
continue;
}

let includeText = await request.text();
includeTag.outerHTML = includeText;
}
catch (e)
{
console.log("Could not include file: " + includePath);
continue;
}

let includeText = await request.text();
includeTag.outerHTML = includeText;
}
}
else
Expand Down
5 changes: 3 additions & 2 deletions assets/plugin-styles.txt.css
Original file line number Diff line number Diff line change
Expand Up @@ -371,7 +371,8 @@ body .webpage-container .tree-container .tree-scroll-area
{
transition: height ease-in-out, margin-bottom ease-in-out;
transition-duration: 0.2s;
display: inline;
display: flex;
flex-direction: column;
position: relative;
}

Expand All @@ -387,7 +388,7 @@ html > body > .webpage-container > .document-container > .markdown-preview-view

.markdown-rendered .heading-wrapper:has(> .heading-children > div:last-child > :is(p,pre,table,ul,ol)) + .heading-wrapper > .heading:first-child
{
margin-top: var(--heading-spacing);
margin-top: var(--heading-spacing) !important;
}

.heading-children
Expand Down
2 changes: 1 addition & 1 deletion manifest-beta.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"id": "webpage-html-export",
"name": "Webpage HTML Export",
"version": "1.8.0-5b",
"version": "1.8.0-6b",
"minAppVersion": "1.4.0",
"description": "Export full websites or html documents from single files, canvas pages, or whole vaults. Similar to obsidian's publish or digital garden, but with direct access to the exported HTML. Focuses on flexibility, features, and style parity.",
"author": "Nathan George",
Expand Down
2 changes: 1 addition & 1 deletion manifest.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"id": "webpage-html-export",
"name": "Webpage HTML Export",
"version": "1.8.0-5b",
"version": "1.8.0-6b",
"minAppVersion": "1.4.0",
"description": "Export html from single files, canvas pages, or whole vaults. Direct access to the exported HTML files allows you to publish your digital garden anywhere. Focuses on flexibility, features, and style parity.",
"author": "Nathan George",
Expand Down
6 changes: 3 additions & 3 deletions scripts/html-generation/assets/global-variable-styles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@ export class GlobalVariableStyles extends Asset
if (!isNaN(Number(contentWidth))) contentWidth += "px";
if (!isNaN(Number(sidebarWidth))) sidebarWidth += "px";

let lineWidthCss = `min(${lineWidth}, calc(100vw - 2em)`;
let contentWidthCss = `min(${contentWidth}, calc(100vw - 2em)`;
let lineWidthCss = `min(${lineWidth}, calc(100vw - 2em))`;
let contentWidthCss = `min(${contentWidth}, calc(100vw - 2em))`;
this.content =
`
html body
:root body
{
--line-width: ${lineWidthCss};
--line-width-adaptive: ${lineWidthCss};
Expand Down
11 changes: 10 additions & 1 deletion scripts/objects/website-index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,16 @@ export class WebsiteIndex
{
let metadataPath = this.web.destination.join(Asset.libraryPath).joinString("metadata.json");
let metadata = await metadataPath.readFileString();
if (metadata) return JSON.parse(metadata);

try
{
if (metadata) return JSON.parse(metadata);
}
catch (e)
{
RenderLog.error(e, "Failed to parse metadata.json. Exporting all files.");
}

return undefined;
}

Expand Down

0 comments on commit 1bc9cac

Please sign in to comment.