jsonresume-theme-marketing-narrative 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-marketing-narrative
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
@@ -6106,8 +6159,8 @@ function WorkSection({ work }) {
6106
6159
  /* @__PURE__ */ jsx(DateText, { children: /* @__PURE__ */ jsx(DateRange, { startDate: job.startDate, endDate: job.endDate }) })
6107
6160
  ] })
6108
6161
  ] }),
6109
- job.summary && /* @__PURE__ */ jsx(Narrative, { children: job.summary }),
6110
- job.highlights?.length > 0 && /* @__PURE__ */ jsx(Achievements, { children: job.highlights.map((highlight, i) => /* @__PURE__ */ jsx(AchievementItem, { children: highlight }, i)) })
6162
+ job.summary && /* @__PURE__ */ jsx(InlineMarkdown, { as: Narrative, text: job.summary }),
6163
+ job.highlights?.length > 0 && /* @__PURE__ */ jsx(Achievements, { children: job.highlights.map((highlight, i) => /* @__PURE__ */ jsx(InlineMarkdown, { as: AchievementItem, text: highlight }, i)) })
6111
6164
  ] }, index))
6112
6165
  ] });
6113
6166
  }
@@ -6127,8 +6180,8 @@ function ProjectsSection({ projects }) {
6127
6180
  /* @__PURE__ */ jsx(StyledSectionTitle, { children: "Featured Campaigns & Projects" }),
6128
6181
  projects.map((project, index) => /* @__PURE__ */ jsxs(StoryItem, { children: [
6129
6182
  /* @__PURE__ */ jsx(Position, { children: project.name }),
6130
- project.description && /* @__PURE__ */ jsx(Narrative, { children: project.description }),
6131
- project.highlights?.length > 0 && /* @__PURE__ */ jsx(Achievements, { children: project.highlights.map((highlight, i) => /* @__PURE__ */ jsx(AchievementItem, { children: highlight }, i)) })
6183
+ project.description && /* @__PURE__ */ jsx(InlineMarkdown, { as: Narrative, text: project.description }),
6184
+ project.highlights?.length > 0 && /* @__PURE__ */ jsx(Achievements, { children: project.highlights.map((highlight, i) => /* @__PURE__ */ jsx(InlineMarkdown, { as: AchievementItem, text: highlight }, i)) })
6132
6185
  ] }, index))
6133
6186
  ] });
6134
6187
  }
@@ -6160,8 +6213,8 @@ function VolunteerSection({ volunteer }) {
6160
6213
  (vol.startDate || vol.endDate) && /* @__PURE__ */ jsx(DateText, { children: /* @__PURE__ */ jsx(DateRange, { startDate: vol.startDate, endDate: vol.endDate }) })
6161
6214
  ] })
6162
6215
  ] }),
6163
- vol.summary && /* @__PURE__ */ jsx(Narrative, { children: vol.summary }),
6164
- vol.highlights?.length > 0 && /* @__PURE__ */ jsx(Achievements, { children: vol.highlights.map((highlight, i) => /* @__PURE__ */ jsx(AchievementItem, { children: highlight }, i)) })
6216
+ vol.summary && /* @__PURE__ */ jsx(InlineMarkdown, { as: Narrative, text: vol.summary }),
6217
+ vol.highlights?.length > 0 && /* @__PURE__ */ jsx(Achievements, { children: vol.highlights.map((highlight, i) => /* @__PURE__ */ jsx(InlineMarkdown, { as: AchievementItem, text: highlight }, i)) })
6165
6218
  ] }, index))
6166
6219
  ] });
6167
6220
  }
@@ -6176,7 +6229,7 @@ function AwardsSection({ awards }) {
6176
6229
  award.awarder
6177
6230
  ] }),
6178
6231
  award.date && /* @__PURE__ */ jsx(EducationDate, { children: award.date }),
6179
- award.summary && /* @__PURE__ */ jsx(Narrative, { children: award.summary })
6232
+ award.summary && /* @__PURE__ */ jsx(InlineMarkdown, { as: Narrative, text: award.summary })
6180
6233
  ] }, index))
6181
6234
  ] });
6182
6235
  }
@@ -6191,7 +6244,7 @@ function PublicationsSection({ publications }) {
6191
6244
  pub.publisher
6192
6245
  ] }),
6193
6246
  pub.releaseDate && /* @__PURE__ */ jsx(EducationDate, { children: pub.releaseDate }),
6194
- pub.summary && /* @__PURE__ */ jsx(Narrative, { children: pub.summary })
6247
+ pub.summary && /* @__PURE__ */ jsx(InlineMarkdown, { as: Narrative, text: pub.summary })
6195
6248
  ] }, index))
6196
6249
  ] });
6197
6250
  }
@@ -6461,7 +6514,7 @@ function Resume({ resume }) {
6461
6514
  /* @__PURE__ */ jsx(Name, { children: basics.name }),
6462
6515
  basics.label && /* @__PURE__ */ jsx(Label, { children: basics.label }),
6463
6516
  /* @__PURE__ */ jsx(StyledContactInfo, { basics }),
6464
- basics.summary && /* @__PURE__ */ jsx(Summary, { children: basics.summary })
6517
+ basics.summary && /* @__PURE__ */ jsx(InlineMarkdown, { as: Summary, text: basics.summary })
6465
6518
  ] }),
6466
6519
  /* @__PURE__ */ jsx(WorkSection, { work }),
6467
6520
  /* @__PURE__ */ jsx(SkillsSection, { skills }),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "jsonresume-theme-marketing-narrative",
3
- "version": "0.2.12",
3
+ "version": "0.2.13",
4
4
  "description": "Marketing professionals - your narrative and campaigns are the focus",
5
5
  "main": "./dist/index.js",
6
6
  "type": "module",
package/src/Resume.jsx CHANGED
@@ -1,6 +1,6 @@
1
1
  import React from 'react';
2
2
  import styled from 'styled-components';
3
- import { SectionTitle, ContactInfo } from '@jsonresume/core';
3
+ import { SectionTitle, ContactInfo, InlineMarkdown } from '@jsonresume/core';
4
4
  import { WorkSection } from './sections/WorkSection.jsx';
5
5
  import { SkillsSection } from './sections/SkillsSection.jsx';
6
6
  import { ProjectsSection } from './sections/ProjectsSection.jsx';
@@ -261,7 +261,9 @@ function Resume({ resume }) {
261
261
  <Name>{basics.name}</Name>
262
262
  {basics.label && <Label>{basics.label}</Label>}
263
263
  <StyledContactInfo basics={basics} />
264
- {basics.summary && <Summary>{basics.summary}</Summary>}
264
+ {basics.summary && (
265
+ <InlineMarkdown as={Summary} text={basics.summary} />
266
+ )}
265
267
  </Header>
266
268
 
267
269
  <WorkSection work={work} />
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- import { Section, DateRange } from '@jsonresume/core';
2
+ import { Section, DateRange, InlineMarkdown } from '@jsonresume/core';
3
3
  import {
4
4
  StyledSectionTitle,
5
5
  StoryItem,
@@ -41,11 +41,11 @@ export function VolunteerSection({ volunteer }) {
41
41
  )}
42
42
  </CompanyAndDate>
43
43
  </StoryHeader>
44
- {vol.summary && <Narrative>{vol.summary}</Narrative>}
44
+ {vol.summary && <InlineMarkdown as={Narrative} text={vol.summary} />}
45
45
  {vol.highlights?.length > 0 && (
46
46
  <Achievements>
47
47
  {vol.highlights.map((highlight, i) => (
48
- <AchievementItem key={i}>{highlight}</AchievementItem>
48
+ <InlineMarkdown as={AchievementItem} key={i} text={highlight} />
49
49
  ))}
50
50
  </Achievements>
51
51
  )}
@@ -66,7 +66,9 @@ export function AwardsSection({ awards }) {
66
66
  <Institution>{award.title}</Institution>
67
67
  {award.awarder && <Degree>Awarded by {award.awarder}</Degree>}
68
68
  {award.date && <EducationDate>{award.date}</EducationDate>}
69
- {award.summary && <Narrative>{award.summary}</Narrative>}
69
+ {award.summary && (
70
+ <InlineMarkdown as={Narrative} text={award.summary} />
71
+ )}
70
72
  </EducationItem>
71
73
  ))}
72
74
  </Section>
@@ -84,7 +86,7 @@ export function PublicationsSection({ publications }) {
84
86
  <Institution>{pub.name}</Institution>
85
87
  {pub.publisher && <Degree>Published by {pub.publisher}</Degree>}
86
88
  {pub.releaseDate && <EducationDate>{pub.releaseDate}</EducationDate>}
87
- {pub.summary && <Narrative>{pub.summary}</Narrative>}
89
+ {pub.summary && <InlineMarkdown as={Narrative} text={pub.summary} />}
88
90
  </EducationItem>
89
91
  ))}
90
92
  </Section>
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- import { Section } from '@jsonresume/core';
2
+ import { Section, InlineMarkdown } from '@jsonresume/core';
3
3
  import {
4
4
  StyledSectionTitle,
5
5
  StoryItem,
@@ -18,11 +18,13 @@ export function ProjectsSection({ projects }) {
18
18
  {projects.map((project, index) => (
19
19
  <StoryItem key={index}>
20
20
  <Position>{project.name}</Position>
21
- {project.description && <Narrative>{project.description}</Narrative>}
21
+ {project.description && (
22
+ <InlineMarkdown as={Narrative} text={project.description} />
23
+ )}
22
24
  {project.highlights?.length > 0 && (
23
25
  <Achievements>
24
26
  {project.highlights.map((highlight, i) => (
25
- <AchievementItem key={i}>{highlight}</AchievementItem>
27
+ <InlineMarkdown as={AchievementItem} key={i} text={highlight} />
26
28
  ))}
27
29
  </Achievements>
28
30
  )}
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- import { Section, DateRange } from '@jsonresume/core';
2
+ import { Section, DateRange, InlineMarkdown } from '@jsonresume/core';
3
3
  import {
4
4
  StyledSectionTitle,
5
5
  StoryItem,
@@ -30,11 +30,11 @@ export function WorkSection({ work }) {
30
30
  </DateText>
31
31
  </CompanyAndDate>
32
32
  </StoryHeader>
33
- {job.summary && <Narrative>{job.summary}</Narrative>}
33
+ {job.summary && <InlineMarkdown as={Narrative} text={job.summary} />}
34
34
  {job.highlights?.length > 0 && (
35
35
  <Achievements>
36
36
  {job.highlights.map((highlight, i) => (
37
- <AchievementItem key={i}>{highlight}</AchievementItem>
37
+ <InlineMarkdown as={AchievementItem} key={i} text={highlight} />
38
38
  ))}
39
39
  </Achievements>
40
40
  )}