Skip to content

Fix#381 마크다운 줄바꿈 수정#383

Merged
kimgho merged 1 commit intomainfrom
fix#381
Aug 31, 2025
Merged

Fix#381 마크다운 줄바꿈 수정#383
kimgho merged 1 commit intomainfrom
fix#381

Conversation

@kimgho
Copy link
Copy Markdown
Contributor

@kimgho kimgho commented Aug 31, 2025

✅ Linked Issue

🔍 What I did

  • 마크다운에서 '\n'이 적용안되는 현상 수정

Summary by CodeRabbit

  • Bug Fixes
    • Markdown paragraphs now correctly preserve single line breaks, ensuring intended spacing and improved readability across posts and articles.
    • Prevents collapse of line breaks in rendered content, aligning display with user-authored formatting.
    • Visual change only; no impact on data, interactions, or performance.

@vercel
Copy link
Copy Markdown

vercel bot commented Aug 31, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Comments Updated (UTC)
mosu-client Ready Ready Preview Comment Aug 31, 2025 4:53pm

@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Aug 31, 2025

Walkthrough

Added a Tailwind class to the Markdown article element to apply whitespace-pre-line to paragraph descendants, preserving line breaks in rendered content. No logic, data, or control-flow changes.

Changes

Cohort / File(s) Summary of Changes
Presentation: Markdown whitespace handling
mosu-app/src/entities/posts/ui/MarkDown.tsx
Added Tailwind class "[&_p]:whitespace-pre-line" to article className; keeps line breaks in paragraphs. No changes to props, signature, or logic.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~2 minutes

Possibly related PRs

Suggested reviewers

  • toothlessdev

Poem

A hop, a skip, a line-break kept,
In prose I nest where commas slept—
With whiskers twitching, I align,
Each paragraph now shows its spine.
Tailwind breeze, I pre-line weave,
Markdown sings—oh what reprieve! 🐇✨

Tip

🔌 Remote MCP (Model Context Protocol) integration is now available!

Pro plan users can now connect to remote MCP servers from the Integrations page. Connect with popular remote MCPs such as Notion and Linear to add more context to your reviews and chats.

✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix#381

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
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

CodeRabbit Commands (Invoked using PR/Issue comments)

Type @coderabbitai help to get the list of available commands.

Other keywords and placeholders

  • Add @coderabbitai ignore or @coderabbit ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Status, Documentation and Community

  • Visit our Status Page to check the current availability of CodeRabbit.
  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@github-actions
Copy link
Copy Markdown

Messages
📖 ✅ PR 제목에 이슈 번호가 포함되어 있습니다.
📖 ✅ PR에 Reviewers가 지정되어 있습니다.
📖 ✅ PR에 라벨이 지정되어 있습니다.
📖 ✅ PR에 Assignees가 지정되어 있습니다.
📖 ✅ package.json에 변경사항이 없습니다.
📖 ✅ 브랜치 이름 'fix#381'이 컨벤션을 따릅니다.
📖 ✅ TypeScript 컴파일이 성공적으로 완료되었습니다.
📖 ✅ ESLint 검사 결과 문제가 없습니다.

📝 추가 및 변경된 파일

총 1개 파일 변경

└── 📂 mosu-app/
    └── 📂 src/
        └── 📂 entities/
            └── 📂 posts/
                └── 📂 ui/
                    └── ⚛️ MarkDown.tsx

Generated by 🚫 dangerJS against 44106fa

@kimgho kimgho merged commit 737b4d7 into main Aug 31, 2025
6 of 7 checks passed
@kimgho kimgho deleted the fix#381 branch August 31, 2025 16:53
Copy link
Copy Markdown

@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

🧹 Nitpick comments (1)
mosu-app/src/entities/posts/ui/MarkDown.tsx (1)

11-11: Preserve newlines in more Markdown elements (optional).

Good fix. To cover soft line breaks inside lists and tables too (common in user content), consider extending the selector beyond paragraphs.

-className={cn(props.className, "prose max-w-none [&>h1]:my-1 [&_p]:whitespace-pre-line")}
+className={cn(
+  props.className,
+  "prose max-w-none [&>h1]:my-1 [&_p,&_li,&_td,&_th]:whitespace-pre-line"
+)}
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

💡 Knowledge Base configuration:

  • MCP integration is disabled by default for public repositories
  • Jira integration is disabled by default for public repositories
  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between d5eac4c and 44106fa.

📒 Files selected for processing (1)
  • mosu-app/src/entities/posts/ui/MarkDown.tsx (1 hunks)
🧰 Additional context used
🪛 ast-grep (0.38.6)
mosu-app/src/entities/posts/ui/MarkDown.tsx

[warning] 11-11: Usage of dangerouslySetInnerHTML detected. This bypasses React's built-in XSS protection. Always sanitize HTML content using libraries like DOMPurify before injecting it into the DOM to prevent XSS attacks.
Context: dangerouslySetInnerHTML
Note: [CWE-79] Improper Neutralization of Input During Web Page Generation [REFERENCES]
- https://reactjs.org/docs/dom-elements.html#dangerouslysetinnerhtml
- https://cwe.mitre.org/data/definitions/79.html

(react-unsafe-html-injection)

⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
  • GitHub Check: Run Unit & Integration Tests
  • GitHub Check: Run DangerJS

{...props}
className={cn(props.className, "prose max-w-none [&>h1]:my-1")}
className={cn(props.className, "prose max-w-none [&>h1]:my-1 [&_p]:whitespace-pre-line")}
dangerouslySetInnerHTML={{ __html: content }}
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue

Sanitize HTML before injection to prevent XSS.

dangerouslySetInnerHTML is high risk if content can include user input. Sanitize on the client (or ensure it’s sanitized server-side) to block script/style injection.

Apply this minimal change here:

-            dangerouslySetInnerHTML={{ __html: content }}
+            dangerouslySetInnerHTML={{ __html: sanitized }}

And add the supporting code (outside this hunk):

// imports
import { useMemo } from "react";
import DOMPurify from "isomorphic-dompurify";

// inside component
const sanitized = useMemo(
  () =>
    DOMPurify.sanitize(content, {
      USE_PROFILES: { html: true }, // safe default; adjust allowlist if needed
    }),
  [content]
);
🧰 Tools
🪛 Biome (2.1.2)

[error] 12-12: Avoid passing content using the dangerouslySetInnerHTML prop.

Setting content using code can expose users to cross-site scripting (XSS) attacks

(lint/security/noDangerouslySetInnerHtml)

🤖 Prompt for AI Agents
In mosu-app/src/entities/posts/ui/MarkDown.tsx around line 12, the component is
injecting raw HTML via dangerouslySetInnerHTML using content; sanitize content
first to prevent XSS by importing useMemo and DOMPurify (isomorphic-dompurify),
creating a memoized sanitized variable via DOMPurify.sanitize(content, {
USE_PROFILES: { html: true } }) with [content] as the dependency, and then pass
sanitized to dangerouslySetInnerHTML instead of raw content; also ensure
isomorphic-dompurify is added to package dependencies.

@github-actions
Copy link
Copy Markdown

📚 Storybook이 Chromatic에 배포되었습니다!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant