jsonresume-theme-art-school-modern 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-art-school-modern
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
@@ -1424,6 +1424,50 @@ dt.span`
1424
1424
  margin-right: 8px;
1425
1425
  font-size: 1.2em;
1426
1426
  `;
1427
+ const ESCAPES = {
1428
+ "&": "&",
1429
+ "<": "&lt;",
1430
+ ">": "&gt;",
1431
+ '"': "&quot;",
1432
+ "'": "&#39;"
1433
+ };
1434
+ const escapeHtml = (text) => text.replace(/[&<>"']/g, (c) => ESCAPES[c]);
1435
+ const ESCAPABLE = /\\([\\`*_[\]()!#])/g;
1436
+ const CODE = /`([^`]+)`/g;
1437
+ const LINK = /\[([^\]]+)\]\(([^)\s]+)\)/g;
1438
+ const STRONG = /\*\*(?=\S)([^*]*?\S)\*\*|__(?=\S)([^_]*?\S)__/g;
1439
+ const EMPHASIS = /\*(?=\S)([^*]*?\S)\*|(^|[^\p{L}\p{N}_])_(?=\S)([^_]*?\S)_(?![\p{L}\p{N}_])/gu;
1440
+ const safeHref = (url) => /^(https?:\/\/|mailto:)/i.test(url) ? url : void 0;
1441
+ const emphasis = (text, strong, em) => text.replace(STRONG, (_2, a, b2) => strong(a ?? b2)).replace(
1442
+ EMPHASIS,
1443
+ (_2, a, before, b2) => a !== void 0 ? em(a) : `${before}${em(b2)}`
1444
+ );
1445
+ const inline = (text, out) => {
1446
+ const kept = [];
1447
+ const keep = (value) => `${kept.push(value) - 1}`;
1448
+ const marks = (t) => emphasis(t, out.strong, out.em);
1449
+ const rest = text.replace(/\uE000/g, "").replace(ESCAPABLE, (_2, c) => keep(out.text(c))).replace(CODE, (_2, body) => keep(out.code(body))).replace(
1450
+ LINK,
1451
+ (_2, label, url) => keep(out.link(marks(out.text(label)), url))
1452
+ );
1453
+ return marks(out.text(rest)).replace(
1454
+ /\uE000(\d+)\uE000/g,
1455
+ (_2, i) => kept[Number(i)]
1456
+ );
1457
+ };
1458
+ function renderInlineMarkdown(text) {
1459
+ if (typeof text !== "string") return "";
1460
+ return inline(text, {
1461
+ text: escapeHtml,
1462
+ code: (body) => `<code>${escapeHtml(body)}</code>`,
1463
+ link: (label, url) => {
1464
+ const href = safeHref(url);
1465
+ return href ? `<a href="${escapeHtml(href)}">${label}</a>` : label;
1466
+ },
1467
+ strong: (t) => `<strong>${t}</strong>`,
1468
+ em: (t) => `<em>${t}</em>`
1469
+ });
1470
+ }
1427
1471
  dt.div`
1428
1472
  margin-bottom: ${(props) => props.theme?.spacing?.item || "var(--resume-space-item, 1rem)"};
1429
1473
 
@@ -1698,16 +1742,16 @@ const StyledLink = dt.a`
1698
1742
  }
1699
1743
  `;
1700
1744
  function Link({ href, children, className, ...rest }) {
1701
- const safeHref = safeUrl(href);
1702
- if (!safeHref) {
1745
+ const safeHref2 = safeUrl(href);
1746
+ if (!safeHref2) {
1703
1747
  return /* @__PURE__ */ jsx("span", { className, children });
1704
1748
  }
1705
- const isExternal = isExternalUrl(safeHref);
1749
+ const isExternal = isExternalUrl(safeHref2);
1706
1750
  const externalProps = isExternal ? { target: "_blank", rel: "noopener noreferrer" } : {};
1707
1751
  return /* @__PURE__ */ jsx(
1708
1752
  StyledLink,
1709
1753
  {
1710
- href: safeHref,
1754
+ href: safeHref2,
1711
1755
  className: `resume-link ${className || ""}`.trim(),
1712
1756
  ...externalProps,
1713
1757
  ...rest,
@@ -1735,6 +1779,15 @@ dt.span`
1735
1779
  }
1736
1780
  }
1737
1781
  `;
1782
+ function InlineMarkdown({ text, as: Tag2 = "span", ...rest }) {
1783
+ return /* @__PURE__ */ jsx(
1784
+ Tag2,
1785
+ {
1786
+ ...rest,
1787
+ dangerouslySetInnerHTML: { __html: renderInlineMarkdown(text) }
1788
+ }
1789
+ );
1790
+ }
1738
1791
  dt.hr`
1739
1792
  border: none;
1740
1793
  border-top: 0.5pt solid
@@ -6386,7 +6439,7 @@ function locationString(loc) {
6386
6439
  }
6387
6440
  function Highlights({ items }) {
6388
6441
  if (!items || items.length === 0) return null;
6389
- return /* @__PURE__ */ jsx(Bullets, { children: items.map((h, i) => /* @__PURE__ */ jsx("li", { children: h }, i)) });
6442
+ return /* @__PURE__ */ jsx(Bullets, { children: items.map((h, i) => /* @__PURE__ */ jsx(InlineMarkdown, { as: "li", text: h }, i)) });
6390
6443
  }
6391
6444
  function SectionBlock({ index: index2, title, children }) {
6392
6445
  return /* @__PURE__ */ jsxs(Block, { children: [
@@ -6454,7 +6507,7 @@ function Resume({ resume }) {
6454
6507
  ] }),
6455
6508
  basics.summary && /* @__PURE__ */ jsxs(Statement, { children: [
6456
6509
  /* @__PURE__ */ jsx(StatementMark, { children: "— Statement" }),
6457
- /* @__PURE__ */ jsx(StatementText, { children: basics.summary })
6510
+ /* @__PURE__ */ jsx(InlineMarkdown, { as: StatementText, text: basics.summary })
6458
6511
  ] }),
6459
6512
  work.length > 0 && /* @__PURE__ */ jsx(SectionBlock, { index: next2(), title: "Work", children: work.map((job, i) => /* @__PURE__ */ jsxs(Entry, { children: [
6460
6513
  /* @__PURE__ */ jsxs(EntryTop, { children: [
@@ -6469,7 +6522,7 @@ function Resume({ resume }) {
6469
6522
  ] }),
6470
6523
  job.name && job.position && /* @__PURE__ */ jsx(EntrySub, { children: job.name }),
6471
6524
  job.location && /* @__PURE__ */ jsx(EntryMeta, { children: job.location }),
6472
- job.summary && /* @__PURE__ */ jsx(EntryText, { children: job.summary }),
6525
+ job.summary && /* @__PURE__ */ jsx(InlineMarkdown, { as: EntryText, text: job.summary }),
6473
6526
  /* @__PURE__ */ jsx(Highlights, { items: job.highlights })
6474
6527
  ] }, i)) }),
6475
6528
  projects.length > 0 && /* @__PURE__ */ jsx(SectionBlock, { index: next2(), title: "Works", children: projects.map((proj, i) => /* @__PURE__ */ jsxs(Entry, { children: [
@@ -6484,7 +6537,7 @@ function Resume({ resume }) {
6484
6537
  ) })
6485
6538
  ] }),
6486
6539
  proj.type && /* @__PURE__ */ jsx(EntrySub, { children: proj.type }),
6487
- proj.description && /* @__PURE__ */ jsx(EntryText, { children: proj.description }),
6540
+ proj.description && /* @__PURE__ */ jsx(InlineMarkdown, { as: EntryText, text: proj.description }),
6488
6541
  /* @__PURE__ */ jsx(Highlights, { items: proj.highlights }),
6489
6542
  proj.keywords && proj.keywords.length > 0 && /* @__PURE__ */ jsx(TagWrap, { children: proj.keywords.map((k2, j2) => /* @__PURE__ */ jsx(Tag, { children: k2 }, j2)) })
6490
6543
  ] }, i)) }),
@@ -6519,7 +6572,7 @@ function Resume({ resume }) {
6519
6572
  a.date && /* @__PURE__ */ jsx(EntryMeta, { children: a.date })
6520
6573
  ] }),
6521
6574
  a.awarder && /* @__PURE__ */ jsx(EntrySub, { children: a.awarder }),
6522
- a.summary && /* @__PURE__ */ jsx(EntryText, { children: a.summary })
6575
+ a.summary && /* @__PURE__ */ jsx(InlineMarkdown, { as: EntryText, text: a.summary })
6523
6576
  ] }, i)) }) }),
6524
6577
  certificates.length > 0 && /* @__PURE__ */ jsx(SectionBlock, { index: next2(), title: "Certificates", children: /* @__PURE__ */ jsx(Rows, { children: certificates.map((c, i) => /* @__PURE__ */ jsxs(Entry, { children: [
6525
6578
  /* @__PURE__ */ jsxs(EntryTop, { children: [
@@ -6534,7 +6587,7 @@ function Resume({ resume }) {
6534
6587
  p2.releaseDate && /* @__PURE__ */ jsx(EntryMeta, { children: p2.releaseDate })
6535
6588
  ] }),
6536
6589
  p2.publisher && /* @__PURE__ */ jsx(EntrySub, { children: p2.publisher }),
6537
- p2.summary && /* @__PURE__ */ jsx(EntryText, { children: p2.summary })
6590
+ p2.summary && /* @__PURE__ */ jsx(InlineMarkdown, { as: EntryText, text: p2.summary })
6538
6591
  ] }, i)) }) }),
6539
6592
  volunteer.length > 0 && /* @__PURE__ */ jsx(SectionBlock, { index: next2(), title: "Service", children: volunteer.map((v2, i) => /* @__PURE__ */ jsxs(Entry, { children: [
6540
6593
  /* @__PURE__ */ jsxs(EntryTop, { children: [
@@ -6542,7 +6595,7 @@ function Resume({ resume }) {
6542
6595
  /* @__PURE__ */ jsx(EntryMeta, { children: /* @__PURE__ */ jsx(DateRange, { startDate: v2.startDate, endDate: v2.endDate }) })
6543
6596
  ] }),
6544
6597
  v2.organization && v2.position && /* @__PURE__ */ jsx(EntrySub, { children: v2.organization }),
6545
- v2.summary && /* @__PURE__ */ jsx(EntryText, { children: v2.summary }),
6598
+ v2.summary && /* @__PURE__ */ jsx(InlineMarkdown, { as: EntryText, text: v2.summary }),
6546
6599
  /* @__PURE__ */ jsx(Highlights, { items: v2.highlights })
6547
6600
  ] }, i)) }),
6548
6601
  languages.length > 0 && /* @__PURE__ */ jsx(SectionBlock, { index: next2(), title: "Languages", children: /* @__PURE__ */ jsx(InlineList, { children: languages.map((l, i) => /* @__PURE__ */ jsxs(Pair, { children: [
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "jsonresume-theme-art-school-modern",
3
- "version": "0.2.13",
3
+ "version": "0.2.15",
4
4
  "type": "module",
5
5
  "main": "./dist/index.js",
6
6
  "description": "Art School Modern JSON Resume theme - avant-garde gallery aesthetic with oversized display type, asymmetric expressive layout, and a single vivid accent",
@@ -12,7 +12,7 @@
12
12
  },
13
13
  "dependencies": {
14
14
  "styled-components": "^6.1.19",
15
- "@jsonresume/core": "0.4.0"
15
+ "@jsonresume/core": "0.4.1"
16
16
  },
17
17
  "exports": {
18
18
  ".": {
package/src/Resume.jsx CHANGED
@@ -1,6 +1,6 @@
1
1
  import React from 'react';
2
2
  import styled from 'styled-components';
3
- import { DateRange, Link, safeUrl } from '@jsonresume/core';
3
+ import { DateRange, Link, safeUrl, InlineMarkdown } from '@jsonresume/core';
4
4
 
5
5
  /*
6
6
  * Art School Modern
@@ -413,7 +413,7 @@ function Highlights({ items }) {
413
413
  return (
414
414
  <Bullets>
415
415
  {items.map((h, i) => (
416
- <li key={i}>{h}</li>
416
+ <InlineMarkdown as="li" key={i} text={h} />
417
417
  ))}
418
418
  </Bullets>
419
419
  );
@@ -510,7 +510,7 @@ function Resume({ resume }) {
510
510
  {basics.summary && (
511
511
  <Statement>
512
512
  <StatementMark>{'— Statement'}</StatementMark>
513
- <StatementText>{basics.summary}</StatementText>
513
+ <InlineMarkdown as={StatementText} text={basics.summary} />
514
514
  </Statement>
515
515
  )}
516
516
 
@@ -529,7 +529,9 @@ function Resume({ resume }) {
529
529
  </EntryTop>
530
530
  {job.name && job.position && <EntrySub>{job.name}</EntrySub>}
531
531
  {job.location && <EntryMeta>{job.location}</EntryMeta>}
532
- {job.summary && <EntryText>{job.summary}</EntryText>}
532
+ {job.summary && (
533
+ <InlineMarkdown as={EntryText} text={job.summary} />
534
+ )}
533
535
  <Highlights items={job.highlights} />
534
536
  </Entry>
535
537
  ))}
@@ -556,7 +558,9 @@ function Resume({ resume }) {
556
558
  </EntryMeta>
557
559
  </EntryTop>
558
560
  {proj.type && <EntrySub>{proj.type}</EntrySub>}
559
- {proj.description && <EntryText>{proj.description}</EntryText>}
561
+ {proj.description && (
562
+ <InlineMarkdown as={EntryText} text={proj.description} />
563
+ )}
560
564
  <Highlights items={proj.highlights} />
561
565
  {proj.keywords && proj.keywords.length > 0 && (
562
566
  <TagWrap>
@@ -627,7 +631,9 @@ function Resume({ resume }) {
627
631
  {a.date && <EntryMeta>{a.date}</EntryMeta>}
628
632
  </EntryTop>
629
633
  {a.awarder && <EntrySub>{a.awarder}</EntrySub>}
630
- {a.summary && <EntryText>{a.summary}</EntryText>}
634
+ {a.summary && (
635
+ <InlineMarkdown as={EntryText} text={a.summary} />
636
+ )}
631
637
  </Entry>
632
638
  ))}
633
639
  </Rows>
@@ -672,7 +678,9 @@ function Resume({ resume }) {
672
678
  {p.releaseDate && <EntryMeta>{p.releaseDate}</EntryMeta>}
673
679
  </EntryTop>
674
680
  {p.publisher && <EntrySub>{p.publisher}</EntrySub>}
675
- {p.summary && <EntryText>{p.summary}</EntryText>}
681
+ {p.summary && (
682
+ <InlineMarkdown as={EntryText} text={p.summary} />
683
+ )}
676
684
  </Entry>
677
685
  ))}
678
686
  </Rows>
@@ -692,7 +700,9 @@ function Resume({ resume }) {
692
700
  {v.organization && v.position && (
693
701
  <EntrySub>{v.organization}</EntrySub>
694
702
  )}
695
- {v.summary && <EntryText>{v.summary}</EntryText>}
703
+ {v.summary && (
704
+ <InlineMarkdown as={EntryText} text={v.summary} />
705
+ )}
696
706
  <Highlights items={v.highlights} />
697
707
  </Entry>
698
708
  ))}