jsonresume-theme-californian-warm 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-californian-warm
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
@@ -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.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
  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
  )}