-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Fix support for comments #260
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -20,7 +20,6 @@ I'm an awesome paragraph. | |
<Bar>hi</Bar> | ||
{hello} | ||
{/* another commment */} | ||
<!-- one more comment --> | ||
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. I removed this line because, now that this is no longer treated as a comment, it causes an error when Babel tries to parse it. |
||
</Foo> | ||
|
||
``` | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -86,20 +86,39 @@ COPY start.sh /home/start.sh | |
|
||
it('Should support comments', async () => { | ||
const result = await mdx(` | ||
A paragraph | ||
<!-- a Markdown comment --> | ||
A paragraph | ||
|
||
Some text <!-- an inline comment --> | ||
|
||
\`\`\`md | ||
<!-- a code block Markdown comment --> | ||
<!-- a code block string --> | ||
\`\`\` | ||
|
||
<div> | ||
{/* a nested JSX comment */} | ||
<!-- a nested Markdown comment --> | ||
<!-- div content --> | ||
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. This would technically cause a Babel error (as mentioned above), but I included it in the test to ensure that it doesn't turn into a comment. |
||
</div> | ||
|
||
<!-- a comment above --> | ||
- list item | ||
<!-- a comment below --> | ||
|
||
--> should be as-is | ||
|
||
<MyComp content={\` | ||
<!-- a template literal --> | ||
\`} | ||
`) | ||
expect(result).toContain('{/* a Markdown comment */}') | ||
expect(result).toContain('<!-- a code block Markdown comment -->') | ||
expect(result).toContain('{/* an inline comment */}') | ||
expect(result).toContain('<!-- a code block string -->') | ||
expect(result).toContain('{/* a nested JSX comment */}') | ||
expect(result).toContain('{/* a nested Markdown comment */}') | ||
expect(result).toContain('<!-- div content -->') | ||
expect(result).toContain('{/* a comment above */}') | ||
expect(result).toContain('{/* a comment below */}') | ||
expect(result).toContain('--> should be as-is') | ||
expect(result).toContain('<!-- a template literal -->') | ||
}) | ||
|
||
it('Should not include export wrapper if skipExport is true', async () => { | ||
|
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.
Remark contains all comments as separate
html
nodes.