Skip to content

feat: add ogimage subcommand for OGP image generation from markdown - #159

Merged
rokuosan merged 3 commits into
rokuosan:mainfrom
rokuosanai:feat/ogimage-subcommand
Jul 29, 2026
Merged

feat: add ogimage subcommand for OGP image generation from markdown#159
rokuosan merged 3 commits into
rokuosan:mainfrom
rokuosanai:feat/ogimage-subcommand

Conversation

@rokuosanai

Copy link
Copy Markdown
Contributor

Summary

Implements milestone 2 of #21 — adds an ogimage subcommand that generates OGP images from local Hugo-compatible markdown files.

Changes

  • pkg/core/article_parser.goParseArticleFromMarkdown() function to read Hugo-compatible markdown (YAML frontmatter) back into core.Article
  • cmd/cli/subcommand/ogimage.go — New ogimage subcommand with:
    • -f/--file flag for markdown file path (required)
    • -t/--template flag for custom OGP HTML template (optional)
    • Parses markdown → ArticleOGPData → rendered JPEG
    • Output saved as ogp.jpeg in configured image output directory
  • cmd/cli/cli.go — Register ogimage subcommand in root CLI
  • Tests — Unit tests for command flags, article-to-OGPData conversion, date formatting, output path resolution, and integration test skeleton

Depends on

Closes #154

rokuosanai added a commit to rokuosanai/github-issue-cms that referenced this pull request Jul 28, 2026
…uosan#159)

- articleToOGPData: return zero-value OGPData when article is nil
- resolveOGPOutputPath: return error when article is nil or Output config missing
- Add filepath.Clean for path safety
rokuosanai added a commit to rokuosanai/github-issue-cms that referenced this pull request Jul 28, 2026
…dit rokuosan#159)

- Normalize Windows CRLF line endings to LF
- Handle closing frontmatter delimiter at EOF (--- without trailing newline)
- Add frontmatter prefix validation before parsing
- Add ParseArticleFromMarkdown to core package for reading Hugo-compatible
  markdown files with YAML frontmatter back into core.Article
- Add 'ogimage' subcommand to CLI with -f/--file and -t/--template flags
- Convert Article to OGPData and render via pkg/ogimage
- Output ogp.jpeg into the configured image output directory
- Register ogimage command in root CLI

Closes rokuosan#154
…uosan#159)

- articleToOGPData: return zero-value OGPData when article is nil
- resolveOGPOutputPath: return error when article is nil or Output config missing
- Add filepath.Clean for path safety
…dit rokuosan#159)

- Normalize Windows CRLF line endings to LF
- Handle closing frontmatter delimiter at EOF (--- without trailing newline)
- Add frontmatter prefix validation before parsing
@rokuosanai
rokuosanai force-pushed the feat/ogimage-subcommand branch from f34b969 to ebb4393 Compare July 29, 2026 03:25
@rokuosan

Copy link
Copy Markdown
Owner

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Swish!

Reviewed commit: ebb43930e1

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@rokuosan
rokuosan merged commit 10384b0 into rokuosan:main Jul 29, 2026
4 checks passed
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.

Add ogimage subcommand

2 participants