jsonresume-theme-investor-brief 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-investor-brief
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
@@ -1787,16 +1787,16 @@ const StyledLink = dt.a`
1787
1787
  }
1788
1788
  `;
1789
1789
  function Link({ href, children, className, ...rest }) {
1790
- const safeHref = safeUrl(href);
1791
- if (!safeHref) {
1790
+ const safeHref2 = safeUrl(href);
1791
+ if (!safeHref2) {
1792
1792
  return /* @__PURE__ */ jsx("span", { className, children });
1793
1793
  }
1794
- const isExternal = isExternalUrl(safeHref);
1794
+ const isExternal = isExternalUrl(safeHref2);
1795
1795
  const externalProps = isExternal ? { target: "_blank", rel: "noopener noreferrer" } : {};
1796
1796
  return /* @__PURE__ */ jsx(
1797
1797
  StyledLink,
1798
1798
  {
1799
- href: safeHref,
1799
+ href: safeHref2,
1800
1800
  className: `resume-link ${className || ""}`.trim(),
1801
1801
  ...externalProps,
1802
1802
  ...rest,
@@ -1824,6 +1824,59 @@ dt.span`
1824
1824
  }
1825
1825
  }
1826
1826
  `;
1827
+ const ESCAPES = {
1828
+ "&": "&",
1829
+ "<": "&lt;",
1830
+ ">": "&gt;",
1831
+ '"': "&quot;",
1832
+ "'": "&#39;"
1833
+ };
1834
+ const escapeHtml = (text) => text.replace(/[&<>"']/g, (c) => ESCAPES[c]);
1835
+ const ESCAPABLE = /\\([\\`*_[\]()!#])/g;
1836
+ const CODE = /`([^`]+)`/g;
1837
+ const LINK = /\[([^\]]+)\]\(([^)\s]+)\)/g;
1838
+ const STRONG = /\*\*(?=\S)([^*]*?\S)\*\*|__(?=\S)([^_]*?\S)__/g;
1839
+ const EMPHASIS = /\*(?=\S)([^*]*?\S)\*|(^|[^\p{L}\p{N}_])_(?=\S)([^_]*?\S)_(?![\p{L}\p{N}_])/gu;
1840
+ const safeHref = (url) => /^(https?:\/\/|mailto:)/i.test(url) ? url : void 0;
1841
+ const emphasis = (text, strong, em) => text.replace(STRONG, (_2, a, b2) => strong(a ?? b2)).replace(
1842
+ EMPHASIS,
1843
+ (_2, a, before, b2) => a !== void 0 ? em(a) : `${before}${em(b2)}`
1844
+ );
1845
+ const inline = (text, out) => {
1846
+ const kept = [];
1847
+ const keep = (value) => `${kept.push(value) - 1}`;
1848
+ const marks = (t) => emphasis(t, out.strong, out.em);
1849
+ const rest = text.replace(/\uE000/g, "").replace(ESCAPABLE, (_2, c) => keep(out.text(c))).replace(CODE, (_2, body) => keep(out.code(body))).replace(
1850
+ LINK,
1851
+ (_2, label, url) => keep(out.link(marks(out.text(label)), url))
1852
+ );
1853
+ return marks(out.text(rest)).replace(
1854
+ /\uE000(\d+)\uE000/g,
1855
+ (_2, i) => kept[Number(i)]
1856
+ );
1857
+ };
1858
+ function renderInlineMarkdown(text) {
1859
+ if (typeof text !== "string") return "";
1860
+ return inline(text, {
1861
+ text: escapeHtml,
1862
+ code: (body) => `<code>${escapeHtml(body)}</code>`,
1863
+ link: (label, url) => {
1864
+ const href = safeHref(url);
1865
+ return href ? `<a href="${escapeHtml(href)}">${label}</a>` : label;
1866
+ },
1867
+ strong: (t) => `<strong>${t}</strong>`,
1868
+ em: (t) => `<em>${t}</em>`
1869
+ });
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
@@ -6379,7 +6432,7 @@ function Resume({ resume }) {
6379
6432
  basics.label && /* @__PURE__ */ jsx(Label, { children: basics.label }),
6380
6433
  /* @__PURE__ */ jsx(ContactWrapper, { children: /* @__PURE__ */ jsx(ContactInfo, { basics }) })
6381
6434
  ] }),
6382
- basics.summary && /* @__PURE__ */ jsx(SummarySection, { children: /* @__PURE__ */ jsx(SummaryText, { children: basics.summary }) }),
6435
+ basics.summary && /* @__PURE__ */ jsx(SummarySection, { children: /* @__PURE__ */ jsx(InlineMarkdown, { as: SummaryText, text: basics.summary }) }),
6383
6436
  keyMetrics.length > 0 && /* @__PURE__ */ jsxs(MainSection, { children: [
6384
6437
  /* @__PURE__ */ jsx(MainSectionTitle, { children: "Key Metrics" }),
6385
6438
  /* @__PURE__ */ jsx(MetricsGrid, { children: keyMetrics.map((metric, index) => /* @__PURE__ */ jsxs(MetricCard, { children: [
@@ -6395,8 +6448,8 @@ function Resume({ resume }) {
6395
6448
  /* @__PURE__ */ jsx(WorkMeta, { children: /* @__PURE__ */ jsx(DateRange, { startDate: job.startDate, endDate: job.endDate }) })
6396
6449
  ] }),
6397
6450
  job.name && /* @__PURE__ */ jsx(WorkCompany, { children: job.name }),
6398
- job.summary && /* @__PURE__ */ jsx(WorkDescription, { children: job.summary }),
6399
- job.highlights && job.highlights.length > 0 && /* @__PURE__ */ jsx(WorkHighlights, { children: job.highlights.map((highlight, i) => /* @__PURE__ */ jsx("li", { children: highlight }, i)) })
6451
+ job.summary && /* @__PURE__ */ jsx(InlineMarkdown, { as: WorkDescription, text: job.summary }),
6452
+ job.highlights && job.highlights.length > 0 && /* @__PURE__ */ jsx(WorkHighlights, { children: job.highlights.map((highlight, i) => /* @__PURE__ */ jsx(InlineMarkdown, { as: "li", text: highlight }, i)) })
6400
6453
  ] }, index))
6401
6454
  ] }),
6402
6455
  skills.length > 0 && /* @__PURE__ */ jsxs(MainSection, { children: [
@@ -6419,8 +6472,14 @@ function Resume({ resume }) {
6419
6472
  }
6420
6473
  ) })
6421
6474
  ] }),
6422
- project.description && /* @__PURE__ */ jsx(WorkDescription, { children: project.description }),
6423
- project.highlights && project.highlights.length > 0 && /* @__PURE__ */ jsx(WorkHighlights, { children: project.highlights.map((highlight, i) => /* @__PURE__ */ jsx("li", { children: highlight }, i)) })
6475
+ project.description && /* @__PURE__ */ jsx(
6476
+ InlineMarkdown,
6477
+ {
6478
+ as: WorkDescription,
6479
+ text: project.description
6480
+ }
6481
+ ),
6482
+ project.highlights && project.highlights.length > 0 && /* @__PURE__ */ jsx(WorkHighlights, { children: project.highlights.map((highlight, i) => /* @__PURE__ */ jsx(InlineMarkdown, { as: "li", text: highlight }, i)) })
6424
6483
  ] }, index))
6425
6484
  ] }),
6426
6485
  education.length > 0 && /* @__PURE__ */ jsxs(MainSection, { children: [
@@ -6449,8 +6508,8 @@ function Resume({ resume }) {
6449
6508
  /* @__PURE__ */ jsx(WorkMeta, { children: /* @__PURE__ */ jsx(DateRange, { startDate: vol.startDate, endDate: vol.endDate }) })
6450
6509
  ] }),
6451
6510
  /* @__PURE__ */ jsx(WorkCompany, { children: vol.organization }),
6452
- vol.summary && /* @__PURE__ */ jsx(WorkDescription, { children: vol.summary }),
6453
- vol.highlights && vol.highlights.length > 0 && /* @__PURE__ */ jsx(WorkHighlights, { children: vol.highlights.map((highlight, i) => /* @__PURE__ */ jsx("li", { children: highlight }, i)) })
6511
+ vol.summary && /* @__PURE__ */ jsx(InlineMarkdown, { as: WorkDescription, text: vol.summary }),
6512
+ vol.highlights && vol.highlights.length > 0 && /* @__PURE__ */ jsx(WorkHighlights, { children: vol.highlights.map((highlight, i) => /* @__PURE__ */ jsx(InlineMarkdown, { as: "li", text: highlight }, i)) })
6454
6513
  ] }, index))
6455
6514
  ] }),
6456
6515
  awards.length > 0 && /* @__PURE__ */ jsxs(MainSection, { children: [
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "jsonresume-theme-investor-brief",
3
- "version": "0.2.13",
3
+ "version": "0.2.14",
4
4
  "description": "Crisp, analytical, results-focused theme resembling a fund report. Data-first with Key Metrics section.",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
package/src/Resume.jsx CHANGED
@@ -7,6 +7,7 @@ import {
7
7
  ContactInfo,
8
8
  Link,
9
9
  safeUrl,
10
+ InlineMarkdown,
10
11
  } from '@jsonresume/core';
11
12
 
12
13
  const Layout = styled.div`
@@ -298,7 +299,7 @@ function Resume({ resume }) {
298
299
 
299
300
  {basics.summary && (
300
301
  <SummarySection>
301
- <SummaryText>{basics.summary}</SummaryText>
302
+ <InlineMarkdown as={SummaryText} text={basics.summary} />
302
303
  </SummarySection>
303
304
  )}
304
305
 
@@ -328,11 +329,13 @@ function Resume({ resume }) {
328
329
  </WorkMeta>
329
330
  </WorkHeader>
330
331
  {job.name && <WorkCompany>{job.name}</WorkCompany>}
331
- {job.summary && <WorkDescription>{job.summary}</WorkDescription>}
332
+ {job.summary && (
333
+ <InlineMarkdown as={WorkDescription} text={job.summary} />
334
+ )}
332
335
  {job.highlights && job.highlights.length > 0 && (
333
336
  <WorkHighlights>
334
337
  {job.highlights.map((highlight, i) => (
335
- <li key={i}>{highlight}</li>
338
+ <InlineMarkdown as="li" key={i} text={highlight} />
336
339
  ))}
337
340
  </WorkHighlights>
338
341
  )}
@@ -380,12 +383,15 @@ function Resume({ resume }) {
380
383
  )}
381
384
  </WorkHeader>
382
385
  {project.description && (
383
- <WorkDescription>{project.description}</WorkDescription>
386
+ <InlineMarkdown
387
+ as={WorkDescription}
388
+ text={project.description}
389
+ />
384
390
  )}
385
391
  {project.highlights && project.highlights.length > 0 && (
386
392
  <WorkHighlights>
387
393
  {project.highlights.map((highlight, i) => (
388
- <li key={i}>{highlight}</li>
394
+ <InlineMarkdown as="li" key={i} text={highlight} />
389
395
  ))}
390
396
  </WorkHighlights>
391
397
  )}
@@ -428,11 +434,13 @@ function Resume({ resume }) {
428
434
  </WorkMeta>
429
435
  </WorkHeader>
430
436
  <WorkCompany>{vol.organization}</WorkCompany>
431
- {vol.summary && <WorkDescription>{vol.summary}</WorkDescription>}
437
+ {vol.summary && (
438
+ <InlineMarkdown as={WorkDescription} text={vol.summary} />
439
+ )}
432
440
  {vol.highlights && vol.highlights.length > 0 && (
433
441
  <WorkHighlights>
434
442
  {vol.highlights.map((highlight, i) => (
435
- <li key={i}>{highlight}</li>
443
+ <InlineMarkdown as="li" key={i} text={highlight} />
436
444
  ))}
437
445
  </WorkHighlights>
438
446
  )}