Skip to content

Commit 1ba3148

Browse files
committed
Restore DOM-based metadata for VS Code extension compatibility
The changes in #5120 removed passing configuration data via HTML DOM elements. However, the marimo VS Code extension depends on these DOM-based attributes, leading to a regression. These changes restore the minimal set of DOM data attributes (`marimo-version`, `marimo-user-config`, `marimo-server-token`) required by the extension to function correctly. These additions are marked as temporary and should be removed once the extension is updated to no longer rely on them.
1 parent 6e85482 commit 1ba3148

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

frontend/index.html

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,12 @@
5353
}
5454
</script>
5555
<marimo-filename hidden>{{ filename }}</marimo-filename>
56+
<!-- TODO(Trevor): Legacy, required by VS Code plugin — remove when plugin is updated (see marimo/server/_templates/template.py) -->
57+
<marimo-version data-version='{{ version }}' hidden></marimo-version>
58+
<!-- IMPORTANT: Keep single quotes here — double quotes can cause JSON serialization issues -->
59+
<marimo-user-config data-config='{{ user_config }}' hidden></marimo-user-config>
60+
<marimo-server-token data-token='{{ server_token }}' hidden></marimo-server-token>
61+
<!-- /TODO -->
5662
<title>{{ title }}</title>
5763
</head>
5864
<body>

marimo/_server/templates/templates.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,12 @@ def home_page_template(
9494
html = html.replace("{{ title }}", "marimo")
9595
html = html.replace("{{ filename }}", "")
9696

97+
# TODO(Trevor): Legacy, required by VS Code plugin — remove when plugin is updated (see frontend/index.html)
98+
html = html.replace("{{ server_token }}", str(server_token))
99+
html = html.replace("{{ user_config }}", json.dumps(user_config))
100+
html = html.replace("{{ version }}", get_version())
101+
# /TODO
102+
97103
html = html.replace(
98104
MOUNT_CONFIG_TEMPLATE,
99105
_get_mount_config(

0 commit comments

Comments
 (0)