1
0
Fork 0

fix(dev): One-liner admonitions

This commit is contained in:
Joost De Cock 2024-09-29 07:14:59 +02:00
parent a6d656c19e
commit da41cc0fc9
60 changed files with 860 additions and 659 deletions

View file

@ -15,7 +15,9 @@ Point point.addCircle(
)
```
:::tipThis method is chainable as it returns the `Point` object:::
:::tip
This method is chainable as it returns the `Point` object
:::
## Example
@ -26,18 +28,20 @@ Point point.addCircle(
.addCircle(3, 'lining dashed')
.addCircle(7, 'mark dashed')
points.b = new Point(50, 10)
.addCircle(1, 'interfacing')
.addCircle(3, 'fabric')
.addCircle(5, 'lining')
.addCircle(7, 'mark')
.addCircle(9, 'note')
points.b = new Point(50, 10)
.addCircle(1, 'interfacing')
.addCircle(3, 'fabric')
.addCircle(5, 'lining')
.addCircle(7, 'mark')
.addCircle(9, 'note')
points.c = new Point(70, 10)
.addCircle(3, 'interfacing')
.addCircle(7, 'mark lashed')
points.c = new Point(70, 10)
.addCircle(3, 'interfacing')
.addCircle(7, 'mark lashed')
return part
return part
}
```
</Example>
```

View file

@ -15,7 +15,9 @@ Point point.addText(
)
```
:::tipThis method is chainable as it returns the `Point` object:::
:::tip
This method is chainable as it returns the `Point` object
:::
## Example
@ -26,18 +28,19 @@ Point point.addText(
.addText('FreeSewing')
.addText('rocks')
// Avoid the text getting cropped
paths.hidden = new Path()
.move(points.anchor)
.line(points.anchor.shift(0, 80))
.addClass('hidden')
// Avoid the text getting cropped
paths.hidden = new Path()
.move(points.anchor)
.line(points.anchor.shift(0, 80))
.addClass('hidden')
return part
return part
}
```
</Example>
## Notes
Remember to [use translation keys, not text](/guides/best-practices#use-translation-keys)
```

View file

@ -18,8 +18,9 @@ Point point.attr(
If the third parameter is set to `true` it will call [`this.attributes.set()`](/reference/api/attributes/set/) instead, thereby overwriting the value of the attribute.
:::tipThis method is chainable as it returns the `Point` object:::
:::tip
This method is chainable as it returns the `Point` object
:::
## Example
@ -27,18 +28,19 @@ If the third parameter is set to `true` it will call [`this.attributes.set()`](/
```js
({ Point, points, Path, paths, part }) => {
points.anchor = new Point(100, 25)
.attr('data-text', 'FreeSewing')
.attr('data-text', 'rocks')
points.anchor = new Point(100, 25)
.attr('data-text', 'FreeSewing')
.attr('data-text', 'rocks')
// Avoid the text getting cropped
paths.hidden = new Path()
.move(points.anchor)
.line(points.anchor.shift(0, 80))
.addClass('hidden')
// Avoid the text getting cropped
paths.hidden = new Path()
.move(points.anchor)
.line(points.anchor.shift(0, 80))
.addClass('hidden')
return part
return part
}
```
</Example>
@ -46,3 +48,4 @@ If the third parameter is set to `true` it will call [`this.attributes.set()`](/
See [Using Attributes](/howtos/code/attributes)
for information about custom Attributes that can be used with Points.
```

View file

@ -11,7 +11,9 @@ attributes as the original point.
Point point.clone()
```
:::tipThis method is chainable as it returns the `Point` object:::
:::tip
This method is chainable as it returns the `Point` object
:::
## Example
@ -19,21 +21,22 @@ Point point.clone()
```js
({ Point, points, Path, paths, Snippet, snippets, part }) => {
points.A = new Point(25, 25)
.setText("Point A", "text-xl")
.attr("data-text-fill-opacity", "0.5")
points.B = points.A.clone().setText("Point B")
points.A = new Point(25, 25)
.setText("Point A", "text-xl")
.attr("data-text-fill-opacity", "0.5")
points.B = points.A.clone().setText("Point B")
snippets.x = new Snippet("notch", points.A)
snippets.x = new Snippet("notch", points.A)
// Avoid the text getting cropped
paths.hidden = new Path()
.move(new Point(20,10))
.move(new Point(75,30))
.addClass('hidden')
// Avoid the text getting cropped
paths.hidden = new Path()
.move(new Point(20,10))
.move(new Point(75,30))
.addClass('hidden')
return part
return part
}
```
</Example>
@ -43,3 +46,4 @@ Point point.clone()
The [`Point.copy()`](/reference/api/point/copy/) method will only copy the
point's coordinates, whereas this `Point.clone()` method will also copy its
attributes.
```

View file

@ -21,7 +21,9 @@ Point point.setCircle(
)
```
:::tipThis method is chainable as it returns the `Point` object:::
:::tip
This method is chainable as it returns the `Point` object
:::
## Example
@ -29,22 +31,24 @@ Point point.setCircle(
```js
({ Point, points, part }) => {
points.a = new Point(30, 10)
.setCircle(3, 'lining dashed')
.setCircle(7, 'mark dashed')
points.a = new Point(30, 10)
.setCircle(3, 'lining dashed')
.setCircle(7, 'mark dashed')
points.b = new Point(50, 10)
.setCircle(1, 'interfacing')
.setCircle(3, 'fabric')
.setCircle(5, 'lining')
.setCircle(7, 'mark')
.setCircle(9, 'note')
points.b = new Point(50, 10)
.setCircle(1, 'interfacing')
.setCircle(3, 'fabric')
.setCircle(5, 'lining')
.setCircle(7, 'mark')
.setCircle(9, 'note')
points.c = new Point(70, 10)
.setCircle(3, 'interfacing')
.setCircle(7, 'mark lashed')
points.c = new Point(70, 10)
.setCircle(3, 'interfacing')
.setCircle(7, 'mark lashed')
return part
return part
}
```
</Example>
```

View file

@ -15,7 +15,9 @@ Point point.setText(
)
```
:::tipThis method is chainable as it returns the `Point` object:::
:::tip
This method is chainable as it returns the `Point` object
:::
## Example
@ -23,21 +25,23 @@ Point point.setText(
```js
({ Point, points, Path, paths, part }) => {
points.anchor = new Point(100, 25)
.setText('FreeSewing')
.setText('rocks')
points.anchor = new Point(100, 25)
.setText('FreeSewing')
.setText('rocks')
// Avoid the text getting cropped
paths.hidden = new Path()
.move(points.anchor)
.line(points.anchor.shift(0, 80))
.addClass('hidden')
// Avoid the text getting cropped
paths.hidden = new Path()
.move(points.anchor)
.line(points.anchor.shift(0, 80))
.addClass('hidden')
return part
return part
}
```
</Example>
## Notes
Remember to [use translation keys, not text](/guides/best-practices#use-translation-keys)
```