jsonresume-theme-sidebar 0.2.12 → 0.2.13

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-sidebar
2
2
 
3
+ ## 0.2.13
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.12
4
10
 
5
11
  ### Patch Changes
package/dist/index.js CHANGED
@@ -1655,6 +1655,59 @@ dt.span`
1655
1655
  }
1656
1656
  }
1657
1657
  `;
1658
+ const ESCAPES = {
1659
+ "&": "&",
1660
+ "<": "&lt;",
1661
+ ">": "&gt;",
1662
+ '"': "&quot;",
1663
+ "'": "&#39;"
1664
+ };
1665
+ const escapeHtml = (text) => text.replace(/[&<>"']/g, (c) => ESCAPES[c]);
1666
+ const ESCAPABLE = /\\([\\`*_[\]()!#])/g;
1667
+ const CODE = /`([^`]+)`/g;
1668
+ const LINK = /\[([^\]]+)\]\(([^)\s]+)\)/g;
1669
+ const STRONG = /\*\*(?=\S)([^*]*?\S)\*\*|__(?=\S)([^_]*?\S)__/g;
1670
+ const EMPHASIS = /\*(?=\S)([^*]*?\S)\*|(^|[^\p{L}\p{N}_])_(?=\S)([^_]*?\S)_(?![\p{L}\p{N}_])/gu;
1671
+ const safeHref = (url) => /^(https?:\/\/|mailto:)/i.test(url) ? url : void 0;
1672
+ const emphasis = (text, strong, em) => text.replace(STRONG, (_2, a, b2) => strong(a ?? b2)).replace(
1673
+ EMPHASIS,
1674
+ (_2, a, before, b2) => a !== void 0 ? em(a) : `${before}${em(b2)}`
1675
+ );
1676
+ const inline = (text, out) => {
1677
+ const kept = [];
1678
+ const keep = (value) => `${kept.push(value) - 1}`;
1679
+ const marks = (t) => emphasis(t, out.strong, out.em);
1680
+ const rest = text.replace(/\uE000/g, "").replace(ESCAPABLE, (_2, c) => keep(out.text(c))).replace(CODE, (_2, body) => keep(out.code(body))).replace(
1681
+ LINK,
1682
+ (_2, label, url) => keep(out.link(marks(out.text(label)), url))
1683
+ );
1684
+ return marks(out.text(rest)).replace(
1685
+ /\uE000(\d+)\uE000/g,
1686
+ (_2, i) => kept[Number(i)]
1687
+ );
1688
+ };
1689
+ function renderInlineMarkdown(text) {
1690
+ if (typeof text !== "string") return "";
1691
+ return inline(text, {
1692
+ text: escapeHtml,
1693
+ code: (body) => `<code>${escapeHtml(body)}</code>`,
1694
+ link: (label, url) => {
1695
+ const href = safeHref(url);
1696
+ return href ? `<a href="${escapeHtml(href)}">${label}</a>` : label;
1697
+ },
1698
+ strong: (t) => `<strong>${t}</strong>`,
1699
+ em: (t) => `<em>${t}</em>`
1700
+ });
1701
+ }
1702
+ function InlineMarkdown({ text, as: Tag = "span", ...rest }) {
1703
+ return /* @__PURE__ */ jsx(
1704
+ Tag,
1705
+ {
1706
+ ...rest,
1707
+ dangerouslySetInnerHTML: { __html: renderInlineMarkdown(text) }
1708
+ }
1709
+ );
1710
+ }
1658
1711
  dt.hr`
1659
1712
  border: none;
1660
1713
  border-top: 0.5pt solid
@@ -6332,7 +6385,7 @@ function Resume({ resume }) {
6332
6385
  ] }),
6333
6386
  basics.summary && /* @__PURE__ */ jsxs(MainSection, { children: [
6334
6387
  /* @__PURE__ */ jsx(MainSectionTitle, { children: "PROFILE" }),
6335
- /* @__PURE__ */ jsx(ProfileText, { children: basics.summary })
6388
+ /* @__PURE__ */ jsx(InlineMarkdown, { as: ProfileText, text: basics.summary })
6336
6389
  ] }),
6337
6390
  work.length > 0 && /* @__PURE__ */ jsxs(MainSection, { children: [
6338
6391
  /* @__PURE__ */ jsx(MainSectionTitle, { children: "WORK EXPERIENCE" }),
@@ -6349,8 +6402,15 @@ function Resume({ resume }) {
6349
6402
  job.endDate ? new Date(job.endDate).getFullYear() : "PRESENT"
6350
6403
  ] }) })
6351
6404
  ] }),
6352
- job.summary && /* @__PURE__ */ jsx("p", { style: { marginBottom: "10px", color: "#4a4a4a" }, children: job.summary }),
6353
- job.highlights && job.highlights.length > 0 && /* @__PURE__ */ jsx(WorkDescription, { children: job.highlights.map((highlight, idx) => /* @__PURE__ */ jsx("li", { children: highlight }, idx)) })
6405
+ job.summary && /* @__PURE__ */ jsx(
6406
+ InlineMarkdown,
6407
+ {
6408
+ as: "p",
6409
+ style: { marginBottom: "10px", color: "#4a4a4a" },
6410
+ text: job.summary
6411
+ }
6412
+ ),
6413
+ job.highlights && job.highlights.length > 0 && /* @__PURE__ */ jsx(WorkDescription, { children: job.highlights.map((highlight, idx) => /* @__PURE__ */ jsx(InlineMarkdown, { as: "li", text: highlight }, idx)) })
6354
6414
  ] }, index2))
6355
6415
  ] }),
6356
6416
  projects.length > 0 && /* @__PURE__ */ jsxs(MainSection, { children: [
@@ -6375,8 +6435,15 @@ function Resume({ resume }) {
6375
6435
  project.endDate && ` - ${new Date(project.endDate).getFullYear()}`
6376
6436
  ] }) })
6377
6437
  ] }),
6378
- project.description && /* @__PURE__ */ jsx("p", { style: { marginBottom: "10px", color: "#4a4a4a" }, children: project.description }),
6379
- project.highlights && project.highlights.length > 0 && /* @__PURE__ */ jsx(WorkDescription, { children: project.highlights.map((highlight, idx) => /* @__PURE__ */ jsx("li", { children: highlight }, idx)) })
6438
+ project.description && /* @__PURE__ */ jsx(
6439
+ InlineMarkdown,
6440
+ {
6441
+ as: "p",
6442
+ style: { marginBottom: "10px", color: "#4a4a4a" },
6443
+ text: project.description
6444
+ }
6445
+ ),
6446
+ project.highlights && project.highlights.length > 0 && /* @__PURE__ */ jsx(WorkDescription, { children: project.highlights.map((highlight, idx) => /* @__PURE__ */ jsx(InlineMarkdown, { as: "li", text: highlight }, idx)) })
6380
6447
  ] }, index2))
6381
6448
  ] }),
6382
6449
  volunteer.length > 0 && /* @__PURE__ */ jsxs(MainSection, { children: [
@@ -6394,8 +6461,15 @@ function Resume({ resume }) {
6394
6461
  vol.endDate ? new Date(vol.endDate).getFullYear() : "PRESENT"
6395
6462
  ] }) })
6396
6463
  ] }),
6397
- vol.summary && /* @__PURE__ */ jsx("p", { style: { marginBottom: "10px", color: "#4a4a4a" }, children: vol.summary }),
6398
- vol.highlights && vol.highlights.length > 0 && /* @__PURE__ */ jsx(WorkDescription, { children: vol.highlights.map((highlight, idx) => /* @__PURE__ */ jsx("li", { children: highlight }, idx)) })
6464
+ vol.summary && /* @__PURE__ */ jsx(
6465
+ InlineMarkdown,
6466
+ {
6467
+ as: "p",
6468
+ style: { marginBottom: "10px", color: "#4a4a4a" },
6469
+ text: vol.summary
6470
+ }
6471
+ ),
6472
+ vol.highlights && vol.highlights.length > 0 && /* @__PURE__ */ jsx(WorkDescription, { children: vol.highlights.map((highlight, idx) => /* @__PURE__ */ jsx(InlineMarkdown, { as: "li", text: highlight }, idx)) })
6399
6473
  ] }, index2))
6400
6474
  ] }),
6401
6475
  awards.length > 0 && /* @__PURE__ */ jsxs(MainSection, { children: [
@@ -6410,7 +6484,14 @@ function Resume({ resume }) {
6410
6484
  award.awarder,
6411
6485
  award.date && ` - ${new Date(award.date).toLocaleDateString()}`
6412
6486
  ] }),
6413
- award.summary && /* @__PURE__ */ jsx("p", { style: { marginTop: "8px", color: "#4a4a4a" }, children: award.summary })
6487
+ award.summary && /* @__PURE__ */ jsx(
6488
+ InlineMarkdown,
6489
+ {
6490
+ as: "p",
6491
+ style: { marginTop: "8px", color: "#4a4a4a" },
6492
+ text: award.summary
6493
+ }
6494
+ )
6414
6495
  ]
6415
6496
  },
6416
6497
  index2
@@ -6463,7 +6544,14 @@ function Resume({ resume }) {
6463
6544
  pub.publisher,
6464
6545
  pub.releaseDate && ` - ${new Date(pub.releaseDate).toLocaleDateString()}`
6465
6546
  ] }),
6466
- pub.summary && /* @__PURE__ */ jsx("p", { style: { marginTop: "8px", color: "#4a4a4a" }, children: pub.summary })
6547
+ pub.summary && /* @__PURE__ */ jsx(
6548
+ InlineMarkdown,
6549
+ {
6550
+ as: "p",
6551
+ style: { marginTop: "8px", color: "#4a4a4a" },
6552
+ text: pub.summary
6553
+ }
6554
+ )
6467
6555
  ]
6468
6556
  },
6469
6557
  index2
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "jsonresume-theme-sidebar",
3
- "version": "0.2.12",
3
+ "version": "0.2.13",
4
4
  "description": "Two-column sidebar resume theme with dark sidebar and light main content - ATS-friendly",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
package/src/Resume.jsx CHANGED
@@ -7,6 +7,7 @@ import {
7
7
  BadgeList,
8
8
  safeUrl,
9
9
  getLinkRel,
10
+ InlineMarkdown,
10
11
  } from '@jsonresume/core';
11
12
 
12
13
  /**
@@ -454,7 +455,7 @@ function Resume({ resume }) {
454
455
  {basics.summary && (
455
456
  <MainSection>
456
457
  <MainSectionTitle>PROFILE</MainSectionTitle>
457
- <ProfileText>{basics.summary}</ProfileText>
458
+ <InlineMarkdown as={ProfileText} text={basics.summary} />
458
459
  </MainSection>
459
460
  )}
460
461
 
@@ -481,14 +482,16 @@ function Resume({ resume }) {
481
482
  </WorkDate>
482
483
  </WorkHeader>
483
484
  {job.summary && (
484
- <p style={{ marginBottom: '10px', color: '#4a4a4a' }}>
485
- {job.summary}
486
- </p>
485
+ <InlineMarkdown
486
+ as="p"
487
+ style={{ marginBottom: '10px', color: '#4a4a4a' }}
488
+ text={job.summary}
489
+ />
487
490
  )}
488
491
  {job.highlights && job.highlights.length > 0 && (
489
492
  <WorkDescription>
490
493
  {job.highlights.map((highlight, idx) => (
491
- <li key={idx}>{highlight}</li>
494
+ <InlineMarkdown as="li" key={idx} text={highlight} />
492
495
  ))}
493
496
  </WorkDescription>
494
497
  )}
@@ -530,14 +533,16 @@ function Resume({ resume }) {
530
533
  </WorkDate>
531
534
  </WorkHeader>
532
535
  {project.description && (
533
- <p style={{ marginBottom: '10px', color: '#4a4a4a' }}>
534
- {project.description}
535
- </p>
536
+ <InlineMarkdown
537
+ as="p"
538
+ style={{ marginBottom: '10px', color: '#4a4a4a' }}
539
+ text={project.description}
540
+ />
536
541
  )}
537
542
  {project.highlights && project.highlights.length > 0 && (
538
543
  <WorkDescription>
539
544
  {project.highlights.map((highlight, idx) => (
540
- <li key={idx}>{highlight}</li>
545
+ <InlineMarkdown as="li" key={idx} text={highlight} />
541
546
  ))}
542
547
  </WorkDescription>
543
548
  )}
@@ -569,14 +574,16 @@ function Resume({ resume }) {
569
574
  </WorkDate>
570
575
  </WorkHeader>
571
576
  {vol.summary && (
572
- <p style={{ marginBottom: '10px', color: '#4a4a4a' }}>
573
- {vol.summary}
574
- </p>
577
+ <InlineMarkdown
578
+ as="p"
579
+ style={{ marginBottom: '10px', color: '#4a4a4a' }}
580
+ text={vol.summary}
581
+ />
575
582
  )}
576
583
  {vol.highlights && vol.highlights.length > 0 && (
577
584
  <WorkDescription>
578
585
  {vol.highlights.map((highlight, idx) => (
579
- <li key={idx}>{highlight}</li>
586
+ <InlineMarkdown as="li" key={idx} text={highlight} />
580
587
  ))}
581
588
  </WorkDescription>
582
589
  )}
@@ -601,9 +608,11 @@ function Resume({ resume }) {
601
608
  ` - ${new Date(award.date).toLocaleDateString()}`}
602
609
  </WorkCompany>
603
610
  {award.summary && (
604
- <p style={{ marginTop: '8px', color: '#4a4a4a' }}>
605
- {award.summary}
606
- </p>
611
+ <InlineMarkdown
612
+ as="p"
613
+ style={{ marginTop: '8px', color: '#4a4a4a' }}
614
+ text={award.summary}
615
+ />
607
616
  )}
608
617
  </div>
609
618
  ))}
@@ -672,9 +681,11 @@ function Resume({ resume }) {
672
681
  ` - ${new Date(pub.releaseDate).toLocaleDateString()}`}
673
682
  </WorkCompany>
674
683
  {pub.summary && (
675
- <p style={{ marginTop: '8px', color: '#4a4a4a' }}>
676
- {pub.summary}
677
- </p>
684
+ <InlineMarkdown
685
+ as="p"
686
+ style={{ marginTop: '8px', color: '#4a4a4a' }}
687
+ text={pub.summary}
688
+ />
678
689
  )}
679
690
  </div>
680
691
  ))}