jsonresume-theme-new-york-editorial 0.2.13 → 0.2.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 +6 -0
- package/dist/index.js +70 -11
- package/package.json +1 -1
- package/src/Resume.jsx +15 -7
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
# jsonresume-theme-new-york-editorial
|
|
2
2
|
|
|
3
|
+
## 0.2.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.2.13
|
|
4
10
|
|
|
5
11
|
### Patch Changes
|
package/dist/index.js
CHANGED
|
@@ -1787,16 +1787,16 @@ const StyledLink = dt.a`
|
|
|
1787
1787
|
}
|
|
1788
1788
|
`;
|
|
1789
1789
|
function Link({ href, children, className, ...rest }) {
|
|
1790
|
-
const
|
|
1791
|
-
if (!
|
|
1790
|
+
const safeHref2 = safeUrl(href);
|
|
1791
|
+
if (!safeHref2) {
|
|
1792
1792
|
return /* @__PURE__ */ jsx("span", { className, children });
|
|
1793
1793
|
}
|
|
1794
|
-
const isExternal = isExternalUrl(
|
|
1794
|
+
const isExternal = isExternalUrl(safeHref2);
|
|
1795
1795
|
const externalProps = isExternal ? { target: "_blank", rel: "noopener noreferrer" } : {};
|
|
1796
1796
|
return /* @__PURE__ */ jsx(
|
|
1797
1797
|
StyledLink,
|
|
1798
1798
|
{
|
|
1799
|
-
href:
|
|
1799
|
+
href: safeHref2,
|
|
1800
1800
|
className: `resume-link ${className || ""}`.trim(),
|
|
1801
1801
|
...externalProps,
|
|
1802
1802
|
...rest,
|
|
@@ -1824,6 +1824,59 @@ dt.span`
|
|
|
1824
1824
|
}
|
|
1825
1825
|
}
|
|
1826
1826
|
`;
|
|
1827
|
+
const ESCAPES = {
|
|
1828
|
+
"&": "&",
|
|
1829
|
+
"<": "<",
|
|
1830
|
+
">": ">",
|
|
1831
|
+
'"': """,
|
|
1832
|
+
"'": "'"
|
|
1833
|
+
};
|
|
1834
|
+
const escapeHtml = (text) => text.replace(/[&<>"']/g, (c) => ESCAPES[c]);
|
|
1835
|
+
const ESCAPABLE = /\\([\\`*_[\]()!#])/g;
|
|
1836
|
+
const CODE = /`([^`]+)`/g;
|
|
1837
|
+
const LINK = /\[([^\]]+)\]\(([^)\s]+)\)/g;
|
|
1838
|
+
const STRONG = /\*\*(?=\S)([^*]*?\S)\*\*|__(?=\S)([^_]*?\S)__/g;
|
|
1839
|
+
const EMPHASIS = /\*(?=\S)([^*]*?\S)\*|(^|[^\p{L}\p{N}_])_(?=\S)([^_]*?\S)_(?![\p{L}\p{N}_])/gu;
|
|
1840
|
+
const safeHref = (url) => /^(https?:\/\/|mailto:)/i.test(url) ? url : void 0;
|
|
1841
|
+
const emphasis = (text, strong, em) => text.replace(STRONG, (_2, a, b2) => strong(a ?? b2)).replace(
|
|
1842
|
+
EMPHASIS,
|
|
1843
|
+
(_2, a, before, b2) => a !== void 0 ? em(a) : `${before}${em(b2)}`
|
|
1844
|
+
);
|
|
1845
|
+
const inline = (text, out) => {
|
|
1846
|
+
const kept = [];
|
|
1847
|
+
const keep = (value) => `${kept.push(value) - 1}`;
|
|
1848
|
+
const marks = (t) => emphasis(t, out.strong, out.em);
|
|
1849
|
+
const rest = text.replace(/\uE000/g, "").replace(ESCAPABLE, (_2, c) => keep(out.text(c))).replace(CODE, (_2, body) => keep(out.code(body))).replace(
|
|
1850
|
+
LINK,
|
|
1851
|
+
(_2, label, url) => keep(out.link(marks(out.text(label)), url))
|
|
1852
|
+
);
|
|
1853
|
+
return marks(out.text(rest)).replace(
|
|
1854
|
+
/\uE000(\d+)\uE000/g,
|
|
1855
|
+
(_2, i) => kept[Number(i)]
|
|
1856
|
+
);
|
|
1857
|
+
};
|
|
1858
|
+
function renderInlineMarkdown(text) {
|
|
1859
|
+
if (typeof text !== "string") return "";
|
|
1860
|
+
return inline(text, {
|
|
1861
|
+
text: escapeHtml,
|
|
1862
|
+
code: (body) => `<code>${escapeHtml(body)}</code>`,
|
|
1863
|
+
link: (label, url) => {
|
|
1864
|
+
const href = safeHref(url);
|
|
1865
|
+
return href ? `<a href="${escapeHtml(href)}">${label}</a>` : label;
|
|
1866
|
+
},
|
|
1867
|
+
strong: (t) => `<strong>${t}</strong>`,
|
|
1868
|
+
em: (t) => `<em>${t}</em>`
|
|
1869
|
+
});
|
|
1870
|
+
}
|
|
1871
|
+
function InlineMarkdown({ text, as: Tag = "span", ...rest }) {
|
|
1872
|
+
return /* @__PURE__ */ jsx(
|
|
1873
|
+
Tag,
|
|
1874
|
+
{
|
|
1875
|
+
...rest,
|
|
1876
|
+
dangerouslySetInnerHTML: { __html: renderInlineMarkdown(text) }
|
|
1877
|
+
}
|
|
1878
|
+
);
|
|
1879
|
+
}
|
|
1827
1880
|
dt.hr`
|
|
1828
1881
|
border: none;
|
|
1829
1882
|
border-top: 0.5pt solid
|
|
@@ -6441,7 +6494,7 @@ function Resume({ resume }) {
|
|
|
6441
6494
|
/* @__PURE__ */ jsx(Name, { children: basics.name }),
|
|
6442
6495
|
basics.label && /* @__PURE__ */ jsx(Label, { children: basics.label }),
|
|
6443
6496
|
/* @__PURE__ */ jsx(StyledContactInfo, { basics }),
|
|
6444
|
-
basics.summary && /* @__PURE__ */ jsx(
|
|
6497
|
+
basics.summary && /* @__PURE__ */ jsx(InlineMarkdown, { as: Summary, text: basics.summary })
|
|
6445
6498
|
] }),
|
|
6446
6499
|
work && work.length > 0 && /* @__PURE__ */ jsxs(StyledSection, { children: [
|
|
6447
6500
|
/* @__PURE__ */ jsx(StyledSectionTitle, { children: "Experience" }),
|
|
@@ -6459,7 +6512,7 @@ function Resume({ resume }) {
|
|
|
6459
6512
|
)
|
|
6460
6513
|
] })
|
|
6461
6514
|
] }),
|
|
6462
|
-
job.summary && /* @__PURE__ */ jsx(
|
|
6515
|
+
job.summary && /* @__PURE__ */ jsx(InlineMarkdown, { as: WorkSummary, text: job.summary }),
|
|
6463
6516
|
job.highlights && job.highlights.length > 0 && /* @__PURE__ */ jsx(HighlightsList, { children: job.highlights.map((highlight, i) => /* @__PURE__ */ jsx(
|
|
6464
6517
|
"li",
|
|
6465
6518
|
{
|
|
@@ -6501,8 +6554,14 @@ function Resume({ resume }) {
|
|
|
6501
6554
|
/* @__PURE__ */ jsx(StyledSectionTitle, { children: "Projects" }),
|
|
6502
6555
|
projects.map((project, index) => /* @__PURE__ */ jsxs(ProjectItem, { children: [
|
|
6503
6556
|
/* @__PURE__ */ jsx(ProjectName, { children: project.url ? /* @__PURE__ */ jsx(Link, { href: project.url, children: project.name }) : project.name }),
|
|
6504
|
-
project.description && /* @__PURE__ */ jsx(
|
|
6505
|
-
|
|
6557
|
+
project.description && /* @__PURE__ */ jsx(
|
|
6558
|
+
InlineMarkdown,
|
|
6559
|
+
{
|
|
6560
|
+
as: ProjectDescription,
|
|
6561
|
+
text: project.description
|
|
6562
|
+
}
|
|
6563
|
+
),
|
|
6564
|
+
project.highlights && project.highlights.length > 0 && /* @__PURE__ */ jsx(ProjectHighlights, { children: project.highlights.map((highlight, i) => /* @__PURE__ */ jsx(InlineMarkdown, { as: "li", text: highlight }, i)) })
|
|
6506
6565
|
] }, index))
|
|
6507
6566
|
] }),
|
|
6508
6567
|
publications && publications.length > 0 && /* @__PURE__ */ jsxs(StyledSection, { children: [
|
|
@@ -6516,7 +6575,7 @@ function Resume({ resume }) {
|
|
|
6516
6575
|
pub.releaseDate
|
|
6517
6576
|
] })
|
|
6518
6577
|
] }),
|
|
6519
|
-
pub.summary && /* @__PURE__ */ jsx(
|
|
6578
|
+
pub.summary && /* @__PURE__ */ jsx(InlineMarkdown, { as: ProjectDescription, text: pub.summary })
|
|
6520
6579
|
] }, index))
|
|
6521
6580
|
] }),
|
|
6522
6581
|
volunteer && volunteer.length > 0 && /* @__PURE__ */ jsxs(StyledSection, { children: [
|
|
@@ -6536,7 +6595,7 @@ function Resume({ resume }) {
|
|
|
6536
6595
|
)
|
|
6537
6596
|
] })
|
|
6538
6597
|
] }),
|
|
6539
|
-
vol.summary && /* @__PURE__ */ jsx(
|
|
6598
|
+
vol.summary && /* @__PURE__ */ jsx(InlineMarkdown, { as: ItemDescription, text: vol.summary })
|
|
6540
6599
|
] }, index)) })
|
|
6541
6600
|
] }),
|
|
6542
6601
|
awards && awards.length > 0 && /* @__PURE__ */ jsxs(StyledSection, { children: [
|
|
@@ -6550,7 +6609,7 @@ function Resume({ resume }) {
|
|
|
6550
6609
|
award.date
|
|
6551
6610
|
] })
|
|
6552
6611
|
] }),
|
|
6553
|
-
award.summary && /* @__PURE__ */ jsx(
|
|
6612
|
+
award.summary && /* @__PURE__ */ jsx(InlineMarkdown, { as: ItemDescription, text: award.summary })
|
|
6554
6613
|
] }, index)) })
|
|
6555
6614
|
] }),
|
|
6556
6615
|
certificates && certificates.length > 0 && /* @__PURE__ */ jsxs(StyledSection, { children: [
|
package/package.json
CHANGED
package/src/Resume.jsx
CHANGED
|
@@ -6,6 +6,7 @@ import {
|
|
|
6
6
|
DateRange,
|
|
7
7
|
ContactInfo,
|
|
8
8
|
Link,
|
|
9
|
+
InlineMarkdown,
|
|
9
10
|
} from '@jsonresume/core';
|
|
10
11
|
|
|
11
12
|
const Layout = styled.div`
|
|
@@ -351,7 +352,9 @@ function Resume({ resume }) {
|
|
|
351
352
|
<Name>{basics.name}</Name>
|
|
352
353
|
{basics.label && <Label>{basics.label}</Label>}
|
|
353
354
|
<StyledContactInfo basics={basics} />
|
|
354
|
-
{basics.summary &&
|
|
355
|
+
{basics.summary && (
|
|
356
|
+
<InlineMarkdown as={Summary} text={basics.summary} />
|
|
357
|
+
)}
|
|
355
358
|
</Header>
|
|
356
359
|
|
|
357
360
|
{work && work.length > 0 && (
|
|
@@ -369,7 +372,9 @@ function Resume({ resume }) {
|
|
|
369
372
|
/>
|
|
370
373
|
</CompanyLine>
|
|
371
374
|
</WorkHeader>
|
|
372
|
-
{job.summary &&
|
|
375
|
+
{job.summary && (
|
|
376
|
+
<InlineMarkdown as={WorkSummary} text={job.summary} />
|
|
377
|
+
)}
|
|
373
378
|
{job.highlights && job.highlights.length > 0 && (
|
|
374
379
|
<HighlightsList>
|
|
375
380
|
{job.highlights.map((highlight, i) => (
|
|
@@ -434,12 +439,15 @@ function Resume({ resume }) {
|
|
|
434
439
|
)}
|
|
435
440
|
</ProjectName>
|
|
436
441
|
{project.description && (
|
|
437
|
-
<
|
|
442
|
+
<InlineMarkdown
|
|
443
|
+
as={ProjectDescription}
|
|
444
|
+
text={project.description}
|
|
445
|
+
/>
|
|
438
446
|
)}
|
|
439
447
|
{project.highlights && project.highlights.length > 0 && (
|
|
440
448
|
<ProjectHighlights>
|
|
441
449
|
{project.highlights.map((highlight, i) => (
|
|
442
|
-
<li key={i}
|
|
450
|
+
<InlineMarkdown as="li" key={i} text={highlight} />
|
|
443
451
|
))}
|
|
444
452
|
</ProjectHighlights>
|
|
445
453
|
)}
|
|
@@ -461,7 +469,7 @@ function Resume({ resume }) {
|
|
|
461
469
|
{pub.releaseDate && <> • {pub.releaseDate}</>}
|
|
462
470
|
</ItemMeta>
|
|
463
471
|
{pub.summary && (
|
|
464
|
-
<ProjectDescription
|
|
472
|
+
<InlineMarkdown as={ProjectDescription} text={pub.summary} />
|
|
465
473
|
)}
|
|
466
474
|
</ProjectItem>
|
|
467
475
|
))}
|
|
@@ -488,7 +496,7 @@ function Resume({ resume }) {
|
|
|
488
496
|
)}
|
|
489
497
|
</ItemMeta>
|
|
490
498
|
{vol.summary && (
|
|
491
|
-
<ItemDescription
|
|
499
|
+
<InlineMarkdown as={ItemDescription} text={vol.summary} />
|
|
492
500
|
)}
|
|
493
501
|
</SimpleItem>
|
|
494
502
|
))}
|
|
@@ -508,7 +516,7 @@ function Resume({ resume }) {
|
|
|
508
516
|
{award.date && <> • {award.date}</>}
|
|
509
517
|
</ItemMeta>
|
|
510
518
|
{award.summary && (
|
|
511
|
-
<ItemDescription
|
|
519
|
+
<InlineMarkdown as={ItemDescription} text={award.summary} />
|
|
512
520
|
)}
|
|
513
521
|
</SimpleItem>
|
|
514
522
|
))}
|