jsonresume-theme-reference 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,19 @@
1
1
  # jsonresume-theme-reference
2
2
 
3
+ ## 0.2.14
4
+
5
+ ### Patch Changes
6
+
7
+ - 601e883: `ListItem` renders inline Markdown in string `description` and `highlights` with the shared renderer (#600); React nodes pass through unchanged.
8
+ - Updated dependencies [601e883]
9
+ - @jsonresume/core@0.4.1
10
+
11
+ ## 0.2.13
12
+
13
+ ### Patch Changes
14
+
15
+ - 2b3af11: Render inline Markdown (bold, emphasis, code, links) in summaries, descriptions and highlights with the shared renderer from @jsonresume/core (#600).
16
+
3
17
  ## 0.2.12
4
18
 
5
19
  ### Patch Changes
package/dist/index.js CHANGED
@@ -1386,6 +1386,50 @@ function SectionTitle({
1386
1386
  }
1387
1387
  );
1388
1388
  }
1389
+ const ESCAPES = {
1390
+ "&": "&",
1391
+ "<": "&lt;",
1392
+ ">": "&gt;",
1393
+ '"': "&quot;",
1394
+ "'": "&#39;"
1395
+ };
1396
+ const escapeHtml = (text) => text.replace(/[&<>"']/g, (c) => ESCAPES[c]);
1397
+ const ESCAPABLE = /\\([\\`*_[\]()!#])/g;
1398
+ const CODE = /`([^`]+)`/g;
1399
+ const LINK = /\[([^\]]+)\]\(([^)\s]+)\)/g;
1400
+ const STRONG = /\*\*(?=\S)([^*]*?\S)\*\*|__(?=\S)([^_]*?\S)__/g;
1401
+ const EMPHASIS = /\*(?=\S)([^*]*?\S)\*|(^|[^\p{L}\p{N}_])_(?=\S)([^_]*?\S)_(?![\p{L}\p{N}_])/gu;
1402
+ const safeHref = (url) => /^(https?:\/\/|mailto:)/i.test(url) ? url : void 0;
1403
+ const emphasis = (text, strong, em) => text.replace(STRONG, (_2, a, b2) => strong(a ?? b2)).replace(
1404
+ EMPHASIS,
1405
+ (_2, a, before, b2) => a !== void 0 ? em(a) : `${before}${em(b2)}`
1406
+ );
1407
+ const inline = (text, out) => {
1408
+ const kept = [];
1409
+ const keep = (value) => `${kept.push(value) - 1}`;
1410
+ const marks = (t) => emphasis(t, out.strong, out.em);
1411
+ const rest = text.replace(/\uE000/g, "").replace(ESCAPABLE, (_2, c) => keep(out.text(c))).replace(CODE, (_2, body) => keep(out.code(body))).replace(
1412
+ LINK,
1413
+ (_2, label, url) => keep(out.link(marks(out.text(label)), url))
1414
+ );
1415
+ return marks(out.text(rest)).replace(
1416
+ /\uE000(\d+)\uE000/g,
1417
+ (_2, i) => kept[Number(i)]
1418
+ );
1419
+ };
1420
+ function renderInlineMarkdown(text) {
1421
+ if (typeof text !== "string") return "";
1422
+ return inline(text, {
1423
+ text: escapeHtml,
1424
+ code: (body) => `<code>${escapeHtml(body)}</code>`,
1425
+ link: (label, url) => {
1426
+ const href = safeHref(url);
1427
+ return href ? `<a href="${escapeHtml(href)}">${label}</a>` : label;
1428
+ },
1429
+ strong: (t) => `<strong>${t}</strong>`,
1430
+ em: (t) => `<em>${t}</em>`
1431
+ });
1432
+ }
1389
1433
  const ItemContainer = dt.div`
1390
1434
  margin-bottom: ${(props) => props.theme?.spacing?.item || "var(--resume-space-item, 1rem)"};
1391
1435
 
@@ -1429,6 +1473,7 @@ const Highlights = dt.ul`
1429
1473
  line-height: 1.5;
1430
1474
  }
1431
1475
  `;
1476
+ const prose$1 = (value) => typeof value === "string" ? { dangerouslySetInnerHTML: { __html: renderInlineMarkdown(value) } } : { children: value };
1432
1477
  function ListItem({
1433
1478
  title,
1434
1479
  subtitle,
@@ -1454,8 +1499,8 @@ function ListItem({
1454
1499
  dateRange && location && /* @__PURE__ */ jsx("span", { children: "•" }),
1455
1500
  location && /* @__PURE__ */ jsx("span", { className: "resume-location", children: location })
1456
1501
  ] }),
1457
- description && /* @__PURE__ */ jsx(Description, { className: "resume-description", children: description }),
1458
- highlights.length > 0 && /* @__PURE__ */ jsx(Highlights, { className: "resume-highlights", children: highlights.map((highlight, index2) => /* @__PURE__ */ jsx("li", { children: highlight }, index2)) })
1502
+ description && /* @__PURE__ */ jsx(Description, { className: "resume-description", ...prose$1(description) }),
1503
+ highlights.length > 0 && /* @__PURE__ */ jsx(Highlights, { className: "resume-highlights", children: highlights.map((highlight, index2) => /* @__PURE__ */ jsx("li", { ...prose$1(highlight) }, index2)) })
1459
1504
  ]
1460
1505
  }
1461
1506
  );
@@ -1732,6 +1777,15 @@ dt.span`
1732
1777
  }
1733
1778
  }
1734
1779
  `;
1780
+ function InlineMarkdown({ text, as: Tag = "span", ...rest }) {
1781
+ return /* @__PURE__ */ jsx(
1782
+ Tag,
1783
+ {
1784
+ ...rest,
1785
+ dangerouslySetInnerHTML: { __html: renderInlineMarkdown(text) }
1786
+ }
1787
+ );
1788
+ }
1735
1789
  dt.hr`
1736
1790
  border: none;
1737
1791
  border-top: 0.5pt solid
@@ -6043,6 +6097,8 @@ dt.span`
6043
6097
  print-color-adjust: exact;
6044
6098
  }
6045
6099
  `;
6100
+ const prose = (text) => text && /* @__PURE__ */ jsx(InlineMarkdown, { text });
6101
+ const proseList = (items) => items?.map((text, index2) => /* @__PURE__ */ jsx(InlineMarkdown, { text }, index2));
6046
6102
  const Layout = dt.div`
6047
6103
  max-width: var(--resume-max-width, 660px);
6048
6104
  margin: 0 auto;
@@ -6151,7 +6207,7 @@ function Resume({ resume }) {
6151
6207
  );
6152
6208
  })
6153
6209
  ] }),
6154
- basics.summary && /* @__PURE__ */ jsx(Summary, { children: basics.summary })
6210
+ basics.summary && /* @__PURE__ */ jsx(InlineMarkdown, { as: Summary, text: basics.summary })
6155
6211
  ] }),
6156
6212
  work.length > 0 && /* @__PURE__ */ jsxs(Section, { id: "work", children: [
6157
6213
  /* @__PURE__ */ jsx(SectionTitle, { children: "Work Experience" }),
@@ -6162,8 +6218,8 @@ function Resume({ resume }) {
6162
6218
  subtitle: job.name,
6163
6219
  dateRange: job.startDate ? /* @__PURE__ */ jsx(DateRange, { startDate: job.startDate, endDate: job.endDate }) : null,
6164
6220
  location: job.location,
6165
- description: job.summary,
6166
- highlights: job.highlights
6221
+ description: prose(job.summary),
6222
+ highlights: proseList(job.highlights)
6167
6223
  },
6168
6224
  index2
6169
6225
  ))
@@ -6218,7 +6274,7 @@ function Resume({ resume }) {
6218
6274
  }
6219
6275
  ) : null,
6220
6276
  description: /* @__PURE__ */ jsxs(Fragment, { children: [
6221
- project.description,
6277
+ prose(project.description),
6222
6278
  project.url && safeUrl(project.url) && /* @__PURE__ */ jsxs(Fragment, { children: [
6223
6279
  /* @__PURE__ */ jsx("br", {}),
6224
6280
  /* @__PURE__ */ jsx(
@@ -6236,7 +6292,7 @@ function Resume({ resume }) {
6236
6292
  /* @__PURE__ */ jsx(BadgeList, { items: project.keywords, variant: "accent" })
6237
6293
  ] })
6238
6294
  ] }),
6239
- highlights: project.highlights
6295
+ highlights: proseList(project.highlights)
6240
6296
  },
6241
6297
  index2
6242
6298
  ))
@@ -6249,8 +6305,8 @@ function Resume({ resume }) {
6249
6305
  title: vol.position,
6250
6306
  subtitle: vol.organization,
6251
6307
  dateRange: vol.startDate ? /* @__PURE__ */ jsx(DateRange, { startDate: vol.startDate, endDate: vol.endDate }) : null,
6252
- description: vol.summary,
6253
- highlights: vol.highlights
6308
+ description: prose(vol.summary),
6309
+ highlights: proseList(vol.highlights)
6254
6310
  },
6255
6311
  index2
6256
6312
  ))
@@ -6263,7 +6319,7 @@ function Resume({ resume }) {
6263
6319
  title: award.title,
6264
6320
  subtitle: award.awarder,
6265
6321
  dateRange: award.date,
6266
- description: award.summary
6322
+ description: prose(award.summary)
6267
6323
  },
6268
6324
  index2
6269
6325
  ))
@@ -6277,7 +6333,7 @@ function Resume({ resume }) {
6277
6333
  subtitle: pub.publisher,
6278
6334
  dateRange: pub.releaseDate,
6279
6335
  description: /* @__PURE__ */ jsxs(Fragment, { children: [
6280
- pub.summary,
6336
+ prose(pub.summary),
6281
6337
  pub.url && safeUrl(pub.url) && /* @__PURE__ */ jsxs(Fragment, { children: [
6282
6338
  /* @__PURE__ */ jsx("br", {}),
6283
6339
  /* @__PURE__ */ jsx(
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "jsonresume-theme-reference",
3
- "version": "0.2.12",
3
+ "version": "0.2.14",
4
4
  "description": "Reference theme demonstrating @resume/core best practices - ATS-friendly, framework-agnostic",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -26,7 +26,7 @@
26
26
  "react": "^19.2.0",
27
27
  "react-dom": "^19.2.0",
28
28
  "styled-components": "^6.1.19",
29
- "@jsonresume/core": "0.4.0"
29
+ "@jsonresume/core": "0.4.1"
30
30
  },
31
31
  "devDependencies": {
32
32
  "vitest": "^3.2.6",
package/src/Resume.jsx CHANGED
@@ -7,8 +7,14 @@ import {
7
7
  BadgeList,
8
8
  safeUrl,
9
9
  getLinkRel,
10
+ InlineMarkdown,
10
11
  } from '@jsonresume/core';
11
12
 
13
+ /** Resume prose with its inline Markdown rendered (#600). */
14
+ const prose = (text) => text && <InlineMarkdown text={text} />;
15
+ const proseList = (items) =>
16
+ items?.map((text, index) => <InlineMarkdown key={index} text={text} />);
17
+
12
18
  /**
13
19
  * Resume Component
14
20
  * THE PERFECT SHOWCASE of @jsonresume/core and resume design best practices
@@ -152,7 +158,9 @@ function Resume({ resume }) {
152
158
  })}
153
159
  </Contact>
154
160
 
155
- {basics.summary && <Summary>{basics.summary}</Summary>}
161
+ {basics.summary && (
162
+ <InlineMarkdown as={Summary} text={basics.summary} />
163
+ )}
156
164
  </Header>
157
165
  )}
158
166
 
@@ -171,8 +179,8 @@ function Resume({ resume }) {
171
179
  ) : null
172
180
  }
173
181
  location={job.location}
174
- description={job.summary}
175
- highlights={job.highlights}
182
+ description={prose(job.summary)}
183
+ highlights={proseList(job.highlights)}
176
184
  />
177
185
  ))}
178
186
  </Section>
@@ -242,7 +250,7 @@ function Resume({ resume }) {
242
250
  }
243
251
  description={
244
252
  <>
245
- {project.description}
253
+ {prose(project.description)}
246
254
  {project.url && safeUrl(project.url) && (
247
255
  <>
248
256
  <br />
@@ -263,7 +271,7 @@ function Resume({ resume }) {
263
271
  )}
264
272
  </>
265
273
  }
266
- highlights={project.highlights}
274
+ highlights={proseList(project.highlights)}
267
275
  />
268
276
  ))}
269
277
  </Section>
@@ -283,8 +291,8 @@ function Resume({ resume }) {
283
291
  <DateRange startDate={vol.startDate} endDate={vol.endDate} />
284
292
  ) : null
285
293
  }
286
- description={vol.summary}
287
- highlights={vol.highlights}
294
+ description={prose(vol.summary)}
295
+ highlights={proseList(vol.highlights)}
288
296
  />
289
297
  ))}
290
298
  </Section>
@@ -300,7 +308,7 @@ function Resume({ resume }) {
300
308
  title={award.title}
301
309
  subtitle={award.awarder}
302
310
  dateRange={award.date}
303
- description={award.summary}
311
+ description={prose(award.summary)}
304
312
  />
305
313
  ))}
306
314
  </Section>
@@ -318,7 +326,7 @@ function Resume({ resume }) {
318
326
  dateRange={pub.releaseDate}
319
327
  description={
320
328
  <>
321
- {pub.summary}
329
+ {prose(pub.summary)}
322
330
  {pub.url && safeUrl(pub.url) && (
323
331
  <>
324
332
  <br />