Skip to content

Commit bf3b669

Browse files
authored
Merge pull request #429 from api-platform/staging
MEP
2 parents f33521f + 3e5880f commit bf3b669

File tree

21 files changed

+561
-453
lines changed

21 files changed

+561
-453
lines changed

pwa/api/con/conferences.ts

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
import { unbreakable } from "./../../utils/index";
22
import path from "node:path";
33
import matter from "gray-matter";
4-
import { marked } from "marked";
54
import { readFile, readdir } from "node:fs/promises";
65
import { sortByStartDate } from "utils/con";
76
import { extractHeadingsFromMarkdown } from "utils";
87
import { getSpeakerById } from "./speakers";
98
import { Conference, Day, Speaker, Track } from "types/con";
109
import { Locale, i18n } from "i18n/i18n-config";
10+
import MarkdownIt from "markdown-it";
1111

1212
export const getAllConferences = async (
1313
edition: string,
@@ -66,12 +66,13 @@ export const getConferenceData = async (
6666
// Use gray-matter to parse the post metadata section
6767
const matterResult = matter(fileContents);
6868

69-
marked.setOptions({ mangle: false, headerIds: false });
69+
const md = new MarkdownIt({
70+
html: true,
71+
linkify: true,
72+
typographer: true,
73+
});
7074

71-
const processedContent =
72-
withDescription && (await marked(matterResult.content, { async: true }));
73-
74-
const contentHtml = processedContent?.toString();
75+
const contentHtml = withDescription ? md.render(matterResult.content) : "";
7576

7677
const speakers = matterResult.data.speakers
7778
.split(" ")

pwa/api/con/legal.ts

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
11
import path from "node:path";
22
import { readFile, readdir } from "node:fs/promises";
3-
43
import matter from "gray-matter";
5-
import { marked } from "marked";
64
import { extractHeadingsFromMarkdown } from "utils";
75
import { Locale, i18n } from "i18n/i18n-config";
6+
import MarkdownIt from "markdown-it";
87

98
export const getLegalData = async (
109
edition: string,
@@ -17,10 +16,13 @@ export const getLegalData = async (
1716
);
1817

1918
const matterResult = matter(fileContents);
20-
marked.setOptions({ mangle: false, headerIds: false });
21-
const processedContent = await marked(matterResult.content, { async: true });
19+
const md = new MarkdownIt({
20+
html: true,
21+
linkify: true,
22+
typographer: true,
23+
});
2224

23-
const contentHtml = processedContent?.toString();
25+
const contentHtml = md.render(matterResult.content);
2426
// Combine the data with the id and contentHtml
2527
return {
2628
content: contentHtml

pwa/api/con/speakers.ts

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
import { readFile, readdir } from "node:fs/promises";
22
import path from "node:path";
33
import matter from "gray-matter";
4-
import { marked } from "marked";
54
import { Locale } from "i18n/i18n-config";
65
import { getPlaceholder } from "utils/getPlaceholder";
76

87
import { Speaker } from "types/con";
8+
import MarkdownIt from "markdown-it";
99

1010
export const getAllSpeakers = async (edition: string, locale: Locale) => {
1111
try {
@@ -57,12 +57,13 @@ export const getSpeakerData = async (
5757

5858
const { id } = matterResult.data;
5959

60-
marked.setOptions({ mangle: false, headerIds: false });
60+
const md = new MarkdownIt({
61+
html: true,
62+
linkify: true,
63+
typographer: true,
64+
});
6165

62-
const processedContent =
63-
withDescription && (await marked(matterResult.content, { async: true }));
64-
65-
const contentHtml = processedContent?.toString();
66+
const contentHtml = withDescription ? md.render(matterResult.content) : "";
6667

6768
const placeholder = await getPlaceholder(
6869
path.join(process.cwd(), `/public/images/con/${edition}/speakers/${id}.png`)

pwa/api/contributors.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ export const octokit = new MyOctokit({
3232
onRateLimit: (
3333
retryAfter: number,
3434
options: Options,
35-
_octokit,
35+
_octokit: any,
3636
retryCount: number
3737
) => {
3838
console.warn(

0 commit comments

Comments
 (0)