jsonresume-theme-clinical-precision 0.2.13 → 0.2.15

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,18 @@
1
1
  # jsonresume-theme-clinical-precision
2
2
 
3
+ ## 0.2.15
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies [601e883]
8
+ - @jsonresume/core@0.4.1
9
+
10
+ ## 0.2.14
11
+
12
+ ### Patch Changes
13
+
14
+ - 2b3af11: Render inline Markdown (bold, emphasis, code, links) in summaries, descriptions and highlights with the shared renderer from @jsonresume/core (#600).
15
+
3
16
  ## 0.2.13
4
17
 
5
18
  ### Patch Changes
package/dist/index.js CHANGED
@@ -1455,6 +1455,50 @@ function SectionTitle({
1455
1455
  }
1456
1456
  );
1457
1457
  }
1458
+ const ESCAPES = {
1459
+ "&": "&",
1460
+ "<": "&lt;",
1461
+ ">": "&gt;",
1462
+ '"': "&quot;",
1463
+ "'": "&#39;"
1464
+ };
1465
+ const escapeHtml = (text) => text.replace(/[&<>"']/g, (c) => ESCAPES[c]);
1466
+ const ESCAPABLE = /\\([\\`*_[\]()!#])/g;
1467
+ const CODE = /`([^`]+)`/g;
1468
+ const LINK = /\[([^\]]+)\]\(([^)\s]+)\)/g;
1469
+ const STRONG = /\*\*(?=\S)([^*]*?\S)\*\*|__(?=\S)([^_]*?\S)__/g;
1470
+ const EMPHASIS = /\*(?=\S)([^*]*?\S)\*|(^|[^\p{L}\p{N}_])_(?=\S)([^_]*?\S)_(?![\p{L}\p{N}_])/gu;
1471
+ const safeHref = (url) => /^(https?:\/\/|mailto:)/i.test(url) ? url : void 0;
1472
+ const emphasis = (text, strong, em) => text.replace(STRONG, (_2, a, b2) => strong(a ?? b2)).replace(
1473
+ EMPHASIS,
1474
+ (_2, a, before, b2) => a !== void 0 ? em(a) : `${before}${em(b2)}`
1475
+ );
1476
+ const inline = (text, out) => {
1477
+ const kept = [];
1478
+ const keep = (value) => `${kept.push(value) - 1}`;
1479
+ const marks = (t) => emphasis(t, out.strong, out.em);
1480
+ const rest = text.replace(/\uE000/g, "").replace(ESCAPABLE, (_2, c) => keep(out.text(c))).replace(CODE, (_2, body) => keep(out.code(body))).replace(
1481
+ LINK,
1482
+ (_2, label, url) => keep(out.link(marks(out.text(label)), url))
1483
+ );
1484
+ return marks(out.text(rest)).replace(
1485
+ /\uE000(\d+)\uE000/g,
1486
+ (_2, i) => kept[Number(i)]
1487
+ );
1488
+ };
1489
+ function renderInlineMarkdown(text) {
1490
+ if (typeof text !== "string") return "";
1491
+ return inline(text, {
1492
+ text: escapeHtml,
1493
+ code: (body) => `<code>${escapeHtml(body)}</code>`,
1494
+ link: (label, url) => {
1495
+ const href = safeHref(url);
1496
+ return href ? `<a href="${escapeHtml(href)}">${label}</a>` : label;
1497
+ },
1498
+ strong: (t) => `<strong>${t}</strong>`,
1499
+ em: (t) => `<em>${t}</em>`
1500
+ });
1501
+ }
1458
1502
  dt.div`
1459
1503
  margin-bottom: ${(props) => props.theme?.spacing?.item || "var(--resume-space-item, 1rem)"};
1460
1504
 
@@ -1823,16 +1867,16 @@ const StyledLink = dt.a`
1823
1867
  }
1824
1868
  `;
1825
1869
  function Link({ href, children, className, ...rest }) {
1826
- const safeHref = safeUrl(href);
1827
- if (!safeHref) {
1870
+ const safeHref2 = safeUrl(href);
1871
+ if (!safeHref2) {
1828
1872
  return /* @__PURE__ */ jsx("span", { className, children });
1829
1873
  }
1830
- const isExternal = isExternalUrl(safeHref);
1874
+ const isExternal = isExternalUrl(safeHref2);
1831
1875
  const externalProps = isExternal ? { target: "_blank", rel: "noopener noreferrer" } : {};
1832
1876
  return /* @__PURE__ */ jsx(
1833
1877
  StyledLink,
1834
1878
  {
1835
- href: safeHref,
1879
+ href: safeHref2,
1836
1880
  className: `resume-link ${className || ""}`.trim(),
1837
1881
  ...externalProps,
1838
1882
  ...rest,
@@ -1860,6 +1904,15 @@ dt.span`
1860
1904
  }
1861
1905
  }
1862
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
@@ -6571,7 +6624,7 @@ function Resume({ resume }) {
6571
6624
  ] }),
6572
6625
  basics.summary && /* @__PURE__ */ jsxs(ChartNote, { children: [
6573
6626
  /* @__PURE__ */ jsx("span", { children: "Chart Note · Summary" }),
6574
- /* @__PURE__ */ jsx("p", { children: basics.summary })
6627
+ /* @__PURE__ */ jsx(InlineMarkdown, { as: "p", text: basics.summary })
6575
6628
  ] })
6576
6629
  ] }),
6577
6630
  work.length > 0 && /* @__PURE__ */ jsxs(StyledSection, { children: [
@@ -6590,8 +6643,8 @@ function Resume({ resume }) {
6590
6643
  /* @__PURE__ */ jsxs(Content, { children: [
6591
6644
  /* @__PURE__ */ jsx(ItemTitle, { children: job.url ? /* @__PURE__ */ jsx(Link, { href: safeUrl(job.url), children: job.position || job.name }) : job.position || job.name }),
6592
6645
  job.name && job.position && /* @__PURE__ */ jsx(ItemSub, { children: job.name }),
6593
- job.summary && /* @__PURE__ */ jsx(ItemDesc, { children: job.summary }),
6594
- job.highlights?.length > 0 && /* @__PURE__ */ jsx(Highlights, { children: job.highlights.map((h, j2) => /* @__PURE__ */ jsx("li", { children: h }, j2)) })
6646
+ job.summary && /* @__PURE__ */ jsx(InlineMarkdown, { as: ItemDesc, text: job.summary }),
6647
+ job.highlights?.length > 0 && /* @__PURE__ */ jsx(Highlights, { children: job.highlights.map((h, j2) => /* @__PURE__ */ jsx(InlineMarkdown, { as: "li", text: h }, j2)) })
6595
6648
  ] })
6596
6649
  ] }, i))
6597
6650
  ] }),
@@ -6649,8 +6702,8 @@ function Resume({ resume }) {
6649
6702
  ] }),
6650
6703
  /* @__PURE__ */ jsxs(Content, { children: [
6651
6704
  /* @__PURE__ */ jsx(ItemTitle, { children: p2.url ? /* @__PURE__ */ jsx(Link, { href: safeUrl(p2.url), children: p2.name }) : p2.name }),
6652
- p2.description && /* @__PURE__ */ jsx(ItemDesc, { children: p2.description }),
6653
- p2.highlights?.length > 0 && /* @__PURE__ */ jsx(Highlights, { children: p2.highlights.map((h, j2) => /* @__PURE__ */ jsx("li", { children: h }, j2)) })
6705
+ p2.description && /* @__PURE__ */ jsx(InlineMarkdown, { as: ItemDesc, text: p2.description }),
6706
+ p2.highlights?.length > 0 && /* @__PURE__ */ jsx(Highlights, { children: p2.highlights.map((h, j2) => /* @__PURE__ */ jsx(InlineMarkdown, { as: "li", text: h }, j2)) })
6654
6707
  ] })
6655
6708
  ] }, i))
6656
6709
  ] }),
@@ -6667,8 +6720,8 @@ function Resume({ resume }) {
6667
6720
  /* @__PURE__ */ jsxs(Content, { children: [
6668
6721
  /* @__PURE__ */ jsx(ItemTitle, { children: v2.position }),
6669
6722
  v2.organization && /* @__PURE__ */ jsx(ItemSub, { children: v2.organization }),
6670
- v2.summary && /* @__PURE__ */ jsx(ItemDesc, { children: v2.summary }),
6671
- v2.highlights?.length > 0 && /* @__PURE__ */ jsx(Highlights, { children: v2.highlights.map((h, j2) => /* @__PURE__ */ jsx("li", { children: h }, j2)) })
6723
+ v2.summary && /* @__PURE__ */ jsx(InlineMarkdown, { as: ItemDesc, text: v2.summary }),
6724
+ v2.highlights?.length > 0 && /* @__PURE__ */ jsx(Highlights, { children: v2.highlights.map((h, j2) => /* @__PURE__ */ jsx(InlineMarkdown, { as: "li", text: h }, j2)) })
6672
6725
  ] })
6673
6726
  ] }, i))
6674
6727
  ] }),
@@ -6683,7 +6736,7 @@ function Resume({ resume }) {
6683
6736
  /* @__PURE__ */ jsx(RecordList, { children: awards.map((a, i) => /* @__PURE__ */ jsxs(RecordItem, { children: [
6684
6737
  /* @__PURE__ */ jsx("h4", { children: a.title }),
6685
6738
  /* @__PURE__ */ jsx("p", { className: "meta", children: [a.awarder, a.date].filter(Boolean).join(" · ") }),
6686
- a.summary && /* @__PURE__ */ jsx("p", { children: a.summary })
6739
+ a.summary && /* @__PURE__ */ jsx(InlineMarkdown, { as: "p", text: a.summary })
6687
6740
  ] }, i)) })
6688
6741
  ] }),
6689
6742
  certificates.length > 0 && /* @__PURE__ */ jsxs(StyledSection, { children: [
@@ -6710,7 +6763,7 @@ function Resume({ resume }) {
6710
6763
  /* @__PURE__ */ jsx(RecordList, { children: publications.map((pub, i) => /* @__PURE__ */ jsxs(RecordItem, { children: [
6711
6764
  /* @__PURE__ */ jsx("h4", { children: pub.url ? /* @__PURE__ */ jsx(Link, { href: safeUrl(pub.url), children: pub.name }) : pub.name }),
6712
6765
  /* @__PURE__ */ jsx("p", { className: "meta", children: [pub.publisher, pub.releaseDate].filter(Boolean).join(" · ") }),
6713
- pub.summary && /* @__PURE__ */ jsx("p", { children: pub.summary })
6766
+ pub.summary && /* @__PURE__ */ jsx(InlineMarkdown, { as: "p", text: pub.summary })
6714
6767
  ] }, i)) })
6715
6768
  ] }),
6716
6769
  languages.length > 0 && /* @__PURE__ */ jsxs(StyledSection, { children: [
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "jsonresume-theme-clinical-precision",
3
- "version": "0.2.13",
3
+ "version": "0.2.15",
4
4
  "type": "module",
5
5
  "main": "./dist/index.js",
6
6
  "peerDependencies": {
@@ -9,7 +9,7 @@
9
9
  },
10
10
  "dependencies": {
11
11
  "styled-components": "^6.1.19",
12
- "@jsonresume/core": "0.4.0"
12
+ "@jsonresume/core": "0.4.1"
13
13
  },
14
14
  "exports": {
15
15
  ".": {
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
  /*
@@ -470,7 +471,7 @@ function Resume({ resume }) {
470
471
  {basics.summary && (
471
472
  <ChartNote>
472
473
  <span>Chart Note · Summary</span>
473
- <p>{basics.summary}</p>
474
+ <InlineMarkdown as="p" text={basics.summary} />
474
475
  </ChartNote>
475
476
  )}
476
477
  </Header>
@@ -502,11 +503,13 @@ function Resume({ resume }) {
502
503
  )}
503
504
  </ItemTitle>
504
505
  {job.name && job.position && <ItemSub>{job.name}</ItemSub>}
505
- {job.summary && <ItemDesc>{job.summary}</ItemDesc>}
506
+ {job.summary && (
507
+ <InlineMarkdown as={ItemDesc} text={job.summary} />
508
+ )}
506
509
  {job.highlights?.length > 0 && (
507
510
  <Highlights>
508
511
  {job.highlights.map((h, j) => (
509
- <li key={j}>{h}</li>
512
+ <InlineMarkdown as="li" key={j} text={h} />
510
513
  ))}
511
514
  </Highlights>
512
515
  )}
@@ -596,11 +599,13 @@ function Resume({ resume }) {
596
599
  <ItemTitle>
597
600
  {p.url ? <Link href={safeUrl(p.url)}>{p.name}</Link> : p.name}
598
601
  </ItemTitle>
599
- {p.description && <ItemDesc>{p.description}</ItemDesc>}
602
+ {p.description && (
603
+ <InlineMarkdown as={ItemDesc} text={p.description} />
604
+ )}
600
605
  {p.highlights?.length > 0 && (
601
606
  <Highlights>
602
607
  {p.highlights.map((h, j) => (
603
- <li key={j}>{h}</li>
608
+ <InlineMarkdown as="li" key={j} text={h} />
604
609
  ))}
605
610
  </Highlights>
606
611
  )}
@@ -626,11 +631,11 @@ function Resume({ resume }) {
626
631
  <Content>
627
632
  <ItemTitle>{v.position}</ItemTitle>
628
633
  {v.organization && <ItemSub>{v.organization}</ItemSub>}
629
- {v.summary && <ItemDesc>{v.summary}</ItemDesc>}
634
+ {v.summary && <InlineMarkdown as={ItemDesc} text={v.summary} />}
630
635
  {v.highlights?.length > 0 && (
631
636
  <Highlights>
632
637
  {v.highlights.map((h, j) => (
633
- <li key={j}>{h}</li>
638
+ <InlineMarkdown as="li" key={j} text={h} />
634
639
  ))}
635
640
  </Highlights>
636
641
  )}
@@ -653,7 +658,7 @@ function Resume({ resume }) {
653
658
  <p className="meta">
654
659
  {[a.awarder, a.date].filter(Boolean).join(' · ')}
655
660
  </p>
656
- {a.summary && <p>{a.summary}</p>}
661
+ {a.summary && <InlineMarkdown as="p" text={a.summary} />}
657
662
  </RecordItem>
658
663
  ))}
659
664
  </RecordList>
@@ -700,7 +705,7 @@ function Resume({ resume }) {
700
705
  <p className="meta">
701
706
  {[pub.publisher, pub.releaseDate].filter(Boolean).join(' · ')}
702
707
  </p>
703
- {pub.summary && <p>{pub.summary}</p>}
708
+ {pub.summary && <InlineMarkdown as="p" text={pub.summary} />}
704
709
  </RecordItem>
705
710
  ))}
706
711
  </RecordList>