// dummy value to unify block shapes
@@ -935,6 +945,7 @@ export type OwidRawGdocBlock =
| RawBlockAside
| RawBlockCallout
| RawBlockChart
+ | RawBlockCode
| RawBlockDonorList
| RawBlockScroller
| RawBlockChartStory
@@ -985,6 +996,7 @@ export type OwidEnrichedGdocBlock =
| EnrichedBlockAside
| EnrichedBlockCallout
| EnrichedBlockChart
+ | EnrichedBlockCode
| EnrichedBlockDonorList
| EnrichedBlockScroller
| EnrichedBlockChartStory
diff --git a/packages/@ourworldindata/types/src/index.ts b/packages/@ourworldindata/types/src/index.ts
index 49ede31ad51..029b936380b 100644
--- a/packages/@ourworldindata/types/src/index.ts
+++ b/packages/@ourworldindata/types/src/index.ts
@@ -170,6 +170,7 @@ export {
type RawBlockChart,
type RawBlockChartStory,
type RawBlockChartValue,
+ type RawBlockCode,
type RawBlockExpandableParagraph,
type RawBlockExplorerTiles,
type RawBlockGraySection,
@@ -226,6 +227,7 @@ export {
type EnrichedBlockCallout,
type EnrichedBlockChart,
type EnrichedBlockChartStory,
+ type EnrichedBlockCode,
type EnrichedBlockDonorList,
type EnrichedBlockExpandableParagraph,
type EnrichedBlockExplorerTiles,
diff --git a/packages/@ourworldindata/utils/src/Util.ts b/packages/@ourworldindata/utils/src/Util.ts
index 1811792dbb7..26a65f6d148 100644
--- a/packages/@ourworldindata/utils/src/Util.ts
+++ b/packages/@ourworldindata/utils/src/Util.ts
@@ -1708,6 +1708,7 @@ export function traverseEnrichedBlock(
type: P.union(
"chart-story",
"chart",
+ "code",
"donors",
"horizontal-rule",
"html",
diff --git a/packages/@ourworldindata/utils/src/index.ts b/packages/@ourworldindata/utils/src/index.ts
index 752ce632323..d3a9d6e1912 100644
--- a/packages/@ourworldindata/utils/src/index.ts
+++ b/packages/@ourworldindata/utils/src/index.ts
@@ -293,7 +293,7 @@ export { Url, setWindowUrl, getWindowUrl } from "./urls/Url.js"
export { type UrlMigration, performUrlMigrations } from "./urls/UrlMigration.js"
-export { camelCaseProperties, titleCase } from "./string.js"
+export { camelCaseProperties, titleCase, toAsciiQuotes } from "./string.js"
export { serializeJSONForHTML, deserializeJSONFromHTML } from "./serializers.js"
diff --git a/packages/@ourworldindata/utils/src/string.ts b/packages/@ourworldindata/utils/src/string.ts
index 52353c514dc..b6dae99eaee 100644
--- a/packages/@ourworldindata/utils/src/string.ts
+++ b/packages/@ourworldindata/utils/src/string.ts
@@ -31,3 +31,7 @@ export const titleCase = (str: string): string => {
})
.join(" ")
}
+
+export function toAsciiQuotes(str: string): string {
+ return str.replace(/[“”]/g, '"').replace(/[‘’]/g, "'")
+}
diff --git a/site/gdocs/components/ArticleBlock.tsx b/site/gdocs/components/ArticleBlock.tsx
index a10831d52c9..c644ec1c3cc 100644
--- a/site/gdocs/components/ArticleBlock.tsx
+++ b/site/gdocs/components/ArticleBlock.tsx
@@ -17,7 +17,7 @@ import {
TocHeadingWithTitleSupertitle,
Url,
} from "@ourworldindata/utils"
-import { convertHeadingTextToId } from "@ourworldindata/components"
+import { CodeSnippet, convertHeadingTextToId } from "@ourworldindata/components"
import SDGGrid from "./SDGGrid.js"
import { BlockErrorBoundary, BlockErrorFallback } from "./BlockErrorBoundary.js"
import { match } from "ts-pattern"
@@ -245,6 +245,12 @@ export default function ArticleBlock({
/>
)
})
+ .with({ type: "code" }, (block) => (
+ text.value).join("\n")}
+ />
+ ))
.with({ type: "donors" }, (_block) => (
))
diff --git a/site/gdocs/pages/AboutPage.scss b/site/gdocs/pages/AboutPage.scss
index 91651cb23e9..7a32487fd0a 100644
--- a/site/gdocs/pages/AboutPage.scss
+++ b/site/gdocs/pages/AboutPage.scss
@@ -97,14 +97,18 @@
margin-bottom: 24px;
}
- .article-block__image {
- margin: 0 0 24px;
- }
-
.article-block__chart {
margin-bottom: 24px;
}
+ .article-block__code-snippet {
+ margin-bottom: 16px;
+ }
+
+ .article-block__image {
+ margin: 0 0 24px;
+ }
+
.article-block__prominent-link {
margin-bottom: 24px;
}