jsonresume-theme-product-manager-canvas 0.2.12 → 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,18 @@
1
1
  # jsonresume-theme-product-manager-canvas
2
2
 
3
+ ## 0.2.14
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies [601e883]
8
+ - @jsonresume/core@0.4.1
9
+
10
+ ## 0.2.13
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.12
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
@@ -6373,7 +6426,7 @@ function Resume({ resume }) {
6373
6426
  basics.label && /* @__PURE__ */ jsx(Label, { children: basics.label }),
6374
6427
  /* @__PURE__ */ jsx(ContactWrapper, { children: /* @__PURE__ */ jsx(ContactInfo, { basics }) })
6375
6428
  ] }),
6376
- basics.summary && /* @__PURE__ */ jsx(SummarySection, { children: /* @__PURE__ */ jsx(SummaryText, { children: basics.summary }) }),
6429
+ basics.summary && /* @__PURE__ */ jsx(SummarySection, { children: /* @__PURE__ */ jsx(InlineMarkdown, { as: SummaryText, text: basics.summary }) }),
6377
6430
  work.length > 0 && /* @__PURE__ */ jsxs(MainSection, { children: [
6378
6431
  /* @__PURE__ */ jsx(MainSectionTitle, { children: "Experience" }),
6379
6432
  work.map((job, index2) => /* @__PURE__ */ jsxs(WorkCard, { children: [
@@ -6385,7 +6438,7 @@ function Resume({ resume }) {
6385
6438
  job.location && ` • ${job.location}`
6386
6439
  ] })
6387
6440
  ] }),
6388
- job.summary && /* @__PURE__ */ jsx(WorkDescription, { children: job.summary }),
6441
+ job.summary && /* @__PURE__ */ jsx(InlineMarkdown, { as: WorkDescription, text: job.summary }),
6389
6442
  job.highlights && job.highlights.length > 0 && /* @__PURE__ */ jsxs(ImpactSection, { children: [
6390
6443
  /* @__PURE__ */ jsx(ImpactLabel, { children: "Key Impact" }),
6391
6444
  /* @__PURE__ */ jsx(WorkHighlights, { children: job.highlights.map((highlight, i) => /* @__PURE__ */ jsx(
@@ -6418,10 +6471,16 @@ function Resume({ resume }) {
6418
6471
  }
6419
6472
  ) })
6420
6473
  ] }),
6421
- project.description && /* @__PURE__ */ jsx(WorkDescription, { children: project.description }),
6474
+ project.description && /* @__PURE__ */ jsx(
6475
+ InlineMarkdown,
6476
+ {
6477
+ as: WorkDescription,
6478
+ text: project.description
6479
+ }
6480
+ ),
6422
6481
  project.highlights && project.highlights.length > 0 && /* @__PURE__ */ jsxs(ImpactSection, { children: [
6423
6482
  /* @__PURE__ */ jsx(ImpactLabel, { children: "Outcomes" }),
6424
- /* @__PURE__ */ jsx(WorkHighlights, { children: project.highlights.map((highlight, i) => /* @__PURE__ */ jsx("li", { children: highlight }, i)) })
6483
+ /* @__PURE__ */ jsx(WorkHighlights, { children: project.highlights.map((highlight, i) => /* @__PURE__ */ jsx(InlineMarkdown, { as: "li", text: highlight }, i)) })
6425
6484
  ] })
6426
6485
  ] }, index2))
6427
6486
  ] }),
@@ -6448,8 +6507,8 @@ function Resume({ resume }) {
6448
6507
  /* @__PURE__ */ jsx(WorkCompany, { children: vol.organization }),
6449
6508
  /* @__PURE__ */ jsx(WorkMeta, { children: /* @__PURE__ */ jsx(DateRange, { startDate: vol.startDate, endDate: vol.endDate }) })
6450
6509
  ] }),
6451
- vol.summary && /* @__PURE__ */ jsx(WorkDescription, { children: vol.summary }),
6452
- vol.highlights && vol.highlights.length > 0 && /* @__PURE__ */ jsx(WorkHighlights, { children: vol.highlights.map((highlight, i) => /* @__PURE__ */ jsx("li", { children: highlight }, i)) })
6510
+ vol.summary && /* @__PURE__ */ jsx(InlineMarkdown, { as: WorkDescription, text: vol.summary }),
6511
+ vol.highlights && vol.highlights.length > 0 && /* @__PURE__ */ jsx(WorkHighlights, { children: vol.highlights.map((highlight, i) => /* @__PURE__ */ jsx(InlineMarkdown, { as: "li", text: highlight }, i)) })
6453
6512
  ] }, index2))
6454
6513
  ] }),
6455
6514
  awards.length > 0 && /* @__PURE__ */ jsxs(MainSection, { children: [
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "jsonresume-theme-product-manager-canvas",
3
- "version": "0.2.12",
3
+ "version": "0.2.14",
4
4
  "description": "Analytical yet creative theme with Notion-like layout, inline metrics, and clearly labeled Impact areas for product managers",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -10,7 +10,7 @@
10
10
  },
11
11
  "dependencies": {
12
12
  "styled-components": "^6.1.19",
13
- "@jsonresume/core": "0.4.0"
13
+ "@jsonresume/core": "0.4.1"
14
14
  },
15
15
  "exports": {
16
16
  ".": {
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`
@@ -247,7 +248,7 @@ function Resume({ resume }) {
247
248
 
248
249
  {basics.summary && (
249
250
  <SummarySection>
250
- <SummaryText>{basics.summary}</SummaryText>
251
+ <InlineMarkdown as={SummaryText} text={basics.summary} />
251
252
  </SummarySection>
252
253
  )}
253
254
 
@@ -264,7 +265,9 @@ function Resume({ resume }) {
264
265
  {job.location && ` • ${job.location}`}
265
266
  </WorkMeta>
266
267
  </WorkHeader>
267
- {job.summary && <WorkDescription>{job.summary}</WorkDescription>}
268
+ {job.summary && (
269
+ <InlineMarkdown as={WorkDescription} text={job.summary} />
270
+ )}
268
271
  {job.highlights && job.highlights.length > 0 && (
269
272
  <ImpactSection>
270
273
  <ImpactLabel>Key Impact</ImpactLabel>
@@ -324,14 +327,17 @@ function Resume({ resume }) {
324
327
  )}
325
328
  </WorkHeader>
326
329
  {project.description && (
327
- <WorkDescription>{project.description}</WorkDescription>
330
+ <InlineMarkdown
331
+ as={WorkDescription}
332
+ text={project.description}
333
+ />
328
334
  )}
329
335
  {project.highlights && project.highlights.length > 0 && (
330
336
  <ImpactSection>
331
337
  <ImpactLabel>Outcomes</ImpactLabel>
332
338
  <WorkHighlights>
333
339
  {project.highlights.map((highlight, i) => (
334
- <li key={i}>{highlight}</li>
340
+ <InlineMarkdown as="li" key={i} text={highlight} />
335
341
  ))}
336
342
  </WorkHighlights>
337
343
  </ImpactSection>
@@ -375,11 +381,13 @@ function Resume({ resume }) {
375
381
  <DateRange startDate={vol.startDate} endDate={vol.endDate} />
376
382
  </WorkMeta>
377
383
  </WorkHeader>
378
- {vol.summary && <WorkDescription>{vol.summary}</WorkDescription>}
384
+ {vol.summary && (
385
+ <InlineMarkdown as={WorkDescription} text={vol.summary} />
386
+ )}
379
387
  {vol.highlights && vol.highlights.length > 0 && (
380
388
  <WorkHighlights>
381
389
  {vol.highlights.map((highlight, i) => (
382
- <li key={i}>{highlight}</li>
390
+ <InlineMarkdown as="li" key={i} text={highlight} />
383
391
  ))}
384
392
  </WorkHighlights>
385
393
  )}