Skip to content

Commit ee0bf3e

Browse files
Filmbostock
andauthored
update vitepress, fix a build crash, add a sitemap (#1809)
* - upgrade vitepress - fix a crash with docs:build and figure.append / el.append - generate a sitemap at ./docs/.vitepress/dist/sitemap.xml * yarn upgrade * append coerces to text --------- Co-authored-by: Mike Bostock <[email protected]>
1 parent 76d4691 commit ee0bf3e

File tree

5 files changed

+291
-294
lines changed

5 files changed

+291
-294
lines changed

docs/.vitepress/config.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,9 @@ export default defineConfig({
2929
["script", {async: "", src: "https://www.googletagmanager.com/gtag/js?id=G-9B88TP6PKQ"}],
3030
["script", {}, "window.dataLayer=window.dataLayer||[];\nfunction gtag(){dataLayer.push(arguments);}\ngtag('js',new Date());\ngtag('config','G-9B88TP6PKQ');"]
3131
],
32+
sitemap: {
33+
hostname: 'https://observablehq.com/plot'
34+
},
3235
themeConfig: {
3336
// https://vitepress.dev/reference/default-theme-config
3437
// Theme related configurations.

docs/components/PlotRender.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,11 @@ class Element {
6969
dispatchEvent() {
7070
// ignored; interaction needs real DOM
7171
}
72+
append(...children) {
73+
for (const child of children) {
74+
this.appendChild(child?.ownerDocument ? child : this.ownerDocument.createTextNode(child));
75+
}
76+
}
7277
appendChild(child) {
7378
this.children.push(child);
7479
child.parentNode = this;

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@
7272
"ts-morph": "^19.0.0",
7373
"typescript": "^5.0.2",
7474
"vite": "^4.0.0",
75-
"vitepress": "^1.0.0-beta.2"
75+
"vitepress": "^1.0.0-rc.4"
7676
},
7777
"dependencies": {
7878
"d3": "^7.8.0",

src/plot.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -356,13 +356,13 @@ export function plot(options = {}) {
356356
function createTitleElement(document, contents, tag) {
357357
if (contents.ownerDocument) return contents;
358358
const e = document.createElement(tag);
359-
e.append(document.createTextNode(contents));
359+
e.append(contents);
360360
return e;
361361
}
362362

363363
function createFigcaption(document, caption) {
364364
const e = document.createElement("figcaption");
365-
e.append(caption.ownerDocument ? caption : document.createTextNode(caption));
365+
e.append(caption);
366366
return e;
367367
}
368368

0 commit comments

Comments
 (0)