@@ -198,39 +198,39 @@ export function parseMarkdownToReactEmailJSX(
198198 // Handle headings (e.g., # Heading)
199199 reactMailTemplate = markdown . replace (
200200 patterns . h1 ,
201- `<Heading as="h1 " style="${ parseCssInJsToInlineCss (
201+ `<h1 data-id="react-email-heading " style="${ parseCssInJsToInlineCss (
202202 finalStyles . h1
203- ) } ">$1</Heading >`
203+ ) } ">$1</h1 >`
204204 ) ;
205205 reactMailTemplate = reactMailTemplate . replace (
206206 patterns . h2 ,
207- `<Heading as="h2 " style="${ parseCssInJsToInlineCss (
207+ `<h2 data-id="react-email-heading " style="${ parseCssInJsToInlineCss (
208208 finalStyles . h2
209- ) } ">$1</Heading >`
209+ ) } ">$1</h2 >`
210210 ) ;
211211 reactMailTemplate = reactMailTemplate . replace (
212212 patterns . h3 ,
213- `<Heading as="h3 " style="${ parseCssInJsToInlineCss (
213+ `<h3 data-id="react-email-heading " style="${ parseCssInJsToInlineCss (
214214 finalStyles . h3
215- ) } ">$1</Heading >`
215+ ) } ">$1</h3 >`
216216 ) ;
217217 reactMailTemplate = reactMailTemplate . replace (
218218 patterns . h4 ,
219- `<Heading as="h4 " style="${ parseCssInJsToInlineCss (
219+ `<h4 data-id="react-email-heading " style="${ parseCssInJsToInlineCss (
220220 finalStyles . h4
221- ) } ">$1</Heading >`
221+ ) } ">$1</h4 >`
222222 ) ;
223223 reactMailTemplate = reactMailTemplate . replace (
224224 patterns . h5 ,
225- `<Heading as="h5 " style="${ parseCssInJsToInlineCss (
225+ `<h5 data-id="react-email-heading " style="${ parseCssInJsToInlineCss (
226226 finalStyles . h5
227- ) } ">$1</Heading >`
227+ ) } ">$1</h5 >`
228228 ) ;
229229 reactMailTemplate = reactMailTemplate . replace (
230230 patterns . h6 ,
231- `<Heading as="h6 " style="${ parseCssInJsToInlineCss (
231+ `<h6 data-id="react-email-heading " style="${ parseCssInJsToInlineCss (
232232 finalStyles . h6
233- ) } ">$1</Heading >`
233+ ) } ">$1</h6 >`
234234 ) ;
235235
236236 // Handle Tables from GFM
@@ -303,13 +303,17 @@ export function parseMarkdownToReactEmailJSX(
303303 // Handle bold text (e.g., **bold**)
304304 reactMailTemplate = reactMailTemplate . replace (
305305 patterns . bold ,
306- `<Text style="${ parseCssInJsToInlineCss ( finalStyles . bold ) } ">$1</Text>`
306+ `<p data-id="react-email-text" style="${ parseCssInJsToInlineCss (
307+ finalStyles . bold
308+ ) } ">$1</p>`
307309 ) ;
308310
309311 // Handle italic text (e.g., *italic*)
310312 reactMailTemplate = reactMailTemplate . replace (
311313 patterns . italic ,
312- `<Text style="${ parseCssInJsToInlineCss ( finalStyles . italic ) } ">$1</Text>`
314+ `<p data-id="react-email-text" style="${ parseCssInJsToInlineCss (
315+ finalStyles . italic
316+ ) } ">$1</p>`
313317 ) ;
314318
315319 // Handle lists (unordered and ordered)
@@ -325,37 +329,41 @@ export function parseMarkdownToReactEmailJSX(
325329 // Handle images (e.g., )
326330 reactMailTemplate = reactMailTemplate . replace (
327331 patterns . image ,
328- `<Img style="${ parseCssInJsToInlineCss (
332+ `<img style="${ parseCssInJsToInlineCss (
329333 finalStyles . image
330334 ) } " alt="$1" src="$2" />`
331335 ) ;
332336
333337 // Handle links (e.g., [link text](url))
334338 reactMailTemplate = reactMailTemplate . replace (
335339 patterns . link ,
336- `<Link href="$2" style="${ parseCssInJsToInlineCss (
340+ `<a data-id="react-email-link" target="_blank" href="$2" style="${ parseCssInJsToInlineCss (
337341 finalStyles . link
338- ) } ">$1</Link >`
342+ ) } ">$1</a >`
339343 ) ;
340344
341345 // Handle code blocks (e.g., ```code```)
342346 reactMailTemplate = reactMailTemplate . replace (
343347 patterns . codeBlocks ,
344348 `<pre style="${ parseCssInJsToInlineCss (
345349 finalStyles . codeBlock
346- ) } "><Text >${ `{\`$1\`}` } </Text ></pre>`
350+ ) } "><p data-id="react-email-text" >${ `{\`$1\`}` } </p ></pre>`
347351 ) ;
348352
349353 // Handle inline code (e.g., `code`)
350354 reactMailTemplate = reactMailTemplate . replace (
351355 patterns . codeInline ,
352- `<Text style="${ parseCssInJsToInlineCss ( finalStyles . codeInline ) } ">$1</Text>`
356+ `<p data-id="react-email-text" style="${ parseCssInJsToInlineCss (
357+ finalStyles . codeInline
358+ ) } ">$1</p>`
353359 ) ;
354360
355361 // Handle block quotes
356362 reactMailTemplate = reactMailTemplate . replace (
357363 / ^ > \s + ( .+ ) $ / gm,
358- `<Text style="${ parseCssInJsToInlineCss ( finalStyles . blockQuote ) } ">$1</Text>`
364+ `<p data-id="react-email-text" style="${ parseCssInJsToInlineCss (
365+ finalStyles . blockQuote
366+ ) } ">$1</p>`
359367 ) ;
360368
361369 // Handle line breaks (e.g., <br />)
@@ -367,11 +375,10 @@ export function parseMarkdownToReactEmailJSX(
367375 // Handle horizontal rules (e.g., ---)
368376 reactMailTemplate = reactMailTemplate . replace (
369377 patterns . hr ,
370- `<Hr style="${ parseCssInJsToInlineCss ( finalStyles . hr ) } " />`
378+ `<hr data-id="react-email-hr" style="${ parseCssInJsToInlineCss (
379+ finalStyles . hr
380+ ) } " />`
371381 ) ;
372382
373- // Wrap content in a section tag
374- reactMailTemplate = `<Section>${ reactMailTemplate } </Section>` ;
375-
376383 return reactMailTemplate ;
377384}
0 commit comments