-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Render line breaks in our markdown block #7857
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -5,6 +5,7 @@ import { visit } from "unist-util-visit" | |
| import rehypeKatex from "rehype-katex" | ||
| import remarkMath from "remark-math" | ||
| import remarkGfm from "remark-gfm" | ||
| import remarkBreaks from "remark-breaks" | ||
|
|
||
| import { vscode } from "@src/utils/vscode" | ||
|
|
||
|
|
@@ -289,6 +290,7 @@ const MarkdownBlock = memo(({ markdown }: MarkdownBlockProps) => { | |
| remarkPlugins={[ | ||
| remarkGfm, | ||
| remarkMath, | ||
| remarkBreaks, | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Consider adding a test case for line break rendering in the existing test file at For example: it('should render line breaks correctly with remark-breaks', async () => {
const markdown = 'First line\nSecond line\nThird line';
const { container } = render(<MarkdownBlock markdown={markdown} />);
// Wait for content to be processed
await screen.findByText(/First line/, { exact: false });
// Check that line breaks are rendered as <br> tags
const brElements = container.querySelectorAll('br');
expect(brElements.length).toBe(2);
});Also, I noticed that the |
||
| () => { | ||
| return (tree: any) => { | ||
| visit(tree, "code", (node: any) => { | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Consider adding a brief comment explaining why this plugin was added, for future maintainers: