diff --git a/db/model/Gdoc/enrichedToMarkdown.ts b/db/model/Gdoc/enrichedToMarkdown.ts
index a186f859300..2556f74ef2b 100644
--- a/db/model/Gdoc/enrichedToMarkdown.ts
+++ b/db/model/Gdoc/enrichedToMarkdown.ts
@@ -129,7 +129,9 @@ ${items}
)
.with({ type: "code" }, (b): string | undefined => {
return (
- "```\n" + b.text.map((text) => text.value).join("\n") + "\n```"
+ "```\n" +
+ b.text.map((text) => text.value.text).join("\n") +
+ "\n```"
)
})
.with({ type: "donors" }, (_): string | undefined =>
diff --git a/db/model/Gdoc/enrichedToRaw.ts b/db/model/Gdoc/enrichedToRaw.ts
index db819e092e4..51d771941d8 100644
--- a/db/model/Gdoc/enrichedToRaw.ts
+++ b/db/model/Gdoc/enrichedToRaw.ts
@@ -127,7 +127,10 @@ export function enrichedBlockToRawBlock(
{ type: "code" },
(b): RawBlockCode => ({
type: b.type,
- value: b.text,
+ value: b.text.map((text) => ({
+ type: "text",
+ value: text.value.text,
+ })),
})
)
.with(
diff --git a/db/model/Gdoc/exampleEnrichedBlocks.ts b/db/model/Gdoc/exampleEnrichedBlocks.ts
index f6189a6cc4b..01a45f6fd0a 100644
--- a/db/model/Gdoc/exampleEnrichedBlocks.ts
+++ b/db/model/Gdoc/exampleEnrichedBlocks.ts
@@ -96,8 +96,12 @@ export const enrichedBlockExamples: Record<
type: "code",
text: [
{
- type: "text",
- value: '',
+ type: "simple-text",
+ value: {
+ spanType: "span-simple-text",
+ text: '',
+ },
+ parseErrors: [],
},
],
parseErrors: [],
diff --git a/db/model/Gdoc/rawToEnriched.ts b/db/model/Gdoc/rawToEnriched.ts
index 5cb8230ea2a..bae5d4e3b7f 100644
--- a/db/model/Gdoc/rawToEnriched.ts
+++ b/db/model/Gdoc/rawToEnriched.ts
@@ -500,8 +500,12 @@ const parseCode = (raw: RawBlockCode): EnrichedBlockCode => {
return {
type: "code",
text: raw.value.map((text) => ({
- type: "text",
- value: toAsciiQuotes(text.value),
+ type: "simple-text",
+ value: {
+ spanType: "span-simple-text",
+ text: toAsciiQuotes(text.value),
+ },
+ parseErrors: [],
})),
parseErrors: [],
}
diff --git a/packages/@ourworldindata/types/src/gdocTypes/ArchieMlComponents.ts b/packages/@ourworldindata/types/src/gdocTypes/ArchieMlComponents.ts
index 90ea4c7c8ef..90aa20c4299 100644
--- a/packages/@ourworldindata/types/src/gdocTypes/ArchieMlComponents.ts
+++ b/packages/@ourworldindata/types/src/gdocTypes/ArchieMlComponents.ts
@@ -93,7 +93,7 @@ export type RawBlockCode = {
export type EnrichedBlockCode = {
type: "code"
- text: RawBlockText[]
+ text: EnrichedBlockSimpleText[]
} & EnrichedBlockWithParseErrors
export type RawBlockDonorList = {
@@ -366,6 +366,7 @@ export type EnrichedBlockSimpleText = {
type: "simple-text"
value: SpanSimpleText
} & EnrichedBlockWithParseErrors
+
export type RawBlockHtml = {
type: "html"
value: string
diff --git a/site/gdocs/components/ArticleBlock.tsx b/site/gdocs/components/ArticleBlock.tsx
index c644ec1c3cc..c0471598197 100644
--- a/site/gdocs/components/ArticleBlock.tsx
+++ b/site/gdocs/components/ArticleBlock.tsx
@@ -248,7 +248,7 @@ export default function ArticleBlock({
.with({ type: "code" }, (block) => (
text.value).join("\n")}
+ code={block.text.map((text) => text.value.text).join("\n")}
/>
))
.with({ type: "donors" }, (_block) => (