Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 13 additions & 6 deletions init.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,15 +83,22 @@ async function createFileIfNotExists(
isQuiet: boolean,
) {
try {
const existingContent = await Deno.readTextFile(filePath);
if (existingContent) {
console.error(` - Error: File already exists: ${filePath}`);
}
await Deno.readTextFile(filePath);
console.error(` - Error: File already exists: ${filePath}`);
return;
} catch (error) {
if (!(error instanceof Deno.errors.NotFound)) {
const errorDetails =
error instanceof Error ? `${error.name}: ${error.message}` : String(error);
console.error(
` - Error: Could not read: ${filePath}. Underlying error: ${errorDetails}`,
);
return;
}
try {
await Deno.writeTextFile(filePath, content);
if (!isQuiet) console.log(` - ${filePath}`);
} catch (writeError) {
} catch (_writeError) {
console.error(` - Error: Could not write: ${filePath}`);
}
}
Expand Down Expand Up @@ -133,7 +140,7 @@ async function main() {
console.error("Project directory already exists.");
}
return;
} catch (error) {
} catch (_error) {
// Directory doesn't exist, continue
}

Expand Down
3 changes: 0 additions & 3 deletions mod.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,15 +30,12 @@ export default function (options: Partial<Options> = {}) {

// Internal
"_includes/components/search.njk",
"_includes/components/toc.njk",
"_includes/components/breadcrumbs.njk",
"_includes/layout/body.njk",
"_includes/layout/html.njk",
"_includes/partials/nav.njk",
"_includes/partials/footer.njk",
"_includes/partials/sidebar.njk",
"_includes/page.njk",
"_includes/page_right.njk",
"_data.json",
];

Expand Down
4 changes: 2 additions & 2 deletions plugins.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ export default function (options: Options = {}) {
"https://cdn.jsdelivr.net/gh/highlightjs/cdn-release@11.6.0/build/styles/github-dark.min.css",
);

site.process([".md"], (pages: Page) => {
site.process([".md"], (pages: Page[]) => {
pages.forEach((page) => {
// Replace <!-- toc --> with the actual toc from page.data.toc_string
if (page.data.toc && page.data.toc.length) {
Expand All @@ -74,7 +74,7 @@ export default function (options: Options = {}) {
});

// Substitution feature
site.process([".md"], (pages: Page) => {
site.process([".md"], (pages: Page[]) => {
pages.forEach((page) => {
if (page.data.substitute) {
for (const obj of Object.entries(page.data.substitute)) {
Expand Down
2 changes: 1 addition & 1 deletion src/_includes/partials/nav.njk
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
<!-- Aux Top Links -->
{% for link in top_links %}
<li class="right">
<a href="{{ link.url }}" title="{{ link.title }}" title="{{ link.title }}">
<a href="{{ link.url }}" title="{{ link.title }}">
<i class="{{ link.icon }}"></i>
</a>
</li>
Expand Down
4 changes: 2 additions & 2 deletions src/_includes/partials/sidebar.njk
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<!-- Brand Name -->
<li>
{% if metas.logo %}
<img class="navbar-logo" src="{{ metas.icon | url }}">
<img class="navbar-logo" src="{{ metas.logo | url }}" alt="{{ metas.site }}">
{% endif %}
<a class="navbar-brand" href="/">
{{ metas.site }}
Expand All @@ -24,7 +24,7 @@
<!-- Aux Top Links -->
{% for link in top_links %}
<li class="mobile right">
<a href="{{ link.url }}" title="{{ link.title }}" title="{{ link.title }}">
<a href="{{ link.url }}" title="{{ link.title }}">
<i class="{{ link.icon }}"></i>
</a>
</li>
Expand Down