From efbff4e1722f0ba042c7dd176f34fb7cb35e8c73 Mon Sep 17 00:00:00 2001 From: Alexander Kucera Date: Sun, 9 Nov 2025 11:04:17 +0100 Subject: [PATCH] Fixes indentation and adds debug logging Corrects inconsistent indentation in FrontmatterProcessor methods to improve code readability. Adds debug logging for unexpected types in frontmatter display formatting to aid troubleshooting. Improves robustness of font settings handling by clarifying fallback behavior on load failure in TypographySection. Relates to obsidian-bot-review --- src/converters/preprocessors/FrontmatterProcessor.ts | 7 ++++--- src/ui/modal/sections/TypographySection.ts | 2 +- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/converters/preprocessors/FrontmatterProcessor.ts b/src/converters/preprocessors/FrontmatterProcessor.ts index 58b139c..d0aa584 100644 --- a/src/converters/preprocessors/FrontmatterProcessor.ts +++ b/src/converters/preprocessors/FrontmatterProcessor.ts @@ -115,7 +115,7 @@ export class FrontmatterProcessor { // Return content without frontmatter, but add title as frontmatter for Pandoc let processedContent: string; if (this.noteTitle) { - const titleFrontmatter = yaml.dump({ title: this.noteTitle }); + const titleFrontmatter = yaml.dump({ title: this.noteTitle }); processedContent = `---\n${titleFrontmatter}---\n${parsed.content}`; } else { processedContent = parsed.content; @@ -182,7 +182,7 @@ export class FrontmatterProcessor { if (this.preserveFrontmatter) { // Reconstruct frontmatter with modified title if (this.noteTitle) { - const newFrontmatter = yaml.dump(frontmatter); + const newFrontmatter = yaml.dump(frontmatter); let processedContent = content.replace(this.FRONTMATTER_PATTERN, `---\n${newFrontmatter}---\n`); // Add printed frontmatter if requested @@ -201,7 +201,7 @@ export class FrontmatterProcessor { } else { // Add title as frontmatter for Pandoc even when not preserving original if (this.noteTitle) { - const titleFrontmatter = yaml.dump({ title: this.noteTitle }); + const titleFrontmatter = yaml.dump({ title: this.noteTitle }); let processedContent = content.replace(this.FRONTMATTER_PATTERN, `---\n${titleFrontmatter}---\n`); // Add printed frontmatter if requested @@ -324,6 +324,7 @@ export class FrontmatterProcessor { } } else { // Handle null, undefined, or any other unexpected types + console.debug('FrontmatterProcessor: Unexpected type in frontmatter display formatting', `key: ${key}, type: ${typeof value}`); formattedValue = ''; } diff --git a/src/ui/modal/sections/TypographySection.ts b/src/ui/modal/sections/TypographySection.ts index 1c3186c..3c19278 100644 --- a/src/ui/modal/sections/TypographySection.ts +++ b/src/ui/modal/sections/TypographySection.ts @@ -21,7 +21,7 @@ export class TypographySection implements ModalSection { // Font size settings are created after font dropdowns to preserve logical ordering this.createFontSettings(state).catch(error => { console.error('Failed to create font settings:', error); - // Font settings will fall back to default fonts if this fails + // If font loading fails, getAvailableFonts will use hardcoded fallback fonts }); }