jsonresume-theme-desert-modern 0.1.13 → 0.1.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,11 @@
1
1
  # jsonresume-theme-desert-modern
2
2
 
3
+ ## 0.1.14
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.1.13
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
@@ -6336,7 +6389,7 @@ function Resume({ resume }) {
6336
6389
  basics.name && /* @__PURE__ */ jsx(Name, { children: basics.name }),
6337
6390
  basics.label && /* @__PURE__ */ jsx(Label, { children: basics.label }),
6338
6391
  /* @__PURE__ */ jsx(StyledContactInfo, { basics }),
6339
- basics.summary && /* @__PURE__ */ jsx(Summary, { children: basics.summary })
6392
+ basics.summary && /* @__PURE__ */ jsx(InlineMarkdown, { as: Summary, text: basics.summary })
6340
6393
  ] }),
6341
6394
  work?.length > 0 && /* @__PURE__ */ jsxs(SectionBlock, { children: [
6342
6395
  /* @__PURE__ */ jsx(SectionHeading, { children: "Experience" }),
@@ -6354,7 +6407,7 @@ function Resume({ resume }) {
6354
6407
  }
6355
6408
  ) })
6356
6409
  ] }),
6357
- job.summary && /* @__PURE__ */ jsx(EntrySummary, { children: job.summary }),
6410
+ job.summary && /* @__PURE__ */ jsx(InlineMarkdown, { as: EntrySummary, text: job.summary }),
6358
6411
  renderHighlights(job.highlights)
6359
6412
  ] }, index))
6360
6413
  ] }),
@@ -6381,7 +6434,7 @@ function Resume({ resume }) {
6381
6434
  }
6382
6435
  ) })
6383
6436
  ] }),
6384
- summary && /* @__PURE__ */ jsx(EntrySummary, { children: summary }),
6437
+ summary && /* @__PURE__ */ jsx(InlineMarkdown, { as: EntrySummary, text: summary }),
6385
6438
  renderHighlights(project.highlights),
6386
6439
  project.keywords?.length > 0 && /* @__PURE__ */ jsx(KeywordList, { children: project.keywords.join(" • ") })
6387
6440
  ] }, index);
@@ -6438,7 +6491,7 @@ function Resume({ resume }) {
6438
6491
  }
6439
6492
  ) })
6440
6493
  ] }),
6441
- item.summary && /* @__PURE__ */ jsx(EntrySummary, { children: item.summary }),
6494
+ item.summary && /* @__PURE__ */ jsx(InlineMarkdown, { as: EntrySummary, text: item.summary }),
6442
6495
  renderHighlights(item.highlights)
6443
6496
  ] }, index))
6444
6497
  ] }),
@@ -6455,7 +6508,7 @@ function Resume({ resume }) {
6455
6508
  ] }),
6456
6509
  award.date && /* @__PURE__ */ jsx(EntryMeta, { children: award.date })
6457
6510
  ] }),
6458
- award.summary && /* @__PURE__ */ jsx(EntrySummary, { children: award.summary })
6511
+ award.summary && /* @__PURE__ */ jsx(InlineMarkdown, { as: EntrySummary, text: award.summary })
6459
6512
  ] }, index))
6460
6513
  ] }),
6461
6514
  certificates?.length > 0 && /* @__PURE__ */ jsxs(SectionBlock, { children: [
@@ -6471,7 +6524,7 @@ function Resume({ resume }) {
6471
6524
  ] }),
6472
6525
  cert.date && /* @__PURE__ */ jsx(EntryMeta, { children: cert.date })
6473
6526
  ] }),
6474
- cert.summary && /* @__PURE__ */ jsx(EntrySummary, { children: cert.summary }),
6527
+ cert.summary && /* @__PURE__ */ jsx(InlineMarkdown, { as: EntrySummary, text: cert.summary }),
6475
6528
  cert.url && /* @__PURE__ */ jsx(KeywordList, { children: /* @__PURE__ */ jsx(Anchor, { href: cert.url, children: cert.url }) })
6476
6529
  ] }, index))
6477
6530
  ] }),
@@ -6489,7 +6542,7 @@ function Resume({ resume }) {
6489
6542
  ] }),
6490
6543
  pub.releaseDate && /* @__PURE__ */ jsx(EntryMeta, { children: pub.releaseDate })
6491
6544
  ] }),
6492
- pub.summary && /* @__PURE__ */ jsx(EntrySummary, { children: pub.summary })
6545
+ pub.summary && /* @__PURE__ */ jsx(InlineMarkdown, { as: EntrySummary, text: pub.summary })
6493
6546
  ] }, index))
6494
6547
  ] }),
6495
6548
  languages?.length > 0 && /* @__PURE__ */ jsxs(SectionBlock, { children: [
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "jsonresume-theme-desert-modern",
3
- "version": "0.1.13",
3
+ "version": "0.1.14",
4
4
  "description": "Warm minimalist resume theme inspired by desert modern aesthetics",
5
5
  "main": "./dist/index.js",
6
6
  "type": "module",
package/src/Resume.jsx CHANGED
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- import { DateRange } from '@jsonresume/core';
2
+ import { DateRange, InlineMarkdown } from '@jsonresume/core';
3
3
  import {
4
4
  Layout,
5
5
  Header,
@@ -57,7 +57,9 @@ function Resume({ resume }) {
57
57
  {basics.name && <Name>{basics.name}</Name>}
58
58
  {basics.label && <Label>{basics.label}</Label>}
59
59
  <StyledContactInfo basics={basics} />
60
- {basics.summary && <Summary>{basics.summary}</Summary>}
60
+ {basics.summary && (
61
+ <InlineMarkdown as={Summary} text={basics.summary} />
62
+ )}
61
63
  </Header>
62
64
 
63
65
  {work?.length > 0 && (
@@ -83,7 +85,9 @@ function Resume({ resume }) {
83
85
  </EntryMeta>
84
86
  )}
85
87
  </EntryHeader>
86
- {job.summary && <EntrySummary>{job.summary}</EntrySummary>}
88
+ {job.summary && (
89
+ <InlineMarkdown as={EntrySummary} text={job.summary} />
90
+ )}
87
91
  {renderHighlights(job.highlights)}
88
92
  </Entry>
89
93
  ))}
@@ -120,7 +124,7 @@ function Resume({ resume }) {
120
124
  </EntryMeta>
121
125
  )}
122
126
  </EntryHeader>
123
- {summary && <EntrySummary>{summary}</EntrySummary>}
127
+ {summary && <InlineMarkdown as={EntrySummary} text={summary} />}
124
128
  {renderHighlights(project.highlights)}
125
129
  {project.keywords?.length > 0 && (
126
130
  <KeywordList>{project.keywords.join(' • ')}</KeywordList>
@@ -209,7 +213,9 @@ function Resume({ resume }) {
209
213
  </EntryMeta>
210
214
  )}
211
215
  </EntryHeader>
212
- {item.summary && <EntrySummary>{item.summary}</EntrySummary>}
216
+ {item.summary && (
217
+ <InlineMarkdown as={EntrySummary} text={item.summary} />
218
+ )}
213
219
  {renderHighlights(item.highlights)}
214
220
  </Entry>
215
221
  ))}
@@ -230,7 +236,9 @@ function Resume({ resume }) {
230
236
  </div>
231
237
  {award.date && <EntryMeta>{award.date}</EntryMeta>}
232
238
  </EntryHeader>
233
- {award.summary && <EntrySummary>{award.summary}</EntrySummary>}
239
+ {award.summary && (
240
+ <InlineMarkdown as={EntrySummary} text={award.summary} />
241
+ )}
234
242
  </Entry>
235
243
  ))}
236
244
  </SectionBlock>
@@ -250,7 +258,9 @@ function Resume({ resume }) {
250
258
  </div>
251
259
  {cert.date && <EntryMeta>{cert.date}</EntryMeta>}
252
260
  </EntryHeader>
253
- {cert.summary && <EntrySummary>{cert.summary}</EntrySummary>}
261
+ {cert.summary && (
262
+ <InlineMarkdown as={EntrySummary} text={cert.summary} />
263
+ )}
254
264
  {cert.url && (
255
265
  <KeywordList>
256
266
  <Anchor href={cert.url}>{cert.url}</Anchor>
@@ -279,7 +289,9 @@ function Resume({ resume }) {
279
289
  </div>
280
290
  {pub.releaseDate && <EntryMeta>{pub.releaseDate}</EntryMeta>}
281
291
  </EntryHeader>
282
- {pub.summary && <EntrySummary>{pub.summary}</EntrySummary>}
292
+ {pub.summary && (
293
+ <InlineMarkdown as={EntrySummary} text={pub.summary} />
294
+ )}
283
295
  </Entry>
284
296
  ))}
285
297
  </SectionBlock>