diff --git a/web/components/editor/embed-modal.tsx b/web/components/editor/embed-modal.tsx
index 26d53edd..19e5349d 100644
--- a/web/components/editor/embed-modal.tsx
+++ b/web/components/editor/embed-modal.tsx
@@ -19,12 +19,24 @@ function getTweetId(text: string) {
return match ? match[1] : null
}
-// A valid YouTube URL looks like 'https://www.youtube.com/watch?v=ziq7FUKpCS8'
+// Manifold URL: https://manifold.markets/Austin/will-manifold-ever-be-worth-1b
+function getManifoldSlug(text: string) {
+ const match = text.match(/^https?:\/\/manifold\.markets\/([^\/]+)\/([^\/]+)/)
+ return match ? [match[1], match[2]] : null
+}
+
+// Youtube URL: 'https://www.youtube.com/watch?v=ziq7FUKpCS8'
function getYoutubeId(text: string) {
const match = text.match(/^https?:\/\/www\.youtube\.com\/watch\?v=([^&]+)/)
return match ? match[1] : null
}
+// Metaculus URL: 'https://www.metaculus.com/questions/5320/chinese-annexation-of-half-of-taiwan-by-2050/'
+function getMetaculusId(text: string) {
+ const match = text.match(/^https?:\/\/www\.metaculus\.com\/questions\/(\d+)/)
+ return match ? match[1] : null
+}
+
function isValidUrl(text: string) {
// Conjured by Codex
return /^(https?:\/\/)?([\da-z\.-]+)\.([a-z\.]{2,6})([\/\w \.-]*)*\/?$/.test(
@@ -39,10 +51,17 @@ function embedCode(text: string) {
// Append a leading 't', to prevent tweetId from being interpreted as a number.
// If it's a number, there may be numeric precision issues.
return ``
+ } else if (getManifoldSlug(text)) {
+ const [username, slug] = getManifoldSlug(text) as [string, string]
+ return ``
} else if (getYoutubeId(text)) {
return ``
+ } else if (getMetaculusId(text)) {
+ return ``
} else if (isValidUrl(text)) {
return ``
}