1
0
Fork 0

chore(markdown): Updated snippets docs for v3

This commit is contained in:
Joost De Cock 2022-10-02 18:04:20 +02:00
parent 15b6ed0419
commit 4b3ceb2995
10 changed files with 193 additions and 76 deletions

View file

@ -7,8 +7,21 @@ need an alternative to the default `notch`.
It is provided by [plugin-notches](/reference/plugins/notches/). It is provided by [plugin-notches](/reference/plugins/notches/).
```js ## Example
snippets.demo = new Snippet('bnotch', points.anchor)
``` <Example caption="An example of the bnotch snippet">
```js
({ Point, Path, paths, Snippet, snippets, part }) => {
snippets.demo = new Snippet('bnotch', new Point(0,0))
// Prevent clipping
paths.diag = new Path()
.move(new Point(-50,-4))
.move(new Point(50,4))
return part
}
```
</Example>
<Example part="snippets_bnotch">An example of the bnotch snippet</Example>

View file

@ -2,13 +2,25 @@
title: button title: button
--- ---
The `button` snippet is used to mark button placement and is The `button` snippet is used to mark button placement.
provided by [plugin-buttons](/reference/plugins/buttons/).
It is provided by [plugin-buttons](/reference/plugins/buttons/).
## Example
<Example caption="An example of the button snippet">
```js ```js
snippets.demo = new Snippet('button', points.anchor) ({ Point, Path, paths, Snippet, snippets, part }) => {
```
<Example part="snippets_button"> snippets.demo = new Snippet('button', new Point(0,0))
An example of the button snippet
// Prevent clipping
paths.diag = new Path()
.move(new Point(-50,-4))
.move(new Point(50,4))
return part
}
```
</Example> </Example>

View file

@ -2,25 +2,41 @@
title: buttonhole-end title: buttonhole-end
--- ---
The `buttonhole-end` snippet is used to mark buttonhole placement and is The `buttonhole-end` snippet is used to mark buttonhole placement.
provided by [plugin-buttons](/reference/plugins/buttons/). This particular snippet places the buttonhole's end on its
anchor point.
It is provided by [plugin-buttons](/reference/plugins/buttons/).
## Example
<Example caption="An example of the buttonhole-end snippet">
```js ```js
snippets.demo = new Snippet('buttonhole-end', points.anchor) ({ Point, Path, paths, Snippet, snippets, part }) => {
```
<Example part="snippets_buttonhole_end"> snippets.demo = new Snippet('buttonhole-end', new Point(0,0))
An example of the buttonhole-end snippet
// Show alignment
paths.anchor = new Path()
.move(new Point(-5, 0))
.line(new Point(5, 0))
.addClass('dotted note stroke-sm')
// Prevent clipping
paths.diag = new Path()
.move(new Point(-50,-4))
.move(new Point(50,4))
return part
}
```
</Example> </Example>
<Note> ## Notes
##### Aligning your buttons and buttonholes
We provide three buttonhole snippets with a different alignment: We provide three buttonhole snippets with a different alignment:
- [buttonhole](/reference/api/snippets/buttonhole/): Anchor point is the middle of the buttonhole - [buttonhole](/reference/snippets/buttonhole/): Anchor point is the middle of the buttonhole
- [buttonhole-start](/reference/api/snippets/buttonhole-start/): Anchor point is the start of the buttonhole - [buttonhole-start](/reference/snippets/buttonhole-start/): Anchor point is the start of the buttonhole
- [buttonhole-end](/reference/api/snippets/buttonhole-end/): Anchor point is the end of the buttonhole - [buttonhole-end](/reference/snippets/buttonhole-end/): Anchor point is the end of the buttonhole
</Note>

View file

@ -2,25 +2,41 @@
title: buttonhole-start title: buttonhole-start
--- ---
The `buttonhole-start` snippet is used to mark buttonhole placement and is The `buttonhole-start` snippet is used to mark buttonhole placement.
provided by [plugin-buttons](/reference/plugins/buttons/). This particular snippet places the buttonhole's start on its
anchor point.
It is provided by [plugin-buttons](/reference/plugins/buttons/).
## Example
<Example caption="An example of the buttonhole-start snippet">
```js ```js
snippets.demo = new Snippet('buttonhole-start', points.anchor) ({ Point, Path, paths, Snippet, snippets, part }) => {
```
<Example part="snippets_buttonhole_start"> snippets.demo = new Snippet('buttonhole-start', new Point(0,0))
An example of the buttonhole-start snippet
// Show alignment
paths.anchor = new Path()
.move(new Point(-5, 0))
.line(new Point(5, 0))
.addClass('dotted note stroke-sm')
// Prevent clipping
paths.diag = new Path()
.move(new Point(-50,-4))
.move(new Point(50,4))
return part
}
```
</Example> </Example>
<Note> ## Notes
##### Aligning your buttons and buttonholes
We provide three buttonhole snippets with a different alignment: We provide three buttonhole snippets with a different alignment:
- [buttonhole](/reference/api/snippets/buttonhole/): Anchor point is the middle of the buttonhole - [buttonhole](/reference/snippets/buttonhole/): Anchor point is the middle of the buttonhole
- [buttonhole-start](/reference/api/snippets/buttonhole-start/): Anchor point is the start of the buttonhole - [buttonhole-start](/reference/snippets/buttonhole-start/): Anchor point is the start of the buttonhole
- [buttonhole-end](/reference/api/snippets/buttonhole-end/): Anchor point is the end of the buttonhole - [buttonhole-end](/reference/snippets/buttonhole-end/): Anchor point is the end of the buttonhole
</Note>

View file

@ -2,25 +2,41 @@
title: buttonhole title: buttonhole
--- ---
The `buttonhole` snippet is used to mark buttonhole placement and is The `buttonhole` snippet is used to mark buttonhole placement.
provided by [plugin-buttons](/reference/plugins/buttons/). This particular snippet places the buttonhole centrally on its
anchor point.
It is provided by [plugin-buttons](/reference/plugins/buttons/).
## Example
<Example caption="An example of the buttonhole snippet">
```js ```js
snippets.demo = new Snippet('buttonhole', points.anchor) ({ Point, Path, paths, Snippet, snippets, part }) => {
```
<Example part="snippets_buttonhole"> snippets.demo = new Snippet('buttonhole', new Point(0,0))
An example of the buttonhole snippet
// Show alignment
paths.anchor = new Path()
.move(new Point(-5, 0))
.line(new Point(5, 0))
.addClass('dotted note stroke-sm')
// Prevent clipping
paths.diag = new Path()
.move(new Point(-50,-4))
.move(new Point(50,4))
return part
}
```
</Example> </Example>
<Note> ## Notes
##### Aligning your buttons and buttonholes
We provide three buttonhole snippets with a different alignment: We provide three buttonhole snippets with a different alignment:
- [buttonhole](/reference/api/snippets/buttonhole/): Anchor point is the middle of the buttonhole - [buttonhole](/reference/snippets/buttonhole/): Anchor point is the middle of the buttonhole
- [buttonhole-start](/reference/api/snippets/buttonhole-start/): Anchor point is the start of the buttonhole - [buttonhole-start](/reference/snippets/buttonhole-start/): Anchor point is the start of the buttonhole
- [buttonhole-end](/reference/api/snippets/buttonhole-end/): Anchor point is the end of the buttonhole - [buttonhole-end](/reference/snippets/buttonhole-end/): Anchor point is the end of the buttonhole
</Note>

View file

@ -1,9 +1,8 @@
--- ---
title: Snippets title: Snippets
for: developers
about: Complete list of all the available snippets
--- ---
Snippets are provided by plugins. Follow the links below for more info on and an example of a specific snippet: A Snippet is a reuseable bit of markup for your pattern. They are provided by
plugins. Below is an overview of all the different snippets we maintain.
<ReadMore list /> <ReadMore list />

View file

@ -2,13 +2,25 @@
title: logo title: logo
--- ---
The `logo` snippet inserts the FreeSewing logo. It is The `logo` snippet inserts the FreeSewing logo.
provided by [plugin-logo](/reference/plugins/logo/).
It is provided by [plugin-logo](/reference/plugins/logo/).
## Example
<Example caption="An example of the logo snippet">
```js ```js
snippets.demo = new Snippet('logo', points.anchor) ({ Point, Path, paths, Snippet, snippets, part }) => {
```
<Example part="snippets_logo"> snippets.demo = new Snippet('logo', new Point(0,0))
An example of the logo snippet
// Prevent clipping
paths.diag = new Path()
.move(new Point(-100,-40))
.move(new Point(100,20))
return part
}
```
</Example> </Example>

View file

@ -2,13 +2,25 @@
title: notch title: notch
--- ---
The `notch` snippet is intended for notches and is The `notch` snippet is intended for notches.
provided by [plugin-notches](/reference/plugins/notches/).
It is provided by [plugin-notches](/reference/plugins/notches/).
## Example
<Example caption="An example of the notch snippet">
```js ```js
snippets.demo = new Snippet('bnotch', points.anchor) ({ Point, Path, paths, Snippet, snippets, part }) => {
```
<Example part="snippets_notch"> snippets.demo = new Snippet('notch', new Point(0,0))
An example of the notch snippet
// Prevent clipping
paths.diag = new Path()
.move(new Point(-50,-4))
.move(new Point(50,4))
return part
}
```
</Example> </Example>

View file

@ -6,10 +6,21 @@ The `snap-socket` snippet is used to mark the socket part of a snap button.
It is provided by [plugin-buttons](/reference/plugins/buttons/). It is provided by [plugin-buttons](/reference/plugins/buttons/).
```js ## Example
snippets.demo = new Snippet('snap-socket', points.anchor)
```
<Example part="snippets_snapsocket"> <Example caption="An example of the snap-socket snippet">
An example of the snap-socket snippet ```js
({ Point, Path, paths, Snippet, snippets, part }) => {
snippets.demo = new Snippet('snap-socket', new Point(0,0))
// Prevent clipping
paths.diag = new Path()
.move(new Point(-50,-4))
.move(new Point(50,4))
return part
}
```
</Example> </Example>

View file

@ -5,11 +5,21 @@ title: snap-stud
The `snap-stud` snippet is used to mark the stud part of a snap button. The `snap-stud` snippet is used to mark the stud part of a snap button.
It is provided by [plugin-buttons](/reference/plugins/buttons/). It is provided by [plugin-buttons](/reference/plugins/buttons/).
## Example
<Example caption="An example of the snap-stud snippet">
```js ```js
snippets.demo = new Snippet('snap-stud', points.anchor) ({ Point, Path, paths, Snippet, snippets, part }) => {
```
<Example part="snippets_snapstud"> snippets.demo = new Snippet('snap-stud', new Point(0,0))
An example of the snap-stud snippet
// Prevent clipping
paths.diag = new Path()
.move(new Point(-50,-4))
.move(new Point(50,4))
return part
}
```
</Example> </Example>