Skip to content

Commit

Permalink
Merge pull request #14 from klaasman/patch-1
Browse files Browse the repository at this point in the history
Fix: unordered lists styles
  • Loading branch information
lordelogos authored Sep 17, 2023
2 parents ce3d95b + 147a2f5 commit d035bde
Show file tree
Hide file tree
Showing 9 changed files with 28 additions and 344 deletions.
Binary file modified .DS_Store
Binary file not shown.
11 changes: 11 additions & 0 deletions .changeset/lazy-actors-design.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
---
"md-to-react-email": minor
---

### Changes

- Remove `DOMPurify` from lib

### Fixes

- Fixed unordered list `ul` styles
12 changes: 6 additions & 6 deletions __tests__/parseMarkdownToReactEmailJSX.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,8 @@ console.log(\`Hello, \$\{name\}!\`);
<li>Unordered List Item 2</li>
<li>Unordered List Item 3</li>
</ul>
<h2 style=\"font-weight:500;padding-top:20px;font-size:2rem\">Links</h2><p><a style=\"color:#007bff;text-decoration:underline;background-color:transparent\" href=\"https://www.markdownguide.org\" target=\"_blank\">Markdown Guide</a></p>
<h2 style=\"font-weight:500;padding-top:20px;font-size:2rem\">Images</h2><p><img alt=\"Markdown Logo\" src=\"https://markdown-here.com/img/icon256.png\"></p>
<h2 style=\"font-weight:500;padding-top:20px;font-size:2rem\">Links</h2><p><a href=\"https://www.markdownguide.org\" target=\"_blank\" style=\"color:#007bff;text-decoration:underline;background-color:transparent\">Markdown Guide</a></p>
<h2 style=\"font-weight:500;padding-top:20px;font-size:2rem\">Images</h2><p><img src=\"https://markdown-here.com/img/icon256.png\" alt=\"Markdown Logo\"></p>
<h2 style=\"font-weight:500;padding-top:20px;font-size:2rem\">Blockquotes</h2><blockquote style=\"background:#f9f9f9;border-left:10px solid #ccc;margin:1.5em 10px;padding:1em 10px\">
<p>This is a blockquote.</p>
<ul>
Expand Down Expand Up @@ -232,12 +232,12 @@ greet("World")

it("handles blockquotes correctly", () => {
const markdown = `A example:
> Here's a block quote:
> Here\'s a block quote:
> Lorem ipsum dolor sit amet, consectetur adipiscing elit.`;

const expected = `<p>A example:</p>
<blockquote style="background:#f9f9f9;border-left:10px solid #ccc;margin:1.5em 10px;padding:1em 10px">
<p>Here's a block quote:
<p>Here&#39;s a block quote:
Lorem ipsum dolor sit amet, consectetur adipiscing elit.</p>
</blockquote>
`;
Expand All @@ -264,10 +264,10 @@ Lorem ipsum dolor sit amet, consectetur adipiscing elit.</p>

it("handles links correctly", () => {
const markdown = `A link example:
Here's a link to [OpenAI's website](https://openai.com/).`;
Here's a link to [OpenAI\'s website](https://openai.com/).`;

const expected = `<p>A link example:
Here's a link to <a style="color:#007bff;text-decoration:underline;background-color:transparent" href="https://openai.com/" target="_blank">OpenAI's website</a>.</p>
Here&#39;s a link to <a href="https://openai.com/" target="_blank" style="color:#007bff;text-decoration:underline;background-color:transparent">OpenAI&#39;s website</a>.</p>
`;

const rendered = parseMarkdownToReactEmailJSX({
Expand Down
2 changes: 1 addition & 1 deletion __tests__/reactEmailMarkdown.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ describe("ReactEmailMarkdown component renders correctly", () => {
<ReactEmailMarkdown markdown={`# Hello, World!`} />
);
expect(actualOutput).toMatchInlineSnapshot(
`"<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><div><h1 data-id="react-email-heading" style="font-weight:500;padding-top:20px;font-size:2.5rem">Hello, World!</h1></div>"`
`"<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><div><h1 style="font-weight:500;padding-top:20px;font-size:2.5rem" data-id="react-email-heading">Hello, World!</h1></div>"`
);
});
});
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@
"react-email": ">1.9.3"
},
"dependencies": {
"isomorphic-dompurify": "1.7.0",
"marked": "7.0.4"
},
"publishConfig": {
Expand Down
Loading

0 comments on commit d035bde

Please sign in to comment.