jsonresume-theme-reference 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-reference
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
@@ -1732,6 +1732,59 @@ dt.span`
1732
1732
  }
1733
1733
  }
1734
1734
  `;
1735
+ const ESCAPES = {
1736
+ "&": "&",
1737
+ "<": "&lt;",
1738
+ ">": "&gt;",
1739
+ '"': "&quot;",
1740
+ "'": "&#39;"
1741
+ };
1742
+ const escapeHtml = (text) => text.replace(/[&<>"']/g, (c) => ESCAPES[c]);
1743
+ const ESCAPABLE = /\\([\\`*_[\]()!#])/g;
1744
+ const CODE = /`([^`]+)`/g;
1745
+ const LINK = /\[([^\]]+)\]\(([^)\s]+)\)/g;
1746
+ const STRONG = /\*\*(?=\S)([^*]*?\S)\*\*|__(?=\S)([^_]*?\S)__/g;
1747
+ const EMPHASIS = /\*(?=\S)([^*]*?\S)\*|(^|[^\p{L}\p{N}_])_(?=\S)([^_]*?\S)_(?![\p{L}\p{N}_])/gu;
1748
+ const safeHref = (url) => /^(https?:\/\/|mailto:)/i.test(url) ? url : void 0;
1749
+ const emphasis = (text, strong, em) => text.replace(STRONG, (_2, a, b2) => strong(a ?? b2)).replace(
1750
+ EMPHASIS,
1751
+ (_2, a, before, b2) => a !== void 0 ? em(a) : `${before}${em(b2)}`
1752
+ );
1753
+ const inline = (text, out) => {
1754
+ const kept = [];
1755
+ const keep = (value) => `${kept.push(value) - 1}`;
1756
+ const marks = (t) => emphasis(t, out.strong, out.em);
1757
+ const rest = text.replace(/\uE000/g, "").replace(ESCAPABLE, (_2, c) => keep(out.text(c))).replace(CODE, (_2, body) => keep(out.code(body))).replace(
1758
+ LINK,
1759
+ (_2, label, url) => keep(out.link(marks(out.text(label)), url))
1760
+ );
1761
+ return marks(out.text(rest)).replace(
1762
+ /\uE000(\d+)\uE000/g,
1763
+ (_2, i) => kept[Number(i)]
1764
+ );
1765
+ };
1766
+ function renderInlineMarkdown(text) {
1767
+ if (typeof text !== "string") return "";
1768
+ return inline(text, {
1769
+ text: escapeHtml,
1770
+ code: (body) => `<code>${escapeHtml(body)}</code>`,
1771
+ link: (label, url) => {
1772
+ const href = safeHref(url);
1773
+ return href ? `<a href="${escapeHtml(href)}">${label}</a>` : label;
1774
+ },
1775
+ strong: (t) => `<strong>${t}</strong>`,
1776
+ em: (t) => `<em>${t}</em>`
1777
+ });
1778
+ }
1779
+ function InlineMarkdown({ text, as: Tag = "span", ...rest }) {
1780
+ return /* @__PURE__ */ jsx(
1781
+ Tag,
1782
+ {
1783
+ ...rest,
1784
+ dangerouslySetInnerHTML: { __html: renderInlineMarkdown(text) }
1785
+ }
1786
+ );
1787
+ }
1735
1788
  dt.hr`
1736
1789
  border: none;
1737
1790
  border-top: 0.5pt solid
@@ -6043,6 +6096,8 @@ dt.span`
6043
6096
  print-color-adjust: exact;
6044
6097
  }
6045
6098
  `;
6099
+ const prose = (text) => text && /* @__PURE__ */ jsx(InlineMarkdown, { text });
6100
+ const proseList = (items) => items?.map((text, index2) => /* @__PURE__ */ jsx(InlineMarkdown, { text }, index2));
6046
6101
  const Layout = dt.div`
6047
6102
  max-width: var(--resume-max-width, 660px);
6048
6103
  margin: 0 auto;
@@ -6151,7 +6206,7 @@ function Resume({ resume }) {
6151
6206
  );
6152
6207
  })
6153
6208
  ] }),
6154
- basics.summary && /* @__PURE__ */ jsx(Summary, { children: basics.summary })
6209
+ basics.summary && /* @__PURE__ */ jsx(InlineMarkdown, { as: Summary, text: basics.summary })
6155
6210
  ] }),
6156
6211
  work.length > 0 && /* @__PURE__ */ jsxs(Section, { id: "work", children: [
6157
6212
  /* @__PURE__ */ jsx(SectionTitle, { children: "Work Experience" }),
@@ -6162,8 +6217,8 @@ function Resume({ resume }) {
6162
6217
  subtitle: job.name,
6163
6218
  dateRange: job.startDate ? /* @__PURE__ */ jsx(DateRange, { startDate: job.startDate, endDate: job.endDate }) : null,
6164
6219
  location: job.location,
6165
- description: job.summary,
6166
- highlights: job.highlights
6220
+ description: prose(job.summary),
6221
+ highlights: proseList(job.highlights)
6167
6222
  },
6168
6223
  index2
6169
6224
  ))
@@ -6218,7 +6273,7 @@ function Resume({ resume }) {
6218
6273
  }
6219
6274
  ) : null,
6220
6275
  description: /* @__PURE__ */ jsxs(Fragment, { children: [
6221
- project.description,
6276
+ prose(project.description),
6222
6277
  project.url && safeUrl(project.url) && /* @__PURE__ */ jsxs(Fragment, { children: [
6223
6278
  /* @__PURE__ */ jsx("br", {}),
6224
6279
  /* @__PURE__ */ jsx(
@@ -6236,7 +6291,7 @@ function Resume({ resume }) {
6236
6291
  /* @__PURE__ */ jsx(BadgeList, { items: project.keywords, variant: "accent" })
6237
6292
  ] })
6238
6293
  ] }),
6239
- highlights: project.highlights
6294
+ highlights: proseList(project.highlights)
6240
6295
  },
6241
6296
  index2
6242
6297
  ))
@@ -6249,8 +6304,8 @@ function Resume({ resume }) {
6249
6304
  title: vol.position,
6250
6305
  subtitle: vol.organization,
6251
6306
  dateRange: vol.startDate ? /* @__PURE__ */ jsx(DateRange, { startDate: vol.startDate, endDate: vol.endDate }) : null,
6252
- description: vol.summary,
6253
- highlights: vol.highlights
6307
+ description: prose(vol.summary),
6308
+ highlights: proseList(vol.highlights)
6254
6309
  },
6255
6310
  index2
6256
6311
  ))
@@ -6263,7 +6318,7 @@ function Resume({ resume }) {
6263
6318
  title: award.title,
6264
6319
  subtitle: award.awarder,
6265
6320
  dateRange: award.date,
6266
- description: award.summary
6321
+ description: prose(award.summary)
6267
6322
  },
6268
6323
  index2
6269
6324
  ))
@@ -6277,7 +6332,7 @@ function Resume({ resume }) {
6277
6332
  subtitle: pub.publisher,
6278
6333
  dateRange: pub.releaseDate,
6279
6334
  description: /* @__PURE__ */ jsxs(Fragment, { children: [
6280
- pub.summary,
6335
+ prose(pub.summary),
6281
6336
  pub.url && safeUrl(pub.url) && /* @__PURE__ */ jsxs(Fragment, { children: [
6282
6337
  /* @__PURE__ */ jsx("br", {}),
6283
6338
  /* @__PURE__ */ jsx(
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "jsonresume-theme-reference",
3
- "version": "0.2.11",
3
+ "version": "0.2.13",
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.3.8"
29
+ "@jsonresume/core": "0.4.0"
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 />