jsonresume-theme-academic-cv-lite 0.2.12 → 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,11 @@
1
1
  # jsonresume-theme-academic-cv-lite
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
+
3
9
  ## 0.2.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
@@ -6314,7 +6367,7 @@ function Resume({ resume }) {
6314
6367
  /* @__PURE__ */ jsx(Name, { children: basics.name }),
6315
6368
  basics.label && /* @__PURE__ */ jsx(Label, { children: basics.label }),
6316
6369
  /* @__PURE__ */ jsx(StyledContactInfo, { basics }),
6317
- basics.summary && /* @__PURE__ */ jsx(Summary, { children: basics.summary })
6370
+ basics.summary && /* @__PURE__ */ jsx(InlineMarkdown, { as: Summary, text: basics.summary })
6318
6371
  ] }),
6319
6372
  education?.length > 0 && /* @__PURE__ */ jsxs(Section, { children: [
6320
6373
  /* @__PURE__ */ jsx(StyledSectionTitle, { children: "Education" }),
@@ -6345,7 +6398,7 @@ function Resume({ resume }) {
6345
6398
  pub.releaseDate,
6346
6399
  ")"
6347
6400
  ] }),
6348
- pub.summary && /* @__PURE__ */ jsx(WorkSummary, { children: pub.summary })
6401
+ pub.summary && /* @__PURE__ */ jsx(InlineMarkdown, { as: WorkSummary, text: pub.summary })
6349
6402
  ] }, index))
6350
6403
  ] }),
6351
6404
  certificates?.length > 0 && /* @__PURE__ */ jsxs(Section, { children: [
@@ -6362,7 +6415,7 @@ function Resume({ resume }) {
6362
6415
  /* @__PURE__ */ jsx(AwardTitle, { children: award.title }),
6363
6416
  award.awarder && /* @__PURE__ */ jsx(AwardAwarder, { children: award.awarder }),
6364
6417
  award.date && /* @__PURE__ */ jsx(AwardDate, { children: award.date }),
6365
- award.summary && /* @__PURE__ */ jsx(AwardSummary, { children: award.summary })
6418
+ award.summary && /* @__PURE__ */ jsx(InlineMarkdown, { as: AwardSummary, text: award.summary })
6366
6419
  ] }, index))
6367
6420
  ] }),
6368
6421
  work?.length > 0 && /* @__PURE__ */ jsxs(Section, { children: [
@@ -6373,16 +6426,16 @@ function Resume({ resume }) {
6373
6426
  job.name && /* @__PURE__ */ jsx(Company, { children: job.name }),
6374
6427
  /* @__PURE__ */ jsx(DateText, { children: /* @__PURE__ */ jsx(DateRange, { startDate: job.startDate, endDate: job.endDate }) })
6375
6428
  ] }),
6376
- job.summary && /* @__PURE__ */ jsx(WorkSummary, { children: job.summary }),
6377
- job.highlights?.length > 0 && /* @__PURE__ */ jsx(Highlights, { children: job.highlights.map((highlight, i) => /* @__PURE__ */ jsx("li", { children: highlight }, i)) })
6429
+ job.summary && /* @__PURE__ */ jsx(InlineMarkdown, { as: WorkSummary, text: job.summary }),
6430
+ job.highlights?.length > 0 && /* @__PURE__ */ jsx(Highlights, { children: job.highlights.map((highlight, i) => /* @__PURE__ */ jsx(InlineMarkdown, { as: "li", text: highlight }, i)) })
6378
6431
  ] }, index))
6379
6432
  ] }),
6380
6433
  projects?.length > 0 && /* @__PURE__ */ jsxs(Section, { children: [
6381
6434
  /* @__PURE__ */ jsx(StyledSectionTitle, { children: "Research Projects" }),
6382
6435
  projects.map((project, index) => /* @__PURE__ */ jsxs(WorkItem, { children: [
6383
6436
  /* @__PURE__ */ jsx(Position, { children: project.name }),
6384
- project.description && /* @__PURE__ */ jsx(WorkSummary, { children: project.description }),
6385
- project.highlights?.length > 0 && /* @__PURE__ */ jsx(Highlights, { children: project.highlights.map((highlight, i) => /* @__PURE__ */ jsx("li", { children: highlight }, i)) })
6437
+ project.description && /* @__PURE__ */ jsx(InlineMarkdown, { as: WorkSummary, text: project.description }),
6438
+ project.highlights?.length > 0 && /* @__PURE__ */ jsx(Highlights, { children: project.highlights.map((highlight, i) => /* @__PURE__ */ jsx(InlineMarkdown, { as: "li", text: highlight }, i)) })
6386
6439
  ] }, index))
6387
6440
  ] }),
6388
6441
  skills?.length > 0 && /* @__PURE__ */ jsxs(Section, { children: [
@@ -6409,8 +6462,8 @@ function Resume({ resume }) {
6409
6462
  }
6410
6463
  ) })
6411
6464
  ] }),
6412
- vol.summary && /* @__PURE__ */ jsx(WorkSummary, { children: vol.summary }),
6413
- vol.highlights?.length > 0 && /* @__PURE__ */ jsx(Highlights, { children: vol.highlights.map((highlight, i) => /* @__PURE__ */ jsx("li", { children: highlight }, i)) })
6465
+ vol.summary && /* @__PURE__ */ jsx(InlineMarkdown, { as: WorkSummary, text: vol.summary }),
6466
+ vol.highlights?.length > 0 && /* @__PURE__ */ jsx(Highlights, { children: vol.highlights.map((highlight, i) => /* @__PURE__ */ jsx(InlineMarkdown, { as: "li", text: highlight }, i)) })
6414
6467
  ] }, index))
6415
6468
  ] }),
6416
6469
  languages?.length > 0 && /* @__PURE__ */ jsxs(Section, { children: [
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "jsonresume-theme-academic-cv-lite",
3
- "version": "0.2.12",
3
+ "version": "0.2.13",
4
4
  "description": "Academic professionals - publications matter most. Scholarly, formal, elegant simplicity.",
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`
@@ -260,7 +261,9 @@ function Resume({ resume }) {
260
261
  <Name>{basics.name}</Name>
261
262
  {basics.label && <Label>{basics.label}</Label>}
262
263
  <StyledContactInfo basics={basics} />
263
- {basics.summary && <Summary>{basics.summary}</Summary>}
264
+ {basics.summary && (
265
+ <InlineMarkdown as={Summary} text={basics.summary} />
266
+ )}
264
267
  </Header>
265
268
 
266
269
  {education?.length > 0 && (
@@ -293,7 +296,9 @@ function Resume({ resume }) {
293
296
  {pub.releaseDate && (
294
297
  <PublicationDate>({pub.releaseDate})</PublicationDate>
295
298
  )}
296
- {pub.summary && <WorkSummary>{pub.summary}</WorkSummary>}
299
+ {pub.summary && (
300
+ <InlineMarkdown as={WorkSummary} text={pub.summary} />
301
+ )}
297
302
  </PublicationItem>
298
303
  ))}
299
304
  </Section>
@@ -320,7 +325,9 @@ function Resume({ resume }) {
320
325
  <AwardTitle>{award.title}</AwardTitle>
321
326
  {award.awarder && <AwardAwarder>{award.awarder}</AwardAwarder>}
322
327
  {award.date && <AwardDate>{award.date}</AwardDate>}
323
- {award.summary && <AwardSummary>{award.summary}</AwardSummary>}
328
+ {award.summary && (
329
+ <InlineMarkdown as={AwardSummary} text={award.summary} />
330
+ )}
324
331
  </AwardItem>
325
332
  ))}
326
333
  </Section>
@@ -338,11 +345,13 @@ function Resume({ resume }) {
338
345
  <DateRange startDate={job.startDate} endDate={job.endDate} />
339
346
  </DateText>
340
347
  </WorkHeader>
341
- {job.summary && <WorkSummary>{job.summary}</WorkSummary>}
348
+ {job.summary && (
349
+ <InlineMarkdown as={WorkSummary} text={job.summary} />
350
+ )}
342
351
  {job.highlights?.length > 0 && (
343
352
  <Highlights>
344
353
  {job.highlights.map((highlight, i) => (
345
- <li key={i}>{highlight}</li>
354
+ <InlineMarkdown as="li" key={i} text={highlight} />
346
355
  ))}
347
356
  </Highlights>
348
357
  )}
@@ -358,12 +367,12 @@ function Resume({ resume }) {
358
367
  <WorkItem key={index}>
359
368
  <Position>{project.name}</Position>
360
369
  {project.description && (
361
- <WorkSummary>{project.description}</WorkSummary>
370
+ <InlineMarkdown as={WorkSummary} text={project.description} />
362
371
  )}
363
372
  {project.highlights?.length > 0 && (
364
373
  <Highlights>
365
374
  {project.highlights.map((highlight, i) => (
366
- <li key={i}>{highlight}</li>
375
+ <InlineMarkdown as="li" key={i} text={highlight} />
367
376
  ))}
368
377
  </Highlights>
369
378
  )}
@@ -405,11 +414,13 @@ function Resume({ resume }) {
405
414
  </DateText>
406
415
  )}
407
416
  </WorkHeader>
408
- {vol.summary && <WorkSummary>{vol.summary}</WorkSummary>}
417
+ {vol.summary && (
418
+ <InlineMarkdown as={WorkSummary} text={vol.summary} />
419
+ )}
409
420
  {vol.highlights?.length > 0 && (
410
421
  <Highlights>
411
422
  {vol.highlights.map((highlight, i) => (
412
- <li key={i}>{highlight}</li>
423
+ <InlineMarkdown as="li" key={i} text={highlight} />
413
424
  ))}
414
425
  </Highlights>
415
426
  )}