feat(blog): add :::gallery directive for responsive image grids - #14
Open
paras-verma7454 wants to merge 5 commits into
Open
feat(blog): add :::gallery directive for responsive image grids#14paras-verma7454 wants to merge 5 commits into
:::gallery directive for responsive image grids#14paras-verma7454 wants to merge 5 commits into
Conversation
- Resolved conflicts in BlogListing.tsx, [slug]/page.tsx, ThemeToggle.tsx, package.json - Regenerated pnpm-lock.yaml with unified stack + Next.js 16.3.1 - Kept SSR rendering, gallery captions, lint fixes on top of upgraded base
Contributor
|
@paras-verma7454 is attempting to deploy a commit to the Manixh Team Team on Vercel. A member of the Team first needs to authorize it. |
:::gallery directive for responsive image grids:::gallery directive for responsive image grids
Member
Author
There was a problem hiding this comment.
Pull request overview
Adds a new :::gallery container directive for responsive multi-image grids and migrates blog post Markdown rendering from client-side (react-markdown) to a server-side unified/remark/rehype pipeline with pre-rendered HTML injection.
Changes:
- Introduces a directives preprocessor + remark plugin to support
:::gallery columns=2|3|4syntax. - Adds a server-side Markdown→HTML renderer with post-processing for code blocks, tables, links, and images, then injects the HTML in the
[slug]page. - Restores/extends
.blog-proseand adds gallery CSS to match the new server-rendered markup.
Reviewed changes
Copilot reviewed 11 out of 12 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| pnpm-lock.yaml | Locks new unified/remark/rehype and directive dependencies (plus eslint sub-dep bumps). |
| package.json | Adds unified/remark/rehype pipeline deps and @eslint/eslintrc dev dependency. |
| lib/markdown/directives.ts | Implements :::gallery directive handling + directive attribute preprocessing. |
| lib/markdown/directives.test.ts | Adds unit tests for directive parsing, preprocessing, and HTML emission. |
| lib/content/markdown.ts | Adds server-side Markdown→HTML pipeline + AST post-processing for layout/styling hooks. |
| components/theme/ThemeToggle.tsx | Removes an inline comment during lint fixes. |
| components/blog/MarkdownBody.tsx | Updates client-side fallback renderer to support directives + gallery handling. |
| components/blog/MarkdownBody.test.tsx | Adds tests for gallery rendering behavior in the client-side fallback. |
| app/globals.css | Restores/extends .blog-prose typography and adds .gallery grid/card styles. |
| app/BlogListing.tsx | Adjusts query state syncing logic (lint-related). |
| app/[slug]/page.tsx | Switches post body rendering to dangerouslySetInnerHTML using pre-rendered HTML. |
| AGENTS.md | Documents the new rendering pipeline and authoring guidance for galleries. |
Files not reviewed (1)
- pnpm-lock.yaml: Generated file
Suppressed comments (1)
app/globals.css:557
- Same issue as above: caption styling for gallery cards uses
prefers-color-schemeinstead of the.darkclass, so it can get out of sync with the theme toggle.
Switch to .dark ... selectors.
.blog-prose .gallery > p > span > span {
color: #a3a3a3;
border-color: #262626;
}
}
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Member
Author
|
Done |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What does this PR do?
Adds a
:::gallerycontainer directive that renders multiple images side-by-side in a responsive grid layout, plus converts blog post markdown rendering from client-side (react-markdown) to server-side (unified/remark/rehype pipeline at build time).Closes #12
What's included
Gallery directive (
:::gallery)columnsattribute — optional, defaults to 2; supports values 2, 3, 4:::gallery columns=3...:::Server-side markdown rendering
unified+remark-parse+remark-rehype+rehype-highlight+rehype-stringify[slug]/page.tsxnow usesdangerouslySetInnerHTMLwith pre-rendered HTML instead of the client-side<MarkdownBody>componentMarkdownBody.tsxkept as a client-side fallback (not deleted).blog-proseCSS restored for server-rendered typography (headings, paragraphs, lists, blockquotes, tables, code blocks, links)Lint fixes
react-hooks/set-state-in-effecterrors inBlogListing.tsx,SearchOverlay.tsx, andThemeToggle.tsxRequirements checklist (from #12)
columnsattribute: optional, default 2, valid values 2, 3, 4Verification
pnpm lint— 0 errorspnpm typecheck— passpnpm format:check— passpnpm test— 46/46 passpnpm build— 97/97 pages static