Skip to content

Fix wrapping on render helper#699

Merged
feruzm merged 4 commits into
developfrom
code
Mar 9, 2026
Merged

Fix wrapping on render helper#699
feruzm merged 4 commits into
developfrom
code

Conversation

@feruzm
Copy link
Copy Markdown
Member

@feruzm feruzm commented Mar 9, 2026

Summary by CodeRabbit

  • Bug Fixes

    • Mentions and hashtags inside inline code or code blocks are no longer converted to links; code snippets remain preserved.
    • Linkification now correctly skips text contained within code-related ancestors.
  • Tests

    • Added tests ensuring mentions/hashtags inside inline/backtick and fenced code are not linkified, while outside-code mentions still are.
  • Chores

    • Package version and changelog updated.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Mar 9, 2026

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: f566f93f-77c0-4d69-8e44-554f92e31906

📥 Commits

Reviewing files that changed from the base of the PR and between 1a3328b and 67588af.

📒 Files selected for processing (3)
  • packages/render-helper/CHANGELOG.md
  • packages/render-helper/package.json
  • packages/render-helper/src/markdown-2-html.spec.ts

📝 Walkthrough

Walkthrough

Adds ancestor-based guards to skip transforming mentions/hashtags when text or author elements are inside inline code, fenced code blocks, or pre elements; updates enhancer and text-processing logic and adds tests covering these scenarios.

Changes

Cohort / File(s) Summary
Rendering core
packages/render-helper/src/methods/text.method.ts
Introduce hasAncestor helper and expand skip logic so text nodes with a, code, or pre ancestors are ignored.
Author link enhancer
apps/web/src/features/post-renderer/components/utils/hiveAuthorLinkEnhancer.tsx
Add guard to skip enhancing author links when the element is inside code or pre.
Tests — markdown → HTML
packages/render-helper/src/markdown-2-html.spec.ts
Add suite verifying mentions/hashtags inside backticks, inline code, and fenced code blocks are not linkified while outside-code mentions remain linkified (suite duplicated in two locations).
Tests — text method
packages/render-helper/src/methods/text.method.spec.ts
Add tests ensuring text() skips processing when ancestor is code or pre in various nesting scenarios.
Changelog & package
packages/render-helper/CHANGELOG.md, packages/render-helper/package.json
Bump package version to 2.4.23 and add changelog entry for the patch.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

  • Fix wrapping on render helper #699: Modifies same render-helper and enhancer paths to prevent linkifying mentions inside code; likely the same change set or closely related tests.

Suggested labels

patch

Poem

🐰 I hopped through words where backticks gleam,
Leaving code untouched, preserving the seam.
Mentions stay quiet inside the code nest,
Outside they link — behaving their best.

🚥 Pre-merge checks | ✅ 1 | ❌ 2

❌ Failed checks (1 warning, 1 inconclusive)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Title check ❓ Inconclusive The PR title 'Fix wrapping on render helper' is vague and does not clearly convey what the actual changes accomplish. The changeset prevents linkification of mentions/hashtags inside code blocks and inline code by adding ancestor checks, but the title does not reflect this specific fix. Consider using a more descriptive title such as 'Prevent linkifying mentions and hashtags in code blocks and inline code' to clearly communicate the main change.
✅ Passed checks (1 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
  • 📝 Generate docstrings (stacked PR)
  • 📝 Generate docstrings (commit on current branch)
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch code

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

coderabbitai[bot]

This comment was marked as resolved.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@packages/render-helper/src/markdown-2-html.spec.ts`:
- Around line 1276-1281: The test "should not linkify mentions inside fenced
code blocks" only checks absence of linkification but not that the fenced block
is still rendered as code; update the spec for markdown2Html to add positive
assertions that the output includes the code wrapper and the original code
content (e.g., assert result contains '<pre><code>' and '@aws-sdk/client-s3') in
the it block so the test protects the wrapping/rendering behavior alongside the
existing negative link checks.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 58ef4784-45a6-4402-8ab9-617e364e65b4

📥 Commits

Reviewing files that changed from the base of the PR and between 597c82c and 1a3328b.

📒 Files selected for processing (2)
  • packages/render-helper/src/markdown-2-html.spec.ts
  • packages/render-helper/src/methods/text.method.spec.ts
🚧 Files skipped from review as they are similar to previous changes (1)
  • packages/render-helper/src/methods/text.method.spec.ts

Comment thread packages/render-helper/src/markdown-2-html.spec.ts
@feruzm feruzm added the patch Bug fixes and patches (1.0.0 → 1.0.1), add this only if any packages/ have patch changes in PR label Mar 9, 2026
@feruzm feruzm merged commit 73eddf3 into develop Mar 9, 2026
@feruzm feruzm deleted the code branch March 9, 2026 15:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

patch Bug fixes and patches (1.0.0 → 1.0.1), add this only if any packages/ have patch changes in PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant