Skip to content

Commit

Permalink
Merge pull request #170 from terrastruct/label-near
Browse files Browse the repository at this point in the history
docs on label near
  • Loading branch information
alixander authored Jul 29, 2023
2 parents 339cda0 + f2979b6 commit 151f0c2
Show file tree
Hide file tree
Showing 136 changed files with 19,981 additions and 19,352 deletions.
5 changes: 5 additions & 0 deletions docs/tour/icons.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,10 @@ vpc: VPC 1 10.1.0.0./16 {

<div className="embedSVG" dangerouslySetInnerHTML={{__html: require('@site/static/img/generated/icon-placement.svg2')}}></div>

:::info
Icons can be positioned with the `near` keyword [introduced later](/tour/positions#label-and-icon-positioning).
:::

## Add `shape: image` for standalone icon shapes

```d2
Expand All @@ -83,3 +87,4 @@ server -> github
```

<div className="embedSVG" dangerouslySetInnerHTML={{__html: require('@site/static/img/generated/icons-image.svg2')}}></div>

40 changes: 40 additions & 0 deletions docs/tour/positions.md
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,46 @@ Server.Online Model Server

<div className="embedSVG" dangerouslySetInnerHTML={{__html: require('@site/static/img/generated/near-explanation.svg2')}}></div>

## Label and icon positioning

The `near` can be nested to `label` and `icon` to specify their positions.

```d2
direction: right
x -> y
x: worker {
label.near: top-center
icon: https://icons.terrastruct.com/essentials%2F005-programmer.svg
icon.near: outside-top-right
}
y: profits {
label.near: bottom-right
icon: https://icons.terrastruct.com/essentials%2Fprofits.svg
icon.near: outside-top-left
}
```

<div className="embedSVG" dangerouslySetInnerHTML={{__html: require('@site/static/img/generated/near-label-icon.svg2')}}></div>

:::info Extra values

When positioning labels and icons, in addition to the values that `near` can take
elsewhere, an `outside-` prefix can be added to specify positioning outside the bounding
box of the shape.

`outside-top-left`, `outside-top-center`, `outside-top-right`,

`outside-left-center`, `outside-right-center`,

`outside-bottom-left`, `outside-bottom-center`, `outside-bottom-right`


Note that `outside-left-center` is a different order than `center-left`.
:::


## Near objects

:::info
Expand Down
10 changes: 7 additions & 3 deletions docs/tour/themes.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,13 @@ into blogs and wikis.

### They apply to special shapes like tables too

<!-- <img width={600} src={require('@site/static/img/screenshots/themes/theme_table_1.png').default} alt="table neutral theme"/> -->
<!-- <img width={600} src={require('@site/static/img/screenshots/themes/theme_table_2.png').default} alt="table mixed berry blue theme"/> -->
<!-- <img width={600} src={require('@site/static/img/screenshots/themes/theme_table_3.png').default} alt="table vanilla nitro cola theme"/> -->
# Rendered with theme "Grape soda"

<div className="embedSVG" dangerouslySetInnerHTML={{__html: require('@site/static/img/generated/theme-table.svg2')}}></div>

# Rendered with theme "Vanilla nitro cola"

<div className="embedSVG" dangerouslySetInnerHTML={{__html: require('@site/static/img/generated/theme-table-2.svg2')}}></div>

## Setting theme on the CLI

Expand Down
14 changes: 14 additions & 0 deletions static/d2/near-label-icon.d2
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
direction: right
x -> y

x: worker {
label.near: top-center
icon: https://icons.terrastruct.com/essentials%2F005-programmer.svg
icon.near: outside-top-right
}

y: profits {
label.near: bottom-right
icon: https://icons.terrastruct.com/essentials%2Fprofits.svg
icon.near: outside-top-left
}
25 changes: 25 additions & 0 deletions static/d2/theme-table-2.d2
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
vars: {
d2-config: {
theme-id: 100
}
}

direction: right

costumes: {
shape: sql_table
id: int {constraint: primary_key}
silliness: int
monster: int
last_updated: timestamp
}

monsters: {
shape: sql_table
id: int {constraint: primary_key}
movie: string
weight: int
last_updated: timestamp
}

costumes.monster -> monsters.id
25 changes: 25 additions & 0 deletions static/d2/theme-table.d2
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
vars: {
d2-config: {
theme-id: 6
}
}

direction: right

costumes: {
shape: sql_table
id: int {constraint: primary_key}
silliness: int
monster: int
last_updated: timestamp
}

monsters: {
shape: sql_table
id: int {constraint: primary_key}
movie: string
weight: int
last_updated: timestamp
}

costumes.monster -> monsters.id
180 changes: 90 additions & 90 deletions static/img/generated/animated.svg2

Large diffs are not rendered by default.

Binary file modified static/img/generated/cat.pdf
Binary file not shown.
182 changes: 91 additions & 91 deletions static/img/generated/chicken.svg2

Large diffs are not rendered by default.

296 changes: 148 additions & 148 deletions static/img/generated/classes-1.svg2

Large diffs are not rendered by default.

302 changes: 151 additions & 151 deletions static/img/generated/classes-2.svg2

Large diffs are not rendered by default.

322 changes: 161 additions & 161 deletions static/img/generated/code-2.svg2

Large diffs are not rendered by default.

328 changes: 164 additions & 164 deletions static/img/generated/code.svg2

Large diffs are not rendered by default.

296 changes: 148 additions & 148 deletions static/img/generated/connections-1.svg2

Large diffs are not rendered by default.

302 changes: 151 additions & 151 deletions static/img/generated/connections-2.svg2

Large diffs are not rendered by default.

302 changes: 151 additions & 151 deletions static/img/generated/connections-3.svg2

Large diffs are not rendered by default.

302 changes: 151 additions & 151 deletions static/img/generated/connections-4.svg2

Large diffs are not rendered by default.

302 changes: 151 additions & 151 deletions static/img/generated/connections-5.svg2

Large diffs are not rendered by default.

302 changes: 151 additions & 151 deletions static/img/generated/connections-reference.svg2

Large diffs are not rendered by default.

332 changes: 166 additions & 166 deletions static/img/generated/containers-1.svg2

Large diffs are not rendered by default.

320 changes: 160 additions & 160 deletions static/img/generated/containers-2.svg2

Large diffs are not rendered by default.

324 changes: 162 additions & 162 deletions static/img/generated/containers-3.svg2

Large diffs are not rendered by default.

320 changes: 160 additions & 160 deletions static/img/generated/containers-underscore.svg2

Large diffs are not rendered by default.

Binary file modified static/img/generated/cult.pptx
Binary file not shown.
290 changes: 145 additions & 145 deletions static/img/generated/dimensions.svg2

Large diffs are not rendered by default.

302 changes: 151 additions & 151 deletions static/img/generated/direction-right.svg2

Large diffs are not rendered by default.

302 changes: 151 additions & 151 deletions static/img/generated/direction-up.svg2

Large diffs are not rendered by default.

296 changes: 148 additions & 148 deletions static/img/generated/grid-2.svg2

Large diffs are not rendered by default.

296 changes: 148 additions & 148 deletions static/img/generated/grid-3.svg2

Large diffs are not rendered by default.

296 changes: 148 additions & 148 deletions static/img/generated/grid-4.svg2

Large diffs are not rendered by default.

182 changes: 91 additions & 91 deletions static/img/generated/grid-column-dominant.svg2

Large diffs are not rendered by default.

756 changes: 378 additions & 378 deletions static/img/generated/grid-connected.svg2

Large diffs are not rendered by default.

296 changes: 148 additions & 148 deletions static/img/generated/grid-dimensions.svg2

Large diffs are not rendered by default.

296 changes: 148 additions & 148 deletions static/img/generated/grid-fill.svg2

Large diffs are not rendered by default.

296 changes: 148 additions & 148 deletions static/img/generated/grid-nested-grid.svg2

Large diffs are not rendered by default.

182 changes: 91 additions & 91 deletions static/img/generated/grid-row-dominant.svg2

Large diffs are not rendered by default.

296 changes: 148 additions & 148 deletions static/img/generated/grid.svg2

Large diffs are not rendered by default.

302 changes: 151 additions & 151 deletions static/img/generated/hello-world.svg2

Large diffs are not rendered by default.

312 changes: 156 additions & 156 deletions static/img/generated/icon-placement.svg2

Large diffs are not rendered by default.

298 changes: 149 additions & 149 deletions static/img/generated/icons-1.svg2

Large diffs are not rendered by default.

296 changes: 148 additions & 148 deletions static/img/generated/icons-image.svg2

Large diffs are not rendered by default.

326 changes: 163 additions & 163 deletions static/img/generated/imports-classes-main.svg2

Large diffs are not rendered by default.

306 changes: 153 additions & 153 deletions static/img/generated/imports-mv-access-view.svg2

Large diffs are not rendered by default.

304 changes: 152 additions & 152 deletions static/img/generated/imports-mv-models.svg2

Large diffs are not rendered by default.

314 changes: 157 additions & 157 deletions static/img/generated/imports-mv-ssh-view.svg2

Large diffs are not rendered by default.

296 changes: 148 additions & 148 deletions static/img/generated/imports-nested-data.svg2

Large diffs are not rendered by default.

296 changes: 148 additions & 148 deletions static/img/generated/imports-nested-serviceB/data.svg2

Large diffs are not rendered by default.

316 changes: 158 additions & 158 deletions static/img/generated/imports-nested-serviceB/index.svg2

Large diffs are not rendered by default.

Binary file modified static/img/generated/imports-nested.pdf
Binary file not shown.
296 changes: 148 additions & 148 deletions static/img/generated/imports-normal-x.svg2

Large diffs are not rendered by default.

308 changes: 154 additions & 154 deletions static/img/generated/imports-normal.svg2

Large diffs are not rendered by default.

314 changes: 157 additions & 157 deletions static/img/generated/imports-targeted-people.svg2

Large diffs are not rendered by default.

310 changes: 155 additions & 155 deletions static/img/generated/imports-targeted.svg2

Large diffs are not rendered by default.

328 changes: 164 additions & 164 deletions static/img/generated/imports-template.svg2

Large diffs are not rendered by default.

302 changes: 151 additions & 151 deletions static/img/generated/imports-vv-history.svg2

Large diffs are not rendered by default.

296 changes: 148 additions & 148 deletions static/img/generated/imports-vv-users-current.svg2

Large diffs are not rendered by default.

296 changes: 148 additions & 148 deletions static/img/generated/imports-vv-users-v0.1.svg2

Large diffs are not rendered by default.

296 changes: 148 additions & 148 deletions static/img/generated/japan.svg2

Large diffs are not rendered by default.

184 changes: 92 additions & 92 deletions static/img/generated/johnwick.svg2

Large diffs are not rendered by default.

296 changes: 148 additions & 148 deletions static/img/generated/language.svg2

Large diffs are not rendered by default.

732 changes: 366 additions & 366 deletions static/img/generated/latex.svg2

Large diffs are not rendered by default.

306 changes: 153 additions & 153 deletions static/img/generated/links.svg2

Large diffs are not rendered by default.

Binary file modified static/img/generated/lotr.pdf
Binary file not shown.
700 changes: 350 additions & 350 deletions static/img/generated/markdown.svg2

Large diffs are not rendered by default.

290 changes: 145 additions & 145 deletions static/img/generated/multiple-classes.svg2

Large diffs are not rendered by default.

706 changes: 353 additions & 353 deletions static/img/generated/near-constant.svg2

Large diffs are not rendered by default.

710 changes: 355 additions & 355 deletions static/img/generated/near-container.svg2

Large diffs are not rendered by default.

718 changes: 359 additions & 359 deletions static/img/generated/near-explanation.svg2

Large diffs are not rendered by default.

168 changes: 168 additions & 0 deletions static/img/generated/near-label-icon.svg2

Large diffs are not rendered by default.

704 changes: 352 additions & 352 deletions static/img/generated/non-markdown-text.svg2

Large diffs are not rendered by default.

296 changes: 148 additions & 148 deletions static/img/generated/ordered-classes.svg2

Large diffs are not rendered by default.

296 changes: 148 additions & 148 deletions static/img/generated/overrides-1.svg2

Large diffs are not rendered by default.

312 changes: 156 additions & 156 deletions static/img/generated/overrides-2.svg2

Large diffs are not rendered by default.

296 changes: 148 additions & 148 deletions static/img/generated/pill.svg2

Large diffs are not rendered by default.

180 changes: 90 additions & 90 deletions static/img/generated/pizza.svg2

Large diffs are not rendered by default.

302 changes: 151 additions & 151 deletions static/img/generated/sequence-diagrams-1.svg2

Large diffs are not rendered by default.

346 changes: 173 additions & 173 deletions static/img/generated/sequence-diagrams-2.svg2

Large diffs are not rendered by default.

296 changes: 148 additions & 148 deletions static/img/generated/sequence-diagrams-3.svg2

Large diffs are not rendered by default.

302 changes: 151 additions & 151 deletions static/img/generated/sequence-diagrams-4.svg2

Large diffs are not rendered by default.

302 changes: 151 additions & 151 deletions static/img/generated/sequence-diagrams-group.svg2

Large diffs are not rendered by default.

302 changes: 151 additions & 151 deletions static/img/generated/sequence-diagrams-lifeline.svg2

Large diffs are not rendered by default.

302 changes: 151 additions & 151 deletions static/img/generated/sequence-diagrams-note.svg2

Large diffs are not rendered by default.

302 changes: 151 additions & 151 deletions static/img/generated/sequence-diagrams-scope.svg2

Large diffs are not rendered by default.

302 changes: 151 additions & 151 deletions static/img/generated/sequence-diagrams-self.svg2

Large diffs are not rendered by default.

296 changes: 148 additions & 148 deletions static/img/generated/shapes-1.svg2

Large diffs are not rendered by default.

296 changes: 148 additions & 148 deletions static/img/generated/shapes-2.svg2

Large diffs are not rendered by default.

332 changes: 166 additions & 166 deletions static/img/generated/shapes-3.svg2

Large diffs are not rendered by default.

296 changes: 148 additions & 148 deletions static/img/generated/strings-1.svg2

Large diffs are not rendered by default.

296 changes: 148 additions & 148 deletions static/img/generated/strings-2.svg2

Large diffs are not rendered by default.

310 changes: 155 additions & 155 deletions static/img/generated/style-classes-1.svg2

Large diffs are not rendered by default.

296 changes: 148 additions & 148 deletions static/img/generated/style-classes-2.svg2

Large diffs are not rendered by default.

310 changes: 155 additions & 155 deletions static/img/generated/styles-3d.svg2

Large diffs are not rendered by default.

302 changes: 151 additions & 151 deletions static/img/generated/styles-animated.svg2

Large diffs are not rendered by default.

302 changes: 151 additions & 151 deletions static/img/generated/styles-base.svg2

Large diffs are not rendered by default.

302 changes: 151 additions & 151 deletions static/img/generated/styles-border-radius.svg2

Large diffs are not rendered by default.

302 changes: 151 additions & 151 deletions static/img/generated/styles-double-border.svg2

Large diffs are not rendered by default.

304 changes: 152 additions & 152 deletions static/img/generated/styles-fill-pattern.svg2

Large diffs are not rendered by default.

308 changes: 154 additions & 154 deletions static/img/generated/styles-fill-transparent.svg2

Large diffs are not rendered by default.

302 changes: 151 additions & 151 deletions static/img/generated/styles-fill.svg2

Large diffs are not rendered by default.

302 changes: 151 additions & 151 deletions static/img/generated/styles-font-color.svg2

Large diffs are not rendered by default.

302 changes: 151 additions & 151 deletions static/img/generated/styles-font-size.svg2

Large diffs are not rendered by default.

309 changes: 158 additions & 151 deletions static/img/generated/styles-font.svg2

Large diffs are not rendered by default.

308 changes: 154 additions & 154 deletions static/img/generated/styles-multiple.svg2

Large diffs are not rendered by default.

302 changes: 151 additions & 151 deletions static/img/generated/styles-opacity.svg2

Large diffs are not rendered by default.

302 changes: 151 additions & 151 deletions static/img/generated/styles-root.svg2

Large diffs are not rendered by default.

304 changes: 152 additions & 152 deletions static/img/generated/styles-shadow.svg2

Large diffs are not rendered by default.

302 changes: 151 additions & 151 deletions static/img/generated/styles-stroke-dash.svg2

Large diffs are not rendered by default.

302 changes: 151 additions & 151 deletions static/img/generated/styles-stroke-width.svg2

Large diffs are not rendered by default.

302 changes: 151 additions & 151 deletions static/img/generated/styles-stroke.svg2

Large diffs are not rendered by default.

302 changes: 151 additions & 151 deletions static/img/generated/styles-table-color.svg2

Large diffs are not rendered by default.

302 changes: 151 additions & 151 deletions static/img/generated/styles-table-fill.svg2

Large diffs are not rendered by default.

302 changes: 151 additions & 151 deletions static/img/generated/styles-table-stroke.svg2

Large diffs are not rendered by default.

302 changes: 151 additions & 151 deletions static/img/generated/styles-text-decoration.svg2

Large diffs are not rendered by default.

302 changes: 151 additions & 151 deletions static/img/generated/styles-text-transform.svg2

Large diffs are not rendered by default.

296 changes: 148 additions & 148 deletions static/img/generated/table.svg2

Large diffs are not rendered by default.

296 changes: 148 additions & 148 deletions static/img/generated/tables-1.svg2

Large diffs are not rendered by default.

296 changes: 148 additions & 148 deletions static/img/generated/tables-2.svg2

Large diffs are not rendered by default.

308 changes: 154 additions & 154 deletions static/img/generated/tables-3.svg2

Large diffs are not rendered by default.

180 changes: 90 additions & 90 deletions static/img/generated/tax.svg2

Large diffs are not rendered by default.

313 changes: 160 additions & 153 deletions static/img/generated/terminal-theme.svg2

Large diffs are not rendered by default.

718 changes: 359 additions & 359 deletions static/img/generated/text-2.svg2

Large diffs are not rendered by default.

167 changes: 167 additions & 0 deletions static/img/generated/theme-table-2.svg2

Large diffs are not rendered by default.

167 changes: 167 additions & 0 deletions static/img/generated/theme-table.svg2

Large diffs are not rendered by default.

Binary file modified static/img/generated/tiktok.pdf
Binary file not shown.
300 changes: 150 additions & 150 deletions static/img/generated/tooltip.svg2

Large diffs are not rendered by default.

706 changes: 353 additions & 353 deletions static/img/generated/unicode.svg2

Large diffs are not rendered by default.

298 changes: 149 additions & 149 deletions static/img/generated/vars-config.svg2

Large diffs are not rendered by default.

302 changes: 151 additions & 151 deletions static/img/generated/vars-escaped.svg2

Large diffs are not rendered by default.

296 changes: 148 additions & 148 deletions static/img/generated/vars-intro.svg2

Large diffs are not rendered by default.

296 changes: 148 additions & 148 deletions static/img/generated/vars-nested.svg2

Large diffs are not rendered by default.

308 changes: 154 additions & 154 deletions static/img/generated/vars-scoped.svg2

Large diffs are not rendered by default.

308 changes: 154 additions & 154 deletions static/img/generated/vars-spread.svg2

Large diffs are not rendered by default.

Binary file modified static/img/generated/wcc.pptx
Binary file not shown.
Binary file removed static/img/screenshots/themes/theme_table_1.png
Binary file not shown.
Binary file removed static/img/screenshots/themes/theme_table_2.png
Binary file not shown.
Binary file removed static/img/screenshots/themes/theme_table_3.png
Binary file not shown.

0 comments on commit 151f0c2

Please sign in to comment.