Repository navigation
fix: prevent table from absorbing following shortcode as a row - #3
Conversation
Insert a blank line between a markdown table and a following non-table line (e.g. a Hugo shortcode closing tag) before handing content to Prettier's markdown formatter. Without this, remark-gfm's table extension absorbs the next non-blank line as an extra single-cell table row when no blank line separates it from the table. Also adds a tag-triggered GitHub Actions workflow that creates a GitHub Release with auto-generated notes on 'v*' tag pushes, and bumps the package version to 0.0.1-rc.2 for release. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
There was a problem hiding this comment.
🟡 Changes recommended
The new table-row detection is overly broad (treats any | line as a table row) and can introduce unintended blank-line mutations for non-table content like Go template pipelines.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Pull request overview
This PR addresses a Markdown formatting edge case in the plugin’s pre-Prettier normalization step, preventing remark-gfm/Prettier from incorrectly treating a Hugo shortcode closing tag as an extra GFM table row when it immediately follows a table.
Changes:
- Insert a blank line between a GFM table and the next non-table line during template preprocessing to avoid remark-gfm table “absorption”.
- Add a regression test covering a table immediately followed by a closing shortcode.
- Add a tag-push GitHub Release workflow and document it; bump version and update changelog and lockfile.
File summaries
| File | Description |
|---|---|
src/features/printers/printers.ts |
Adds table-termination spacing logic in ensureProperBlockSpacing() plus a helper to detect table rows. |
tests/suites/basic-functionality.test.js |
Adds regression test ensuring a closing shortcode is not reformatted into a table row. |
.github/workflows/release.yml |
New workflow to create GitHub Releases on v* tag pushes with generated notes. |
docs/development/publishing.md |
Documents the new tag-triggered GitHub Release workflow and its relationship to npm publishing. |
package.json |
Bumps package version and updates dev dependency versions. |
CHANGELOG.md |
Adds 0.0.1-rc.2 entry with the bug fix and release-workflow note. |
bun.lock |
Updates lockfile to reflect dependency bumps. |
Review details
- Files reviewed: 6/7 changed files
- Comments generated: 1
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Tighten isMarkdownTableRow() so lines like {{ .Title | upper }} are
never treated as GFM table rows. The previous check flagged any line
containing '|', which caused ensureProperBlockSpacing() to insert
unwanted blank lines around Go template pipe expressions and other
non-table pipe usage.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Summary
{{</ table >}}) as an extra single-cell table row, because Prettier's underlying markdown parser (remark-gfm) requires a blank line to terminate a table.0.0.1-rc.2release (version bump + changelog).Changes
src/features/printers/printers.ts:ensureProperBlockSpacing()now inserts a blank line between a Markdown table and a following non-table line, so the following line (e.g. a Hugo shortcode) is not absorbed as an extra table row. AddedisMarkdownTableRow(), a conservative pipe-based table row detector that explicitly excludes Go template lines ({{ ... }}) and non-table pipe usage (e.g.{{ .Title | upper }}) to avoid false positives.tests/suites/basic-functionality.test.js: added regression tests covering (1) the reported table/shortcode absorption bug and (2) that Go template pipelines are not misclassified as table rows..github/workflows/release.yml: new workflow, triggered onv*tag pushes, creates a GitHub Release viagh release create --generate-notes.docs/development/publishing.md: documents the new tag-triggered release workflow and clarifies it is separate from the manual npm publish flow.package.json/bun.lock: version bump to0.0.1-rc.2and routine dependency updates (@types/node,lefthook,oxlint).CHANGELOG.md: added0.0.1-rc.2entry documenting the fix and the new release workflow.Validation
bun run lint— passesbun run format:check— passesbun test— 59 pass, 0 fail (includes 2 new regression tests)Risks
Checklist