Skip to content

Commit

Permalink
Merge pull request #2305 from alixander/valid-html
Browse files Browse the repository at this point in the history
d2render: make HTML friendly
  • Loading branch information
alixander authored Jan 27, 2025
2 parents 87ce08c + 033d3d8 commit 0e35a1e
Show file tree
Hide file tree
Showing 649 changed files with 1,614 additions and 1,612 deletions.
2 changes: 1 addition & 1 deletion d2cli/static/watch.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ function init(reconnectDelay) {
const parsedXML = new DOMParser().parseFromString(msg.svg, "text/xml");
d2SVG.replaceChildren(parsedXML.documentElement);
changeFavicon("/static/favicon.ico");
const svgEl = d2SVG.querySelector("#d2-svg");
const svgEl = d2SVG.querySelector(".d2-svg");
// just use inner SVG in watch mode
svgEl.parentElement.replaceWith(svgEl);
let width = parseInt(svgEl.getAttribute("width"), 10);
Expand Down
2 changes: 1 addition & 1 deletion d2renderers/d2animate/d2animate.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ func Wrap(rootDiagram *d2target.Diagram, svgs [][]byte, renderOpts d2svg.RenderO
)
fmt.Fprint(buf, fitToScreenWrapperOpening)

innerOpening := fmt.Sprintf(`<svg id="d2-svg" width="%d" height="%d" viewBox="%d %d %d %d">`,
innerOpening := fmt.Sprintf(`<svg class="d2-svg" width="%d" height="%d" viewBox="%d %d %d %d">`,
width, height, left, top, width, height)
fmt.Fprint(buf, innerOpening)

Expand Down
4 changes: 2 additions & 2 deletions d2renderers/d2sketch/testdata/all_shapes/sketch.exp.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions d2renderers/d2sketch/testdata/all_shapes_dark/sketch.exp.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions d2renderers/d2sketch/testdata/animated/sketch.exp.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions d2renderers/d2sketch/testdata/animated_dark/sketch.exp.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions d2renderers/d2sketch/testdata/arrowheads/sketch.exp.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions d2renderers/d2sketch/testdata/arrowheads_dark/sketch.exp.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions d2renderers/d2sketch/testdata/basic/sketch.exp.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions d2renderers/d2sketch/testdata/basic_dark/sketch.exp.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions d2renderers/d2sketch/testdata/child_to_child/sketch.exp.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions d2renderers/d2sketch/testdata/class/sketch.exp.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions d2renderers/d2sketch/testdata/class_dark/sketch.exp.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions d2renderers/d2sketch/testdata/connection_label/sketch.exp.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions d2renderers/d2sketch/testdata/crows_feet/sketch.exp.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions d2renderers/d2sketch/testdata/crows_feet_dark/sketch.exp.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 4 additions & 4 deletions d2renderers/d2sketch/testdata/dots-3d/sketch.exp.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions d2renderers/d2sketch/testdata/dots-all/sketch.exp.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions d2renderers/d2sketch/testdata/dots-multiple/sketch.exp.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions d2renderers/d2sketch/testdata/dots-real/sketch.exp.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions d2renderers/d2sketch/testdata/double-border/sketch.exp.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions d2renderers/d2sketch/testdata/elk_corners/sketch.exp.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 3 additions & 3 deletions d2renderers/d2sketch/testdata/opacity/sketch.exp.svg

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions d2renderers/d2sketch/testdata/opacity_dark/sketch.exp.svg

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions d2renderers/d2sketch/testdata/overlay/sketch.exp.svg

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions d2renderers/d2sketch/testdata/paper-real/sketch.exp.svg

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions d2renderers/d2sketch/testdata/root-fill/sketch.exp.svg

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions d2renderers/d2sketch/testdata/sql_tables/sketch.exp.svg

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions d2renderers/d2sketch/testdata/sql_tables_dark/sketch.exp.svg

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions d2renderers/d2sketch/testdata/terminal/sketch.exp.svg

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions d2renderers/d2sketch/testdata/twitter/sketch.exp.svg

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions d2renderers/d2sketch/testdata/twitter_dark/sketch.exp.svg

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Loading

0 comments on commit 0e35a1e

Please sign in to comment.