Skip to content

Commit 451db81

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 e84e968 commit 451db81

File tree

2 files changed

+22
-0
lines changed

2 files changed

+22
-0
lines changed

frontend/index.html

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,11 @@
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+
<marimo-user-config data-config="{{ user_config }}" hidden></marimo-user-config>
59+
<marimo-server-token data-token="{{ server_token }}" hidden></marimo-server-token>
60+
<!-- /TODO -->
5661
<title>{{ title }}</title>
5762
</head>
5863
<body>

marimo/_server/templates/templates.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,14 @@ 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("{{ version }}", get_version())
99+
html = html.replace(
100+
"{{ user_config }}", _html_escape(json.dumps(user_config))
101+
)
102+
html = html.replace("{{ server_token }}", str(server_token))
103+
# /TODO
104+
97105
html = html.replace(
98106
MOUNT_CONFIG_TEMPLATE,
99107
_get_mount_config(
@@ -137,6 +145,15 @@ def notebook_page_template(
137145
).to_notebook_v1()
138146

139147
html = html.replace("{{ filename }}", _html_escape(filename or ""))
148+
149+
# TODO(Trevor): Legacy, required by VS Code plugin — remove when plugin is updated (see frontend/index.html)
150+
html = html.replace("{{ version }}", get_version())
151+
html = html.replace(
152+
"{{ user_config }}", _html_escape(json.dumps(user_config))
153+
)
154+
html = html.replace("{{ server_token }}", str(server_token))
155+
# /TODO
156+
140157
html = html.replace(
141158
MOUNT_CONFIG_TEMPLATE,
142159
_get_mount_config(

0 commit comments

Comments
 (0)