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
This commit is contained in:
AlexKucera committed 2025-11-09 11:04:17 +01:00
1 parent d6d31afb16
commit efbff4e172
2 files changed
+5 -4

No files matched your search

@@ -115,7 +115,7 @@ export class FrontmatterProcessor {
// Return content without frontmatter, but add title as frontmatter for Pandoc // Return content without frontmatter, but add title as frontmatter for Pandoc
let processedContent: string; let processedContent: string;
if (this.noteTitle) { if (this.noteTitle) {
const titleFrontmatter = yaml.dump({ title: this.noteTitle }); const titleFrontmatter = yaml.dump({ title: this.noteTitle });
processedContent = `---\n${titleFrontmatter}---\n${parsed.content}`; processedContent = `---\n${titleFrontmatter}---\n${parsed.content}`;
} else { } else {
processedContent = parsed.content; processedContent = parsed.content;
@@ -182,7 +182,7 @@ export class FrontmatterProcessor {
if (this.preserveFrontmatter) { if (this.preserveFrontmatter) {
// Reconstruct frontmatter with modified title // Reconstruct frontmatter with modified title
if (this.noteTitle) { if (this.noteTitle) {
const newFrontmatter = yaml.dump(frontmatter); const newFrontmatter = yaml.dump(frontmatter);
let processedContent = content.replace(this.FRONTMATTER_PATTERN, `---\n${newFrontmatter}---\n`); let processedContent = content.replace(this.FRONTMATTER_PATTERN, `---\n${newFrontmatter}---\n`);
// Add printed frontmatter if requested // Add printed frontmatter if requested
@@ -201,7 +201,7 @@ export class FrontmatterProcessor {
} else { } else {
// Add title as frontmatter for Pandoc even when not preserving original // Add title as frontmatter for Pandoc even when not preserving original
if (this.noteTitle) { 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`); let processedContent = content.replace(this.FRONTMATTER_PATTERN, `---\n${titleFrontmatter}---\n`);
// Add printed frontmatter if requested // Add printed frontmatter if requested
@@ -324,6 +324,7 @@ export class FrontmatterProcessor {
} }
} else { } else {
// Handle null, undefined, or any other unexpected types // Handle null, undefined, or any other unexpected types
console.debug('FrontmatterProcessor: Unexpected type in frontmatter display formatting', `key: ${key}, type: ${typeof value}`);
formattedValue = ''; formattedValue = '';
} }
+1 -1
View File
@@ -21,7 +21,7 @@ export class TypographySection implements ModalSection {
// Font size settings are created after font dropdowns to preserve logical ordering // Font size settings are created after font dropdowns to preserve logical ordering
this.createFontSettings(state).catch(error => { this.createFontSettings(state).catch(error => {
console.error('Failed to create font settings:', 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
}); });
} }