Skip to content

Conversation

@Arlodotexe
Copy link
Member

@Arlodotexe Arlodotexe commented Nov 9, 2025

Summary

Adds blog generator feature with storage-first virtual IFolder pattern for markdown-to-HTML transformation. Implements Single-Page (Post/Page) scenario with PostPageFolder virtual IFolder architecture, enabling future Multi-Page composition.

Features

  • Markdown Processing: YAML front-matter extraction + Markdig HTML transformation
  • Template System: Scriban template rendering with file or folder templates
  • Asset Management: Automatic template asset copying with recursive folder mirroring
  • Lazy Generation: Content generated on access, not construction
  • Folderized Output: filename/index.html structure for clean URLs
  • Storage-First: Virtual IFolder pattern enables composition for Multi-Page scenarios

Implementation

New Components:

  • PostPageFolder: Virtual IFolder wrapping markdown source, yields IndexHtmlFile + assets
  • IndexHtmlFile: Lazy HTML generation on content access (markdown → HTML → template)
  • PostPageAssetFolder: Recursive template asset wrapper preserving folder hierarchy
  • PostPageCommand: CLI command for Single-Page generation

Architecture:

  • Virtual IFolder pattern (no immediate materialization)
  • Composition-ready design for PagesFolder (Multi-Page scenario)
  • Consumer controls materialization timing via IFolder operations

Validation

  • ✅ Manual baseline: Output matches development testing baseline
  • ✅ Feature complete: All 9 capabilities working (markdown, front-matter, templates, assets, folderization, sanitization, error handling, lazy generation, composition-ready)
  • ✅ CLI integration: PostPageCommand functional

Documentation

The planning and execution docs in their completed states, rendered to webpages using the finished code they represent:

Next Steps

  • Multi-Page (PagesFolder) implementation
  • Full Site (Blog) integration
  • Automated tests (none exist currently)

- Add WacsdkBlogCommands.cs aggregator
- Add PostPage/PostPageCommand.cs CLI command
- Add PostPage/PostPageGenerator.cs transformation logic
- Add PostPage/PostPageDataModel.cs Scriban data contract

Nested structure isolates scenarios, prevents interdependencies.
Implementation separate from commands for reusability by future scenarios.
- Implemented PostPageGenerator with 3 partial files:
  - PostPageGenerator.Markdown.cs: ParseMarkdown, TransformMarkdown, ParseFrontmatter
  - PostPageGenerator.Template.cs: ResolveTemplate, CopyAssets, RenderTemplate
  - PostPageGenerator.cs: CreateDataModel, CreateOutputFolder, WriteIndexHtml, GenerateAsync orchestrator

- Implemented PostPageCommand with CLI interface:
  - 4 options: --markdown, --template, --output, --template-file
  - Path resolution using SystemFile/SystemFolder constructors
  - Template type detection via Directory.Exists
  - Generator invocation with proper error handling

- Applied all 12 gap resolutions from planning:
  - Markdig Advanced Extensions, YamlDotNet error handling, template conventions
  - DepthFirstRecursiveFolder for asset copying, path sanitization
  - Exception-based error handling, silent overwrite behavior

- Ready for testing & validation
- Replaced side-effect orchestrator with virtual IFolder implementation

- Enables Multi-Page composition (prerequisite for PagesFolder)

- Backward compatible: PostPageCommand behavior unchanged

- Manual validation: Output matches pre-refactor baseline

Components:

- PostPageFolder: Virtual IFolder wrapping markdown source

- IndexHtmlFile: Lazy generation on content access

- PostPageAssetFolder: Recursive template asset mirroring

Removed:

- PostPageGenerator.cs (3 partials)

Modified:

- PostPageCommand.cs: Direct PostPageFolder integration

Refs:

- planning,post-page,refactor.md (requirements)

- planning,post-page,refactor,execution.md (implementation tracking)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants