jsonresume-theme-californian-warm 0.2.13 → 0.2.14

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # jsonresume-theme-californian-warm
2
2
 
3
+ ## 0.2.14
4
+
5
+ ### Patch Changes
6
+
7
+ - 2b3af11: Render inline Markdown (bold, emphasis, code, links) in summaries, descriptions and highlights with the shared renderer from @jsonresume/core (#600).
8
+
3
9
  ## 0.2.13
4
10
 
5
11
  ### Patch Changes
package/dist/index.js CHANGED
@@ -1823,16 +1823,16 @@ const StyledLink = dt.a`
1823
1823
  }
1824
1824
  `;
1825
1825
  function Link({ href, children, className, ...rest }) {
1826
- const safeHref = safeUrl(href);
1827
- if (!safeHref) {
1826
+ const safeHref2 = safeUrl(href);
1827
+ if (!safeHref2) {
1828
1828
  return /* @__PURE__ */ jsx("span", { className, children });
1829
1829
  }
1830
- const isExternal = isExternalUrl(safeHref);
1830
+ const isExternal = isExternalUrl(safeHref2);
1831
1831
  const externalProps = isExternal ? { target: "_blank", rel: "noopener noreferrer" } : {};
1832
1832
  return /* @__PURE__ */ jsx(
1833
1833
  StyledLink,
1834
1834
  {
1835
- href: safeHref,
1835
+ href: safeHref2,
1836
1836
  className: `resume-link ${className || ""}`.trim(),
1837
1837
  ...externalProps,
1838
1838
  ...rest,
@@ -1860,6 +1860,59 @@ dt.span`
1860
1860
  }
1861
1861
  }
1862
1862
  `;
1863
+ const ESCAPES = {
1864
+ "&": "&",
1865
+ "<": "&lt;",
1866
+ ">": "&gt;",
1867
+ '"': "&quot;",
1868
+ "'": "&#39;"
1869
+ };
1870
+ const escapeHtml = (text) => text.replace(/[&<>"']/g, (c) => ESCAPES[c]);
1871
+ const ESCAPABLE = /\\([\\`*_[\]()!#])/g;
1872
+ const CODE = /`([^`]+)`/g;
1873
+ const LINK = /\[([^\]]+)\]\(([^)\s]+)\)/g;
1874
+ const STRONG = /\*\*(?=\S)([^*]*?\S)\*\*|__(?=\S)([^_]*?\S)__/g;
1875
+ const EMPHASIS = /\*(?=\S)([^*]*?\S)\*|(^|[^\p{L}\p{N}_])_(?=\S)([^_]*?\S)_(?![\p{L}\p{N}_])/gu;
1876
+ const safeHref = (url) => /^(https?:\/\/|mailto:)/i.test(url) ? url : void 0;
1877
+ const emphasis = (text, strong, em) => text.replace(STRONG, (_2, a, b2) => strong(a ?? b2)).replace(
1878
+ EMPHASIS,
1879
+ (_2, a, before, b2) => a !== void 0 ? em(a) : `${before}${em(b2)}`
1880
+ );
1881
+ const inline = (text, out) => {
1882
+ const kept = [];
1883
+ const keep = (value) => `${kept.push(value) - 1}`;
1884
+ const marks = (t) => emphasis(t, out.strong, out.em);
1885
+ const rest = text.replace(/\uE000/g, "").replace(ESCAPABLE, (_2, c) => keep(out.text(c))).replace(CODE, (_2, body) => keep(out.code(body))).replace(
1886
+ LINK,
1887
+ (_2, label, url) => keep(out.link(marks(out.text(label)), url))
1888
+ );
1889
+ return marks(out.text(rest)).replace(
1890
+ /\uE000(\d+)\uE000/g,
1891
+ (_2, i) => kept[Number(i)]
1892
+ );
1893
+ };
1894
+ function renderInlineMarkdown(text) {
1895
+ if (typeof text !== "string") return "";
1896
+ return inline(text, {
1897
+ text: escapeHtml,
1898
+ code: (body) => `<code>${escapeHtml(body)}</code>`,
1899
+ link: (label, url) => {
1900
+ const href = safeHref(url);
1901
+ return href ? `<a href="${escapeHtml(href)}">${label}</a>` : label;
1902
+ },
1903
+ strong: (t) => `<strong>${t}</strong>`,
1904
+ em: (t) => `<em>${t}</em>`
1905
+ });
1906
+ }
1907
+ function InlineMarkdown({ text, as: Tag = "span", ...rest }) {
1908
+ return /* @__PURE__ */ jsx(
1909
+ Tag,
1910
+ {
1911
+ ...rest,
1912
+ dangerouslySetInnerHTML: { __html: renderInlineMarkdown(text) }
1913
+ }
1914
+ );
1915
+ }
1863
1916
  dt.hr`
1864
1917
  border: none;
1865
1918
  border-top: 0.5pt solid
@@ -6419,7 +6472,7 @@ function Resume({ resume }) {
6419
6472
  /* @__PURE__ */ jsxs(Header, { children: [
6420
6473
  basics.name && /* @__PURE__ */ jsx(Name, { children: basics.name }),
6421
6474
  basics.label && /* @__PURE__ */ jsx(Tagline, { children: basics.label }),
6422
- basics.summary && /* @__PURE__ */ jsx(Summary, { children: basics.summary }),
6475
+ basics.summary && /* @__PURE__ */ jsx(InlineMarkdown, { as: Summary, text: basics.summary }),
6423
6476
  /* @__PURE__ */ jsx(
6424
6477
  StyledContactInfo,
6425
6478
  {
@@ -6440,8 +6493,8 @@ function Resume({ resume }) {
6440
6493
  ] }),
6441
6494
  job.name && /* @__PURE__ */ jsx(ItemSubtitle, { children: job.name }),
6442
6495
  job.location && /* @__PURE__ */ jsx(ItemLocation, { children: job.location }),
6443
- job.summary && /* @__PURE__ */ jsx(ItemDescription, { children: job.summary }),
6444
- job.highlights && job.highlights.length > 0 && /* @__PURE__ */ jsx(HighlightsList, { children: job.highlights.map((highlight, i) => /* @__PURE__ */ jsx("li", { children: highlight }, i)) })
6496
+ job.summary && /* @__PURE__ */ jsx(InlineMarkdown, { as: ItemDescription, text: job.summary }),
6497
+ job.highlights && job.highlights.length > 0 && /* @__PURE__ */ jsx(HighlightsList, { children: job.highlights.map((highlight, i) => /* @__PURE__ */ jsx(InlineMarkdown, { as: "li", text: highlight }, i)) })
6445
6498
  ] }, index))
6446
6499
  ] }),
6447
6500
  education.length > 0 && /* @__PURE__ */ jsxs(StyledSection, { children: [
@@ -6484,8 +6537,14 @@ function Resume({ resume }) {
6484
6537
  ) })
6485
6538
  ] }),
6486
6539
  project.type && /* @__PURE__ */ jsx(ItemLocation, { children: project.type }),
6487
- project.description && /* @__PURE__ */ jsx(ItemDescription, { children: project.description }),
6488
- project.highlights && project.highlights.length > 0 && /* @__PURE__ */ jsx(HighlightsList, { children: project.highlights.map((highlight, i) => /* @__PURE__ */ jsx("li", { children: highlight }, i)) })
6540
+ project.description && /* @__PURE__ */ jsx(
6541
+ InlineMarkdown,
6542
+ {
6543
+ as: ItemDescription,
6544
+ text: project.description
6545
+ }
6546
+ ),
6547
+ project.highlights && project.highlights.length > 0 && /* @__PURE__ */ jsx(HighlightsList, { children: project.highlights.map((highlight, i) => /* @__PURE__ */ jsx(InlineMarkdown, { as: "li", text: highlight }, i)) })
6489
6548
  ] }, index))
6490
6549
  ] }),
6491
6550
  awards.length > 0 && /* @__PURE__ */ jsxs(StyledSection, { children: [
@@ -6497,7 +6556,7 @@ function Resume({ resume }) {
6497
6556
  " ",
6498
6557
  award.date && `• ${award.date}`
6499
6558
  ] }),
6500
- award.summary && /* @__PURE__ */ jsx("p", { children: award.summary })
6559
+ award.summary && /* @__PURE__ */ jsx(InlineMarkdown, { as: "p", text: award.summary })
6501
6560
  ] }, index))
6502
6561
  ] }),
6503
6562
  certificates.length > 0 && /* @__PURE__ */ jsxs(StyledSection, { children: [
@@ -6520,7 +6579,7 @@ function Resume({ resume }) {
6520
6579
  " ",
6521
6580
  pub.releaseDate && `• ${pub.releaseDate}`
6522
6581
  ] }),
6523
- pub.summary && /* @__PURE__ */ jsx("p", { children: pub.summary })
6582
+ pub.summary && /* @__PURE__ */ jsx(InlineMarkdown, { as: "p", text: pub.summary })
6524
6583
  ] }, index))
6525
6584
  ] }),
6526
6585
  volunteer.length > 0 && /* @__PURE__ */ jsxs(StyledSection, { children: [
@@ -6531,8 +6590,8 @@ function Resume({ resume }) {
6531
6590
  /* @__PURE__ */ jsx(ItemDate, { children: /* @__PURE__ */ jsx(DateRange, { startDate: vol.startDate, endDate: vol.endDate }) })
6532
6591
  ] }),
6533
6592
  vol.organization && /* @__PURE__ */ jsx(ItemSubtitle, { children: vol.organization }),
6534
- vol.summary && /* @__PURE__ */ jsx(ItemDescription, { children: vol.summary }),
6535
- vol.highlights && vol.highlights.length > 0 && /* @__PURE__ */ jsx(HighlightsList, { children: vol.highlights.map((highlight, i) => /* @__PURE__ */ jsx("li", { children: highlight }, i)) })
6593
+ vol.summary && /* @__PURE__ */ jsx(InlineMarkdown, { as: ItemDescription, text: vol.summary }),
6594
+ vol.highlights && vol.highlights.length > 0 && /* @__PURE__ */ jsx(HighlightsList, { children: vol.highlights.map((highlight, i) => /* @__PURE__ */ jsx(InlineMarkdown, { as: "li", text: highlight }, i)) })
6536
6595
  ] }, index))
6537
6596
  ] }),
6538
6597
  languages.length > 0 && /* @__PURE__ */ jsxs(StyledSection, { children: [
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "jsonresume-theme-californian-warm",
3
- "version": "0.2.13",
3
+ "version": "0.2.14",
4
4
  "type": "module",
5
5
  "main": "./dist/index.js",
6
6
  "peerDependencies": {
package/src/Resume.jsx CHANGED
@@ -9,6 +9,7 @@ import {
9
9
  ContactInfo,
10
10
  Link,
11
11
  safeUrl,
12
+ InlineMarkdown,
12
13
  } from '@jsonresume/core';
13
14
 
14
15
  const Layout = styled.div`
@@ -284,7 +285,9 @@ function Resume({ resume }) {
284
285
  <Header>
285
286
  {basics.name && <Name>{basics.name}</Name>}
286
287
  {basics.label && <Tagline>{basics.label}</Tagline>}
287
- {basics.summary && <Summary>{basics.summary}</Summary>}
288
+ {basics.summary && (
289
+ <InlineMarkdown as={Summary} text={basics.summary} />
290
+ )}
288
291
  <StyledContactInfo
289
292
  email={basics.email}
290
293
  phone={basics.phone}
@@ -307,11 +310,13 @@ function Resume({ resume }) {
307
310
  </ItemHeader>
308
311
  {job.name && <ItemSubtitle>{job.name}</ItemSubtitle>}
309
312
  {job.location && <ItemLocation>{job.location}</ItemLocation>}
310
- {job.summary && <ItemDescription>{job.summary}</ItemDescription>}
313
+ {job.summary && (
314
+ <InlineMarkdown as={ItemDescription} text={job.summary} />
315
+ )}
311
316
  {job.highlights && job.highlights.length > 0 && (
312
317
  <HighlightsList>
313
318
  {job.highlights.map((highlight, i) => (
314
- <li key={i}>{highlight}</li>
319
+ <InlineMarkdown as="li" key={i} text={highlight} />
315
320
  ))}
316
321
  </HighlightsList>
317
322
  )}
@@ -389,12 +394,15 @@ function Resume({ resume }) {
389
394
  </ItemHeader>
390
395
  {project.type && <ItemLocation>{project.type}</ItemLocation>}
391
396
  {project.description && (
392
- <ItemDescription>{project.description}</ItemDescription>
397
+ <InlineMarkdown
398
+ as={ItemDescription}
399
+ text={project.description}
400
+ />
393
401
  )}
394
402
  {project.highlights && project.highlights.length > 0 && (
395
403
  <HighlightsList>
396
404
  {project.highlights.map((highlight, i) => (
397
- <li key={i}>{highlight}</li>
405
+ <InlineMarkdown as="li" key={i} text={highlight} />
398
406
  ))}
399
407
  </HighlightsList>
400
408
  )}
@@ -412,7 +420,7 @@ function Resume({ resume }) {
412
420
  <p>
413
421
  {award.awarder} {award.date && `• ${award.date}`}
414
422
  </p>
415
- {award.summary && <p>{award.summary}</p>}
423
+ {award.summary && <InlineMarkdown as="p" text={award.summary} />}
416
424
  </SimpleCard>
417
425
  ))}
418
426
  </StyledSection>
@@ -453,7 +461,7 @@ function Resume({ resume }) {
453
461
  <p>
454
462
  {pub.publisher} {pub.releaseDate && `• ${pub.releaseDate}`}
455
463
  </p>
456
- {pub.summary && <p>{pub.summary}</p>}
464
+ {pub.summary && <InlineMarkdown as="p" text={pub.summary} />}
457
465
  </SimpleCard>
458
466
  ))}
459
467
  </StyledSection>
@@ -473,11 +481,13 @@ function Resume({ resume }) {
473
481
  {vol.organization && (
474
482
  <ItemSubtitle>{vol.organization}</ItemSubtitle>
475
483
  )}
476
- {vol.summary && <ItemDescription>{vol.summary}</ItemDescription>}
484
+ {vol.summary && (
485
+ <InlineMarkdown as={ItemDescription} text={vol.summary} />
486
+ )}
477
487
  {vol.highlights && vol.highlights.length > 0 && (
478
488
  <HighlightsList>
479
489
  {vol.highlights.map((highlight, i) => (
480
- <li key={i}>{highlight}</li>
490
+ <InlineMarkdown as="li" key={i} text={highlight} />
481
491
  ))}
482
492
  </HighlightsList>
483
493
  )}