jsonresume-theme-minimalist-grid 0.2.11 → 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,18 @@
1
1
  # jsonresume-theme-minimalist-grid
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
+
9
+ ## 0.2.12
10
+
11
+ ### Patch Changes
12
+
13
+ - Updated dependencies [a6ba9ed]
14
+ - @jsonresume/core@0.4.0
15
+
3
16
  ## 0.2.11
4
17
 
5
18
  ### Patch Changes
package/dist/index.js CHANGED
@@ -1823,16 +1823,16 @@ const StyledLink = dt.a`
1823
1823
  }
1824
1824
  `;
1825
1825
  function Link({ href, children, className, ...rest }) {
1826
- const safeHref = safeUrl(href);
1827
- if (!safeHref) {
1826
+ const safeHref2 = safeUrl(href);
1827
+ if (!safeHref2) {
1828
1828
  return /* @__PURE__ */ jsx("span", { className, children });
1829
1829
  }
1830
- const isExternal = isExternalUrl(safeHref);
1830
+ const isExternal = isExternalUrl(safeHref2);
1831
1831
  const externalProps = isExternal ? { target: "_blank", rel: "noopener noreferrer" } : {};
1832
1832
  return /* @__PURE__ */ jsx(
1833
1833
  StyledLink,
1834
1834
  {
1835
- href: safeHref,
1835
+ href: safeHref2,
1836
1836
  className: `resume-link ${className || ""}`.trim(),
1837
1837
  ...externalProps,
1838
1838
  ...rest,
@@ -1860,6 +1860,59 @@ dt.span`
1860
1860
  }
1861
1861
  }
1862
1862
  `;
1863
+ const ESCAPES = {
1864
+ "&": "&",
1865
+ "<": "&lt;",
1866
+ ">": "&gt;",
1867
+ '"': "&quot;",
1868
+ "'": "&#39;"
1869
+ };
1870
+ const escapeHtml = (text) => text.replace(/[&<>"']/g, (c) => ESCAPES[c]);
1871
+ const ESCAPABLE = /\\([\\`*_[\]()!#])/g;
1872
+ const CODE = /`([^`]+)`/g;
1873
+ const LINK = /\[([^\]]+)\]\(([^)\s]+)\)/g;
1874
+ const STRONG = /\*\*(?=\S)([^*]*?\S)\*\*|__(?=\S)([^_]*?\S)__/g;
1875
+ const EMPHASIS = /\*(?=\S)([^*]*?\S)\*|(^|[^\p{L}\p{N}_])_(?=\S)([^_]*?\S)_(?![\p{L}\p{N}_])/gu;
1876
+ const safeHref = (url) => /^(https?:\/\/|mailto:)/i.test(url) ? url : void 0;
1877
+ const emphasis = (text, strong, em) => text.replace(STRONG, (_2, a, b2) => strong(a ?? b2)).replace(
1878
+ EMPHASIS,
1879
+ (_2, a, before, b2) => a !== void 0 ? em(a) : `${before}${em(b2)}`
1880
+ );
1881
+ const inline = (text, out) => {
1882
+ const kept = [];
1883
+ const keep = (value) => `${kept.push(value) - 1}`;
1884
+ const marks = (t) => emphasis(t, out.strong, out.em);
1885
+ const rest = text.replace(/\uE000/g, "").replace(ESCAPABLE, (_2, c) => keep(out.text(c))).replace(CODE, (_2, body) => keep(out.code(body))).replace(
1886
+ LINK,
1887
+ (_2, label, url) => keep(out.link(marks(out.text(label)), url))
1888
+ );
1889
+ return marks(out.text(rest)).replace(
1890
+ /\uE000(\d+)\uE000/g,
1891
+ (_2, i) => kept[Number(i)]
1892
+ );
1893
+ };
1894
+ function renderInlineMarkdown(text) {
1895
+ if (typeof text !== "string") return "";
1896
+ return inline(text, {
1897
+ text: escapeHtml,
1898
+ code: (body) => `<code>${escapeHtml(body)}</code>`,
1899
+ link: (label, url) => {
1900
+ const href = safeHref(url);
1901
+ return href ? `<a href="${escapeHtml(href)}">${label}</a>` : label;
1902
+ },
1903
+ strong: (t) => `<strong>${t}</strong>`,
1904
+ em: (t) => `<em>${t}</em>`
1905
+ });
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
@@ -6383,7 +6436,7 @@ function Resume({ resume }) {
6383
6436
  basics.label && /* @__PURE__ */ jsx(Label, { children: basics.label }),
6384
6437
  /* @__PURE__ */ jsx(ContactWrapper, { children: /* @__PURE__ */ jsx(ContactInfo, { basics }) })
6385
6438
  ] }),
6386
- basics.summary && /* @__PURE__ */ jsx(SummarySection, { children: /* @__PURE__ */ jsx(SummaryText, { children: basics.summary }) }),
6439
+ basics.summary && /* @__PURE__ */ jsx(SummarySection, { children: /* @__PURE__ */ jsx(InlineMarkdown, { as: SummaryText, text: basics.summary }) }),
6387
6440
  work.length > 0 && /* @__PURE__ */ jsxs(MainSection, { children: [
6388
6441
  /* @__PURE__ */ jsx(MainSectionTitle, { children: "Experience" }),
6389
6442
  work.map((job, index) => /* @__PURE__ */ jsxs(WorkItem, { children: [
@@ -6392,8 +6445,8 @@ function Resume({ resume }) {
6392
6445
  /* @__PURE__ */ jsx(WorkMeta, { children: /* @__PURE__ */ jsx(DateRange, { startDate: job.startDate, endDate: job.endDate }) })
6393
6446
  ] }),
6394
6447
  job.name && /* @__PURE__ */ jsx(WorkCompany, { children: job.name }),
6395
- job.summary && /* @__PURE__ */ jsx(WorkDescription, { children: job.summary }),
6396
- job.highlights && job.highlights.length > 0 && /* @__PURE__ */ jsx(WorkHighlights, { children: job.highlights.map((highlight, i) => /* @__PURE__ */ jsx("li", { children: highlight }, i)) })
6448
+ job.summary && /* @__PURE__ */ jsx(InlineMarkdown, { as: WorkDescription, text: job.summary }),
6449
+ job.highlights && job.highlights.length > 0 && /* @__PURE__ */ jsx(WorkHighlights, { children: job.highlights.map((highlight, i) => /* @__PURE__ */ jsx(InlineMarkdown, { as: "li", text: highlight }, i)) })
6397
6450
  ] }, index))
6398
6451
  ] }),
6399
6452
  skills.length > 0 && /* @__PURE__ */ jsxs(MainSection, { children: [
@@ -6416,8 +6469,14 @@ function Resume({ resume }) {
6416
6469
  }
6417
6470
  ) })
6418
6471
  ] }),
6419
- project.description && /* @__PURE__ */ jsx(WorkDescription, { children: project.description }),
6420
- project.highlights && project.highlights.length > 0 && /* @__PURE__ */ jsx(WorkHighlights, { children: project.highlights.map((highlight, i) => /* @__PURE__ */ jsx("li", { children: highlight }, i)) })
6472
+ project.description && /* @__PURE__ */ jsx(
6473
+ InlineMarkdown,
6474
+ {
6475
+ as: WorkDescription,
6476
+ text: project.description
6477
+ }
6478
+ ),
6479
+ project.highlights && project.highlights.length > 0 && /* @__PURE__ */ jsx(WorkHighlights, { children: project.highlights.map((highlight, i) => /* @__PURE__ */ jsx(InlineMarkdown, { as: "li", text: highlight }, i)) })
6421
6480
  ] }, index))
6422
6481
  ] }),
6423
6482
  education.length > 0 && /* @__PURE__ */ jsxs(MainSection, { children: [
@@ -6446,8 +6505,8 @@ function Resume({ resume }) {
6446
6505
  /* @__PURE__ */ jsx(WorkMeta, { children: /* @__PURE__ */ jsx(DateRange, { startDate: vol.startDate, endDate: vol.endDate }) })
6447
6506
  ] }),
6448
6507
  /* @__PURE__ */ jsx(WorkCompany, { children: vol.organization }),
6449
- vol.summary && /* @__PURE__ */ jsx(WorkDescription, { children: vol.summary }),
6450
- vol.highlights && vol.highlights.length > 0 && /* @__PURE__ */ jsx(WorkHighlights, { children: vol.highlights.map((highlight, i) => /* @__PURE__ */ jsx("li", { children: highlight }, i)) })
6508
+ vol.summary && /* @__PURE__ */ jsx(InlineMarkdown, { as: WorkDescription, text: vol.summary }),
6509
+ vol.highlights && vol.highlights.length > 0 && /* @__PURE__ */ jsx(WorkHighlights, { children: vol.highlights.map((highlight, i) => /* @__PURE__ */ jsx(InlineMarkdown, { as: "li", text: highlight }, i)) })
6451
6510
  ] }, index))
6452
6511
  ] }),
6453
6512
  awards.length > 0 && /* @__PURE__ */ jsxs(MainSection, { children: [
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "jsonresume-theme-minimalist-grid",
3
- "version": "0.2.11",
3
+ "version": "0.2.13",
4
4
  "description": "Clean, contemporary theme with geometric precision and baseline grid alignment. For minimalists and designers.",
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.3.8"
13
+ "@jsonresume/core": "0.4.0"
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`
@@ -253,7 +254,7 @@ function Resume({ resume }) {
253
254
 
254
255
  {basics.summary && (
255
256
  <SummarySection>
256
- <SummaryText>{basics.summary}</SummaryText>
257
+ <InlineMarkdown as={SummaryText} text={basics.summary} />
257
258
  </SummarySection>
258
259
  )}
259
260
 
@@ -269,11 +270,13 @@ function Resume({ resume }) {
269
270
  </WorkMeta>
270
271
  </WorkHeader>
271
272
  {job.name && <WorkCompany>{job.name}</WorkCompany>}
272
- {job.summary && <WorkDescription>{job.summary}</WorkDescription>}
273
+ {job.summary && (
274
+ <InlineMarkdown as={WorkDescription} text={job.summary} />
275
+ )}
273
276
  {job.highlights && job.highlights.length > 0 && (
274
277
  <WorkHighlights>
275
278
  {job.highlights.map((highlight, i) => (
276
- <li key={i}>{highlight}</li>
279
+ <InlineMarkdown as="li" key={i} text={highlight} />
277
280
  ))}
278
281
  </WorkHighlights>
279
282
  )}
@@ -323,12 +326,15 @@ function Resume({ resume }) {
323
326
  )}
324
327
  </WorkHeader>
325
328
  {project.description && (
326
- <WorkDescription>{project.description}</WorkDescription>
329
+ <InlineMarkdown
330
+ as={WorkDescription}
331
+ text={project.description}
332
+ />
327
333
  )}
328
334
  {project.highlights && project.highlights.length > 0 && (
329
335
  <WorkHighlights>
330
336
  {project.highlights.map((highlight, i) => (
331
- <li key={i}>{highlight}</li>
337
+ <InlineMarkdown as="li" key={i} text={highlight} />
332
338
  ))}
333
339
  </WorkHighlights>
334
340
  )}
@@ -371,11 +377,13 @@ function Resume({ resume }) {
371
377
  </WorkMeta>
372
378
  </WorkHeader>
373
379
  <WorkCompany>{vol.organization}</WorkCompany>
374
- {vol.summary && <WorkDescription>{vol.summary}</WorkDescription>}
380
+ {vol.summary && (
381
+ <InlineMarkdown as={WorkDescription} text={vol.summary} />
382
+ )}
375
383
  {vol.highlights && vol.highlights.length > 0 && (
376
384
  <WorkHighlights>
377
385
  {vol.highlights.map((highlight, i) => (
378
- <li key={i}>{highlight}</li>
386
+ <InlineMarkdown as="li" key={i} text={highlight} />
379
387
  ))}
380
388
  </WorkHighlights>
381
389
  )}