jsonresume-theme-modern-classic 1.1.12 → 1.1.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-modern-classic
2
2
 
3
+ ## 1.1.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
  ## 1.1.12
4
10
 
5
11
  ### Patch Changes
package/dist/index.js CHANGED
@@ -1783,6 +1783,59 @@ dt.span`
1783
1783
  }
1784
1784
  }
1785
1785
  `;
1786
+ const ESCAPES = {
1787
+ "&": "&",
1788
+ "<": "&lt;",
1789
+ ">": "&gt;",
1790
+ '"': "&quot;",
1791
+ "'": "&#39;"
1792
+ };
1793
+ const escapeHtml = (text) => text.replace(/[&<>"']/g, (c) => ESCAPES[c]);
1794
+ const ESCAPABLE = /\\([\\`*_[\]()!#])/g;
1795
+ const CODE = /`([^`]+)`/g;
1796
+ const LINK = /\[([^\]]+)\]\(([^)\s]+)\)/g;
1797
+ const STRONG = /\*\*(?=\S)([^*]*?\S)\*\*|__(?=\S)([^_]*?\S)__/g;
1798
+ const EMPHASIS = /\*(?=\S)([^*]*?\S)\*|(^|[^\p{L}\p{N}_])_(?=\S)([^_]*?\S)_(?![\p{L}\p{N}_])/gu;
1799
+ const safeHref = (url) => /^(https?:\/\/|mailto:)/i.test(url) ? url : void 0;
1800
+ const emphasis = (text, strong, em) => text.replace(STRONG, (_2, a, b2) => strong(a ?? b2)).replace(
1801
+ EMPHASIS,
1802
+ (_2, a, before, b2) => a !== void 0 ? em(a) : `${before}${em(b2)}`
1803
+ );
1804
+ const inline = (text, out) => {
1805
+ const kept = [];
1806
+ const keep = (value) => `${kept.push(value) - 1}`;
1807
+ const marks = (t) => emphasis(t, out.strong, out.em);
1808
+ const rest = text.replace(/\uE000/g, "").replace(ESCAPABLE, (_2, c) => keep(out.text(c))).replace(CODE, (_2, body) => keep(out.code(body))).replace(
1809
+ LINK,
1810
+ (_2, label, url) => keep(out.link(marks(out.text(label)), url))
1811
+ );
1812
+ return marks(out.text(rest)).replace(
1813
+ /\uE000(\d+)\uE000/g,
1814
+ (_2, i) => kept[Number(i)]
1815
+ );
1816
+ };
1817
+ function renderInlineMarkdown(text) {
1818
+ if (typeof text !== "string") return "";
1819
+ return inline(text, {
1820
+ text: escapeHtml,
1821
+ code: (body) => `<code>${escapeHtml(body)}</code>`,
1822
+ link: (label, url) => {
1823
+ const href = safeHref(url);
1824
+ return href ? `<a href="${escapeHtml(href)}">${label}</a>` : label;
1825
+ },
1826
+ strong: (t) => `<strong>${t}</strong>`,
1827
+ em: (t) => `<em>${t}</em>`
1828
+ });
1829
+ }
1830
+ function InlineMarkdown({ text, as: Tag = "span", ...rest }) {
1831
+ return /* @__PURE__ */ jsx(
1832
+ Tag,
1833
+ {
1834
+ ...rest,
1835
+ dangerouslySetInnerHTML: { __html: renderInlineMarkdown(text) }
1836
+ }
1837
+ );
1838
+ }
1786
1839
  dt.hr`
1787
1840
  border: none;
1788
1841
  border-top: 0.5pt solid
@@ -6266,7 +6319,7 @@ function Resume({ resume }) {
6266
6319
  /* @__PURE__ */ jsx(Name, { children: basics.name }),
6267
6320
  basics.label && /* @__PURE__ */ jsx(Label, { children: basics.label }),
6268
6321
  /* @__PURE__ */ jsx(StyledContactInfo, { basics }),
6269
- basics.summary && /* @__PURE__ */ jsx(Summary, { children: basics.summary })
6322
+ basics.summary && /* @__PURE__ */ jsx(InlineMarkdown, { as: Summary, text: basics.summary })
6270
6323
  ] }),
6271
6324
  work?.length > 0 && /* @__PURE__ */ jsxs(Section, { children: [
6272
6325
  /* @__PURE__ */ jsx(StyledSectionTitle, { children: "Experience" }),
@@ -6278,8 +6331,8 @@ function Resume({ resume }) {
6278
6331
  ] }),
6279
6332
  /* @__PURE__ */ jsx(DateText, { children: /* @__PURE__ */ jsx(DateRange, { startDate: job.startDate, endDate: job.endDate }) })
6280
6333
  ] }),
6281
- job.summary && /* @__PURE__ */ jsx(WorkSummary, { children: job.summary }),
6282
- job.highlights?.length > 0 && /* @__PURE__ */ jsx(Highlights, { children: job.highlights.map((highlight, i) => /* @__PURE__ */ jsx("li", { children: highlight }, i)) })
6334
+ job.summary && /* @__PURE__ */ jsx(InlineMarkdown, { as: WorkSummary, text: job.summary }),
6335
+ job.highlights?.length > 0 && /* @__PURE__ */ jsx(Highlights, { children: job.highlights.map((highlight, i) => /* @__PURE__ */ jsx(InlineMarkdown, { as: "li", text: highlight }, i)) })
6283
6336
  ] }, index))
6284
6337
  ] }),
6285
6338
  skills?.length > 0 && /* @__PURE__ */ jsxs(Section, { children: [
@@ -6306,8 +6359,8 @@ function Resume({ resume }) {
6306
6359
  /* @__PURE__ */ jsx(StyledSectionTitle, { children: "Projects" }),
6307
6360
  projects.map((project, index) => /* @__PURE__ */ jsxs(WorkItem, { children: [
6308
6361
  /* @__PURE__ */ jsx(Position, { children: project.name }),
6309
- project.description && /* @__PURE__ */ jsx(WorkSummary, { children: project.description }),
6310
- project.highlights?.length > 0 && /* @__PURE__ */ jsx(Highlights, { children: project.highlights.map((highlight, i) => /* @__PURE__ */ jsx("li", { children: highlight }, i)) })
6362
+ project.description && /* @__PURE__ */ jsx(InlineMarkdown, { as: WorkSummary, text: project.description }),
6363
+ project.highlights?.length > 0 && /* @__PURE__ */ jsx(Highlights, { children: project.highlights.map((highlight, i) => /* @__PURE__ */ jsx(InlineMarkdown, { as: "li", text: highlight }, i)) })
6311
6364
  ] }, index))
6312
6365
  ] }),
6313
6366
  volunteer?.length > 0 && /* @__PURE__ */ jsxs(Section, { children: [
@@ -6326,8 +6379,8 @@ function Resume({ resume }) {
6326
6379
  }
6327
6380
  ) })
6328
6381
  ] }),
6329
- vol.summary && /* @__PURE__ */ jsx(WorkSummary, { children: vol.summary }),
6330
- vol.highlights?.length > 0 && /* @__PURE__ */ jsx(Highlights, { children: vol.highlights.map((highlight, i) => /* @__PURE__ */ jsx("li", { children: highlight }, i)) })
6382
+ vol.summary && /* @__PURE__ */ jsx(InlineMarkdown, { as: WorkSummary, text: vol.summary }),
6383
+ vol.highlights?.length > 0 && /* @__PURE__ */ jsx(Highlights, { children: vol.highlights.map((highlight, i) => /* @__PURE__ */ jsx(InlineMarkdown, { as: "li", text: highlight }, i)) })
6331
6384
  ] }, index))
6332
6385
  ] }),
6333
6386
  awards?.length > 0 && /* @__PURE__ */ jsxs(Section, { children: [
@@ -6339,7 +6392,7 @@ function Resume({ resume }) {
6339
6392
  award.awarder
6340
6393
  ] }),
6341
6394
  award.date && /* @__PURE__ */ jsx(EducationDate, { children: award.date }),
6342
- award.summary && /* @__PURE__ */ jsx(WorkSummary, { children: award.summary })
6395
+ award.summary && /* @__PURE__ */ jsx(InlineMarkdown, { as: WorkSummary, text: award.summary })
6343
6396
  ] }, index))
6344
6397
  ] }),
6345
6398
  publications?.length > 0 && /* @__PURE__ */ jsxs(Section, { children: [
@@ -6351,7 +6404,7 @@ function Resume({ resume }) {
6351
6404
  pub.publisher
6352
6405
  ] }),
6353
6406
  pub.releaseDate && /* @__PURE__ */ jsx(EducationDate, { children: pub.releaseDate }),
6354
- pub.summary && /* @__PURE__ */ jsx(WorkSummary, { children: pub.summary })
6407
+ pub.summary && /* @__PURE__ */ jsx(InlineMarkdown, { as: WorkSummary, text: pub.summary })
6355
6408
  ] }, index))
6356
6409
  ] }),
6357
6410
  certificates?.length > 0 && /* @__PURE__ */ jsxs(Section, { children: [
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "jsonresume-theme-modern-classic",
3
- "version": "1.1.12",
3
+ "version": "1.1.13",
4
4
  "description": "A universal, default style for engineers and professionals",
5
5
  "main": "./dist/index.js",
6
6
  "type": "module",
package/src/Resume.jsx CHANGED
@@ -5,6 +5,7 @@ import {
5
5
  SectionTitle,
6
6
  DateRange,
7
7
  ContactInfo,
8
+ InlineMarkdown,
8
9
  } from '@jsonresume/core';
9
10
 
10
11
  const Layout = styled.div`
@@ -203,7 +204,9 @@ function Resume({ resume }) {
203
204
  <Name>{basics.name}</Name>
204
205
  {basics.label && <Label>{basics.label}</Label>}
205
206
  <StyledContactInfo basics={basics} />
206
- {basics.summary && <Summary>{basics.summary}</Summary>}
207
+ {basics.summary && (
208
+ <InlineMarkdown as={Summary} text={basics.summary} />
209
+ )}
207
210
  </Header>
208
211
 
209
212
  {work?.length > 0 && (
@@ -220,11 +223,13 @@ function Resume({ resume }) {
220
223
  <DateRange startDate={job.startDate} endDate={job.endDate} />
221
224
  </DateText>
222
225
  </WorkHeader>
223
- {job.summary && <WorkSummary>{job.summary}</WorkSummary>}
226
+ {job.summary && (
227
+ <InlineMarkdown as={WorkSummary} text={job.summary} />
228
+ )}
224
229
  {job.highlights?.length > 0 && (
225
230
  <Highlights>
226
231
  {job.highlights.map((highlight, i) => (
227
- <li key={i}>{highlight}</li>
232
+ <InlineMarkdown as="li" key={i} text={highlight} />
228
233
  ))}
229
234
  </Highlights>
230
235
  )}
@@ -274,12 +279,12 @@ function Resume({ resume }) {
274
279
  <WorkItem key={index}>
275
280
  <Position>{project.name}</Position>
276
281
  {project.description && (
277
- <WorkSummary>{project.description}</WorkSummary>
282
+ <InlineMarkdown as={WorkSummary} text={project.description} />
278
283
  )}
279
284
  {project.highlights?.length > 0 && (
280
285
  <Highlights>
281
286
  {project.highlights.map((highlight, i) => (
282
- <li key={i}>{highlight}</li>
287
+ <InlineMarkdown as="li" key={i} text={highlight} />
283
288
  ))}
284
289
  </Highlights>
285
290
  )}
@@ -307,11 +312,13 @@ function Resume({ resume }) {
307
312
  </DateText>
308
313
  )}
309
314
  </WorkHeader>
310
- {vol.summary && <WorkSummary>{vol.summary}</WorkSummary>}
315
+ {vol.summary && (
316
+ <InlineMarkdown as={WorkSummary} text={vol.summary} />
317
+ )}
311
318
  {vol.highlights?.length > 0 && (
312
319
  <Highlights>
313
320
  {vol.highlights.map((highlight, i) => (
314
- <li key={i}>{highlight}</li>
321
+ <InlineMarkdown as="li" key={i} text={highlight} />
315
322
  ))}
316
323
  </Highlights>
317
324
  )}
@@ -328,7 +335,9 @@ function Resume({ resume }) {
328
335
  <Institution>{award.title}</Institution>
329
336
  {award.awarder && <Degree>Awarded by {award.awarder}</Degree>}
330
337
  {award.date && <EducationDate>{award.date}</EducationDate>}
331
- {award.summary && <WorkSummary>{award.summary}</WorkSummary>}
338
+ {award.summary && (
339
+ <InlineMarkdown as={WorkSummary} text={award.summary} />
340
+ )}
332
341
  </EducationItem>
333
342
  ))}
334
343
  </Section>
@@ -344,7 +353,9 @@ function Resume({ resume }) {
344
353
  {pub.releaseDate && (
345
354
  <EducationDate>{pub.releaseDate}</EducationDate>
346
355
  )}
347
- {pub.summary && <WorkSummary>{pub.summary}</WorkSummary>}
356
+ {pub.summary && (
357
+ <InlineMarkdown as={WorkSummary} text={pub.summary} />
358
+ )}
348
359
  </EducationItem>
349
360
  ))}
350
361
  </Section>