jsonresume-theme-new-york-editorial 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-new-york-editorial
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
 
@@ -1787,16 +1831,16 @@ const StyledLink = dt.a`
1787
1831
  }
1788
1832
  `;
1789
1833
  function Link({ href, children, className, ...rest }) {
1790
- const safeHref = safeUrl(href);
1791
- if (!safeHref) {
1834
+ const safeHref2 = safeUrl(href);
1835
+ if (!safeHref2) {
1792
1836
  return /* @__PURE__ */ jsx("span", { className, children });
1793
1837
  }
1794
- const isExternal = isExternalUrl(safeHref);
1838
+ const isExternal = isExternalUrl(safeHref2);
1795
1839
  const externalProps = isExternal ? { target: "_blank", rel: "noopener noreferrer" } : {};
1796
1840
  return /* @__PURE__ */ jsx(
1797
1841
  StyledLink,
1798
1842
  {
1799
- href: safeHref,
1843
+ href: safeHref2,
1800
1844
  className: `resume-link ${className || ""}`.trim(),
1801
1845
  ...externalProps,
1802
1846
  ...rest,
@@ -1824,6 +1868,15 @@ dt.span`
1824
1868
  }
1825
1869
  }
1826
1870
  `;
1871
+ function InlineMarkdown({ text, as: Tag = "span", ...rest }) {
1872
+ return /* @__PURE__ */ jsx(
1873
+ Tag,
1874
+ {
1875
+ ...rest,
1876
+ dangerouslySetInnerHTML: { __html: renderInlineMarkdown(text) }
1877
+ }
1878
+ );
1879
+ }
1827
1880
  dt.hr`
1828
1881
  border: none;
1829
1882
  border-top: 0.5pt solid
@@ -6441,7 +6494,7 @@ function Resume({ resume }) {
6441
6494
  /* @__PURE__ */ jsx(Name, { children: basics.name }),
6442
6495
  basics.label && /* @__PURE__ */ jsx(Label, { children: basics.label }),
6443
6496
  /* @__PURE__ */ jsx(StyledContactInfo, { basics }),
6444
- basics.summary && /* @__PURE__ */ jsx(Summary, { children: basics.summary })
6497
+ basics.summary && /* @__PURE__ */ jsx(InlineMarkdown, { as: Summary, text: basics.summary })
6445
6498
  ] }),
6446
6499
  work && work.length > 0 && /* @__PURE__ */ jsxs(StyledSection, { children: [
6447
6500
  /* @__PURE__ */ jsx(StyledSectionTitle, { children: "Experience" }),
@@ -6459,7 +6512,7 @@ function Resume({ resume }) {
6459
6512
  )
6460
6513
  ] })
6461
6514
  ] }),
6462
- job.summary && /* @__PURE__ */ jsx(WorkSummary, { children: job.summary }),
6515
+ job.summary && /* @__PURE__ */ jsx(InlineMarkdown, { as: WorkSummary, text: job.summary }),
6463
6516
  job.highlights && job.highlights.length > 0 && /* @__PURE__ */ jsx(HighlightsList, { children: job.highlights.map((highlight, i) => /* @__PURE__ */ jsx(
6464
6517
  "li",
6465
6518
  {
@@ -6501,8 +6554,14 @@ function Resume({ resume }) {
6501
6554
  /* @__PURE__ */ jsx(StyledSectionTitle, { children: "Projects" }),
6502
6555
  projects.map((project, index) => /* @__PURE__ */ jsxs(ProjectItem, { children: [
6503
6556
  /* @__PURE__ */ jsx(ProjectName, { children: project.url ? /* @__PURE__ */ jsx(Link, { href: project.url, children: project.name }) : project.name }),
6504
- project.description && /* @__PURE__ */ jsx(ProjectDescription, { children: project.description }),
6505
- project.highlights && project.highlights.length > 0 && /* @__PURE__ */ jsx(ProjectHighlights, { children: project.highlights.map((highlight, i) => /* @__PURE__ */ jsx("li", { children: highlight }, i)) })
6557
+ project.description && /* @__PURE__ */ jsx(
6558
+ InlineMarkdown,
6559
+ {
6560
+ as: ProjectDescription,
6561
+ text: project.description
6562
+ }
6563
+ ),
6564
+ project.highlights && project.highlights.length > 0 && /* @__PURE__ */ jsx(ProjectHighlights, { children: project.highlights.map((highlight, i) => /* @__PURE__ */ jsx(InlineMarkdown, { as: "li", text: highlight }, i)) })
6506
6565
  ] }, index))
6507
6566
  ] }),
6508
6567
  publications && publications.length > 0 && /* @__PURE__ */ jsxs(StyledSection, { children: [
@@ -6516,7 +6575,7 @@ function Resume({ resume }) {
6516
6575
  pub.releaseDate
6517
6576
  ] })
6518
6577
  ] }),
6519
- pub.summary && /* @__PURE__ */ jsx(ProjectDescription, { children: pub.summary })
6578
+ pub.summary && /* @__PURE__ */ jsx(InlineMarkdown, { as: ProjectDescription, text: pub.summary })
6520
6579
  ] }, index))
6521
6580
  ] }),
6522
6581
  volunteer && volunteer.length > 0 && /* @__PURE__ */ jsxs(StyledSection, { children: [
@@ -6536,7 +6595,7 @@ function Resume({ resume }) {
6536
6595
  )
6537
6596
  ] })
6538
6597
  ] }),
6539
- vol.summary && /* @__PURE__ */ jsx(ItemDescription, { children: vol.summary })
6598
+ vol.summary && /* @__PURE__ */ jsx(InlineMarkdown, { as: ItemDescription, text: vol.summary })
6540
6599
  ] }, index)) })
6541
6600
  ] }),
6542
6601
  awards && awards.length > 0 && /* @__PURE__ */ jsxs(StyledSection, { children: [
@@ -6550,7 +6609,7 @@ function Resume({ resume }) {
6550
6609
  award.date
6551
6610
  ] })
6552
6611
  ] }),
6553
- award.summary && /* @__PURE__ */ jsx(ItemDescription, { children: award.summary })
6612
+ award.summary && /* @__PURE__ */ jsx(InlineMarkdown, { as: ItemDescription, text: award.summary })
6554
6613
  ] }, index)) })
6555
6614
  ] }),
6556
6615
  certificates && certificates.length > 0 && /* @__PURE__ */ jsxs(StyledSection, { children: [
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "jsonresume-theme-new-york-editorial",
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
@@ -6,6 +6,7 @@ import {
6
6
  DateRange,
7
7
  ContactInfo,
8
8
  Link,
9
+ InlineMarkdown,
9
10
  } from '@jsonresume/core';
10
11
 
11
12
  const Layout = styled.div`
@@ -351,7 +352,9 @@ function Resume({ resume }) {
351
352
  <Name>{basics.name}</Name>
352
353
  {basics.label && <Label>{basics.label}</Label>}
353
354
  <StyledContactInfo basics={basics} />
354
- {basics.summary && <Summary>{basics.summary}</Summary>}
355
+ {basics.summary && (
356
+ <InlineMarkdown as={Summary} text={basics.summary} />
357
+ )}
355
358
  </Header>
356
359
 
357
360
  {work && work.length > 0 && (
@@ -369,7 +372,9 @@ function Resume({ resume }) {
369
372
  />
370
373
  </CompanyLine>
371
374
  </WorkHeader>
372
- {job.summary && <WorkSummary>{job.summary}</WorkSummary>}
375
+ {job.summary && (
376
+ <InlineMarkdown as={WorkSummary} text={job.summary} />
377
+ )}
373
378
  {job.highlights && job.highlights.length > 0 && (
374
379
  <HighlightsList>
375
380
  {job.highlights.map((highlight, i) => (
@@ -434,12 +439,15 @@ function Resume({ resume }) {
434
439
  )}
435
440
  </ProjectName>
436
441
  {project.description && (
437
- <ProjectDescription>{project.description}</ProjectDescription>
442
+ <InlineMarkdown
443
+ as={ProjectDescription}
444
+ text={project.description}
445
+ />
438
446
  )}
439
447
  {project.highlights && project.highlights.length > 0 && (
440
448
  <ProjectHighlights>
441
449
  {project.highlights.map((highlight, i) => (
442
- <li key={i}>{highlight}</li>
450
+ <InlineMarkdown as="li" key={i} text={highlight} />
443
451
  ))}
444
452
  </ProjectHighlights>
445
453
  )}
@@ -461,7 +469,7 @@ function Resume({ resume }) {
461
469
  {pub.releaseDate && <> • {pub.releaseDate}</>}
462
470
  </ItemMeta>
463
471
  {pub.summary && (
464
- <ProjectDescription>{pub.summary}</ProjectDescription>
472
+ <InlineMarkdown as={ProjectDescription} text={pub.summary} />
465
473
  )}
466
474
  </ProjectItem>
467
475
  ))}
@@ -488,7 +496,7 @@ function Resume({ resume }) {
488
496
  )}
489
497
  </ItemMeta>
490
498
  {vol.summary && (
491
- <ItemDescription>{vol.summary}</ItemDescription>
499
+ <InlineMarkdown as={ItemDescription} text={vol.summary} />
492
500
  )}
493
501
  </SimpleItem>
494
502
  ))}
@@ -508,7 +516,7 @@ function Resume({ resume }) {
508
516
  {award.date && <> • {award.date}</>}
509
517
  </ItemMeta>
510
518
  {award.summary && (
511
- <ItemDescription>{award.summary}</ItemDescription>
519
+ <InlineMarkdown as={ItemDescription} text={award.summary} />
512
520
  )}
513
521
  </SimpleItem>
514
522
  ))}