Skip to content

A reactive notebook for Python — run reproducible experiments, query with SQL, execute as a script, deploy as an app, and version with git. Stored as pure Python. All in a modern, AI-native editor.

Restore DOM-based metadata for VS Code extension compatibility (#5480)

Trevor Manz79226af80af8
diff --git a/frontend/index.html b/frontend/index.html
index e3255c9f77..6fda22668d 100644
--- a/frontend/index.html
+++ b/frontend/index.html
@@ -53,6 +53,11 @@
}
</script>
<marimo-filename hidden>{{ filename }}</marimo-filename>
+ <!-- TODO(Trevor): Legacy, required by VS Code plugin. Remove when plugin is updated (see marimo/server/_templates/template.py) -->
+ <marimo-version data-version="{{ version }}" hidden></marimo-version>
+ <marimo-user-config data-config="{{ user_config }}" hidden></marimo-user-config>
+ <marimo-server-token data-token="{{ server_token }}" hidden></marimo-server-token>
+ <!-- /TODO -->
<title>{{ title }}</title>
</head>
<body>
diff --git a/marimo/_server/templates/templates.py b/marimo/_server/templates/templates.py
index 18603f13f9..69262dedc4 100644
--- a/marimo/_server/templates/templates.py
+++ b/marimo/_server/templates/templates.py
@@ -94,6 +94,14 @@ def home_page_template(
html = html.replace("{{ title }}", "marimo")
html = html.replace("{{ filename }}", "")
+ # TODO(Trevor): Legacy, required by VS Code plugin. Remove when plugin is updated (see frontend/index.html)
+ html = html.replace("{{ version }}", get_version())
+ html = html.replace(
+ "{{ user_config }}", _html_escape(json.dumps(user_config))
+ )
+ html = html.replace("{{ server_token }}", str(server_token))
+ # /TODO
+
html = html.replace(
MOUNT_CONFIG_TEMPLATE,
_get_mount_config(
@@ -137,6 +145,15 @@ def notebook_page_template(
).to_notebook_v1()
html = html.replace("{{ filename }}", _html_escape(filename or ""))
+
+ # TODO(Trevor): Legacy, required by VS Code plugin. Remove when plugin is updated (see frontend/index.html)
+ html = html.replace("{{ version }}", get_version())
+ html = html.replace(
+ "{{ user_config }}", _html_escape(json.dumps(user_config))
+ )
+ html = html.replace("{{ server_token }}", str(server_token))
+ # /TODO
+
html = html.replace(
MOUNT_CONFIG_TEMPLATE,
_get_mount_config(