From 8d74da5baeb62aa7294f9cf6d5bc6197ce53f793 Mon Sep 17 00:00:00 2001 From: Rob Gordon Date: Fri, 1 Dec 2023 15:59:28 -0500 Subject: [PATCH] Add Export to Visio Tutorial (#629) * Support looping videos on blog posts * Add link to tutorial * Remove explcit link --- api/_lib/_notion.ts | 37 +++++++++++++++++++++++++++++- app/src/components/ShareDialog.tsx | 13 ++++++++++- app/src/locales/de/messages.js | 2 +- app/src/locales/de/messages.po | 28 ++++++++++++---------- app/src/locales/en/messages.js | 2 +- app/src/locales/en/messages.po | 28 ++++++++++++---------- app/src/locales/es/messages.js | 2 +- app/src/locales/es/messages.po | 28 ++++++++++++---------- app/src/locales/fr/messages.js | 2 +- app/src/locales/fr/messages.po | 28 ++++++++++++---------- app/src/locales/hi/messages.js | 2 +- app/src/locales/hi/messages.po | 28 ++++++++++++---------- app/src/locales/ko/messages.js | 2 +- app/src/locales/ko/messages.po | 28 ++++++++++++---------- app/src/locales/pt-br/messages.js | 2 +- app/src/locales/pt-br/messages.po | 28 ++++++++++++---------- app/src/locales/zh/messages.js | 2 +- app/src/locales/zh/messages.po | 28 ++++++++++++---------- 18 files changed, 184 insertions(+), 106 deletions(-) diff --git a/api/_lib/_notion.ts b/api/_lib/_notion.ts index f4b1c6b8d..efcdac451 100644 --- a/api/_lib/_notion.ts +++ b/api/_lib/_notion.ts @@ -56,7 +56,22 @@ marked.setOptions({ }); export async function getPostHtmlFromId(id: string) { - const mdblocks = await n2m.pageToMarkdown(id); + let mdblocks = await n2m.pageToMarkdown(id); + // convert video blocks to HTML + mdblocks = mdblocks.map((block) => { + if (block.type === "video") { + const videoHtml = videoBlockToHtml(block); + if (videoHtml) { + return { + type: "html", + parent: videoHtml, + children: [], + }; + } + } + return block; + }); + const mdString = n2m.toMarkdownString(mdblocks); const html = marked(mdString); return html; @@ -67,3 +82,23 @@ const AREAS_OF_RESEARCH_PAGE_ID = "6797865c1d744aa0babbea7d1558e8b3"; export async function getAreasOfResearchHtml() { return await getPostHtmlFromId(AREAS_OF_RESEARCH_PAGE_ID); } + +/** + +Takes a block in the format +{ + type: 'video', + parent: '[image](url)', + children: [] + } + + and returns an HTML