1
0
Fork 0

Revert "chore: Linting for markdown and js"

This reverts commit 1c92e0f655.
This commit is contained in:
joostdecock 2021-10-17 18:26:00 +02:00
parent 994874fa72
commit cba1ab19c8
6627 changed files with 25791 additions and 24211 deletions

View file

@ -1,15 +1,15 @@
***
---
title: Accessing measurements
for: developers
about: Shows you how to access user measurements from inside your pattern
-------------------------------------------------------------------------
---
Measurements are stored in `pattern.settings.measurements`.
You can pull them out of there with
You can pull them out of there with
the [shorthand](/howtos/code/shorthand/) call:
```js
const { measurements, options } = part.shorthand()

View file

@ -1,17 +1,18 @@
***
---
title: Accessing user options
for: developers
about: Shows you how to access user options from inside your pattern
--------------------------------------------------------------------
---
Options are stored in `pattern.settings.options`.
You can pull them out of there with
You can pull them out of there with
the [shorthand](/howtos/code/shorthand/) call:
```js
const { measurements, options } = part.shorthand()
let sleeveBonus = measurements.shoulderToWrist * (1 + options.sleeveLengthBonus);
```

View file

@ -1,19 +1,18 @@
***
---
title: Add instructions to your design
for: developers
about: While documentation is good, sometimes you want to add some instructions to your design itself
-----------------------------------------------------------------------------------------------------
---
<Note>
##### See this example in our source code
* [packages/jaeger/src/front.js](https://github.com/freesewing/freesewing/blob/38d101b0415a4cbf3f9f86e006bd8cb7c43c703b/packages/jaeger/src/front.js#L411)
- [packages/jaeger/src/front.js](https://github.com/freesewing/freesewing/blob/38d101b0415a4cbf3f9f86e006bd8cb7c43c703b/packages/jaeger/src/front.js#L411)
</Note>
Adding instructions to your pattern is *just* a matter of adding text.
Adding instructions to your pattern is _just_ a matter of adding text.
The tricky part is to make sure your text can be translated.
Below is a rather involved example from Aaron:

View file

@ -1,11 +1,10 @@
***
---
title: Adding pattern parts
for: developers
about: Shows you how to add new parts to your pattern
-----------------------------------------------------
---
Since the patterns parts are listed
Since the patterns parts are listed
in [the configuration file](/reference/config/), freesewing knows about
all the parts that belong to your pattern.

View file

@ -1,12 +1,11 @@
***
---
title: Adding paths
for: developers
icon: pattern
about: Shows you how to add paths to your pattern
-------------------------------------------------
---
After using the [shorthand](/howtos/code/shorthand/) call,
After using the [shorthand](/howtos/code/shorthand/) call,
`Path` contains the path constructor, while `paths` is a reference to `part.paths`,
which is where you should store your paths.

View file

@ -1,11 +1,10 @@
***
---
title: Adding points
for: developers
about: Shows you how to add points to your pattern
--------------------------------------------------
---
After using the [shorthand](/howtos/code/shorthand/) call,
After using the [shorthand](/howtos/code/shorthand/) call,
`Point` contains the point constructor, while `points` is a reference to `part.points`,
which is where you should store your points.

View file

@ -1,11 +1,10 @@
***
---
title: Adding snippets
for: developers
about: Shows you how to add snippets to your pattern
----------------------------------------------------
---
After using the [shorthand](/howtos/code/shorthand/) call,
After using the [shorthand](/howtos/code/shorthand/) call,
`Snippet` contains the path constructor, while `snippets` is a reference to `part.snippets`,
which is where you should store your paths.
@ -17,8 +16,8 @@ snippets.logo = new Snippet('logo', points.logoAnchor);
You can scale and rotate a snippet by setting the `data-scale` and `data-rotate` attributes respectively.
* **data-scale** : Either a single scale factor, or a set of 2 scale factors for the X and Y axis respectively. See [the SVG scale transform](https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/transform#Scale) for details.
* **data-rotate**: A rotation in degrees. The center of the rotation will be the snippet's anchor point
- **data-scale** : Either a single scale factor, or a set of 2 scale factors for the X and Y axis respectively. See [the SVG scale transform](https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/transform#Scale) for details.
- **data-rotate**: A rotation in degrees. The center of the rotation will be the snippet's anchor point
<Tip>
@ -28,4 +27,4 @@ See [Using attributes](/howtos/code/attributes/) for details on how to set attri
Below is an example of the available snippets, and the use of the `data-scale` and `data-rotate` attributes:
\<Example pattern="rendertest" caption="Overview of available snippets" options={{ colors: false, text: false, macros: false, circles: false, widthHd: false }} />
<Example pattern="rendertest" caption="Overview of available snippets" options={{ colors: false, text: false, macros: false, circles: false, widthHd: false }} />

View file

@ -1,14 +1,13 @@
***
---
title: Adding text
for: developers
about: Shows you how to add text to your pattern
------------------------------------------------
---
SVG is pretty great, but its text handling leaves much to be desired.
To abstract away the intricacies of adding text to an SVG document,
FreeSewing lets you add text to patterns by adding it to the attributes
To abstract away the intricacies of adding text to an SVG document,
FreeSewing lets you add text to patterns by adding it to the attributes
of points and paths.
All you have to do is set the `data-text` attribute to the text you want to add to the pattern:
@ -20,8 +19,8 @@ points.anchor = new Point(100, 25)
```
<Example
part="point_attr"
caption="Text inserted in a FreeSewing pattern"
part="point_attr"
caption="Text inserted in a FreeSewing pattern"
/>
<Note>
@ -50,6 +49,6 @@ paths.example = new Path()
```
<Example
part="path_attr"
caption="Text on a path"
part="path_attr"
caption="Text on a path"
/>

View file

@ -1,9 +1,8 @@
***
---
title: Using attributes
for: developers
about: Show s you have to use attributes on points, paths, and snippets
-----------------------------------------------------------------------
---
Points, Paths, and Snippets all have [attributes](/reference/api/attributes/) that you can use to
influence how they behave.
@ -15,7 +14,7 @@ paths.example.attributes.add('class', 'lining dashed');
```
Because it's so common to set attributes, Points, Paths and Snippets all have
the `attr()` helper method.
the `attr()` helper method.
Not only is less more, the method is also *chainable*, which allows you to do this:
@ -34,12 +33,12 @@ The [adding-text](/concepts/adding-text) documentation explains this in detail.
<Tip>
When rendering, FreeSewing will output all your attributes. This gives you the
When rendering, FreeSewing will output all your attributes. This gives you the
possiblity to use any valid attribute to control the appearance.
This is also why we use the *data-* prefix for those attributes that have
special meaning within FreeSewing, such as `data-text`. Adding a `text` attribute
would result in invalid SVG as there is no such thing as a text attribute. But `data-text`
is fine because the `data-` prefix indicates it is a [custom attribute](https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/data-\*).
is fine because the `data-` prefix indicates it is a [custom attribute](https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/data-*).
</Tip>

View file

@ -1,12 +1,11 @@
***
---
title: Creating a new pattern design
for: developers
about: Shows you how to create a new design
-------------------------------------------
---
To create a new pattern, call `new freesewing.Design()`.
It takes your pattern configuration,
It takes your pattern configuration,
and any plugins you want to load as parameters.
For example, if we were creating a new pattern called `Sorcha`:
@ -20,7 +19,7 @@ import config from "../config"
const Sorcha = new freesewing.Design(config, plugins)
```
This method does not return a `Design` object. Instead it returns
This method does not return a `Design` object. Instead it returns
a constructor method for your pattern.
When importing your pattern, it is itself a constructor:
@ -36,7 +35,7 @@ let pattern = new Sorcha()
##### Design() is a super-constructor
Constructors are functions you can call with `new` to create an object.
Constructors are functions you can call with `new` to create an object.
As `freesewing.Design()` returns a constructor, you can think of it
as a super-constructor.

View file

@ -1,9 +1,8 @@
***
---
title: Part dependencies
for: developers
about: Shows you how to create dependencies between pattern parts
-----------------------------------------------------------------
---
Part dependencies are set in the [pattern configuration](/reference/config), and
control the order in which parts are drawn. FreeSewing will make sure
@ -19,7 +18,7 @@ dependencies: {
}
```
This could be from a T-shirt pattern where the `front` and `back` patterns are very similar,
This could be from a T-shirt pattern where the `front` and `back` patterns are very similar,
so they both are inheriting a `base` part.
In addition, the `sleeve` part needs to be drafted after the `front` and `back` part because
in `front` and `back` we store the length of the armhole seam in the [store](/reference/api/store) and
@ -27,9 +26,9 @@ we need that info to fit the sleevecap to the armhole.
Now if a user requests to draft only the `sleeve` part, FreeSewing will still draft:
* First the `base` part
* Then the `front` and `back` parts
* Finally the `sleeve` part
- First the `base` part
- Then the `front` and `back` parts
- Finally the `sleeve` part
but it will only render the `sleeve` part, as that's the only thing the user requested.

View file

@ -1,16 +1,16 @@
***
---
title: Drawing circles
for: developers
about: Shows how you can add circles to your pattern
----------------------------------------------------
---
Real circles are rarely used in pattern design, and they are not part of the SVG path specification,
Real circles are rarely used in pattern design, and they are not part of the SVG path specification,
but rather a different SVG element.
Still, if you want a circle, you can draw one by setting a Point's `data-circle` attribute
Still, if you want a circle, you can draw one by setting a Point's `data-circle` attribute
to the radius of the circle you want to draw.
In addition, all attributes that have a `data-circle-` prefix will apply to the circle, rather than the point.
\<Example pattern="rendertest" caption="Circles" options={{ colors: false, text: false, macros: false, snippets: false, widthHd: false }} />
<Example pattern="rendertest" caption="Circles" options={{ colors: false, text: false, macros: false, snippets: false, widthHd: false }} />

View file

@ -1,6 +1,6 @@
***
## title: Common code challenges
---
title: Common code challenges
---
Below is a list of examples of how to implement common tasks in code:

View file

@ -1,17 +1,16 @@
***
---
title: Create a new design based on an existing design
for: developers
about: Shows how to create a variation of a pre-existing design
---------------------------------------------------------------
---
<Note>
##### See this example in our source code
* [packages/aaron/config/index.js](https://github.com/freesewing/freesewing/blob/72f34101792bda4d8e553c3479daa63cb461f3c5/packages/aaron/config/index.js#L34)
* [packages/aaron/src/index.js](https://github.com/freesewing/freesewing/blob/72f34101792bda4d8e553c3479daa63cb461f3c5/packages/aaron/src/index.js#L2)
* [packages/carlita/src/index.js](https://github.com/freesewing/freesewing/blob/8474477911daed3c383700ab29c9565883f16d66/packages/carlita/src/index.js#L25)
- [packages/aaron/config/index.js](https://github.com/freesewing/freesewing/blob/72f34101792bda4d8e553c3479daa63cb461f3c5/packages/aaron/config/index.js#L34)
- [packages/aaron/src/index.js](https://github.com/freesewing/freesewing/blob/72f34101792bda4d8e553c3479daa63cb461f3c5/packages/aaron/src/index.js#L2)
- [packages/carlita/src/index.js](https://github.com/freesewing/freesewing/blob/8474477911daed3c383700ab29c9565883f16d66/packages/carlita/src/index.js#L25)
</Note>

View file

@ -1,15 +1,14 @@
***
---
title: Hide paths from an inherited part
for: developers
about: When you inherit a part, it comes with a bunch of paths. Here'show to hide them
--------------------------------------------------------------------------------------
---
<Note>
##### See this example in our source code
* [packages/aaron/src/front.js](https://github.com/freesewing/freesewing/blob/develop/packages/aaron/src/front.js#L22)
- [packages/aaron/src/front.js](https://github.com/freesewing/freesewing/blob/develop/packages/aaron/src/front.js#L22)
</Note>

View file

@ -1,14 +1,13 @@
***
---
title: Design inheritance
for: developers
about: Shows how you can use one design as the basis for another
----------------------------------------------------------------
---
If your pattern is based on, or extending, another pattern (some of) your
pattern parts will need to be drafted by the parent pattern.
In such a case, rather than return our own draft method for the part, you
In such a case, rather than return our own draft method for the part, you
should instantiate the parent pattern, and return its part draft method:
```js

View file

@ -1,9 +1,8 @@
***
---
title: Part inheritance
for: developers
about: Shows how you can use one part of your pattern as the basis for another
------------------------------------------------------------------------------
---
Part inheritance within your own pattern is handled via the `inject` settings in
the [pattern configuration](/reference/config/). Here is a simple example:
@ -16,16 +15,16 @@ inject: {
}
```
The `front` and `back` parts will be *injected* with the `base` part. As a result, both
the `front` and `back` parts will be instantiated with a cloned copy of all the points, paths,
The `front` and `back` parts will be *injected* with the `base` part. As a result, both
the `front` and `back` parts will be instantiated with a cloned copy of all the points, paths,
and snippets of the `base` part.
This is a common design pattern where one part builds on another. In our example, we can imagine
a T-shirt pattern where the front and back are rather similar, apart from the neckline.
So rather than repeating ourselves, we draft a `base` part and inject that in the `front` and
So rather than repeating ourselves, we draft a `base` part and inject that in the `front` and
`back` parts.
Using `inject` will cause FreeSewing to always draft the injected part prior to
Using `inject` will cause FreeSewing to always draft the injected part prior to
drafting the part it gets injected to. It will, in other words, influece the draft order.
<Note>

View file

@ -1,16 +1,15 @@
***
---
title: Using macros
for: developers
about: Shows how you can use macros within your pattern
-------------------------------------------------------
---
Macros are a way to facilitate pattern design by bundling a bunch of individual actions
into a little routine.
Macros are provided by [plugins](/reference/plugins/). Here are some examples:
\<Example pattern="rendertest" options={{ colors: false, circles: false, snippets: false, text: false, widthHd: false }}/>
<Example pattern="rendertest" options={{ colors: false, circles: false, snippets: false, text: false, widthHd: false }}/>
Refer to [macro documentation](/reference/api/macro/) for details on how to use macros,
and the [plugins](/reference/plugins/) documentation for info on how to create your

View file

@ -1,18 +1,18 @@
***
---
title: Remove paths from an inherited part
for: developers
about: When you inherit a part, it comes with a bunch of paths. Here'show to remove them
----------------------------------------------------------------------------------------
---
<Note>
##### See this example in our source code
* [packages/carlton/src/back.js](https://github.com/freesewing/freesewing/blob/8474477911daed3c383700ab29c9565883f16d66/packages/carlton/src/back.js#L62)
- [packages/carlton/src/back.js](https://github.com/freesewing/freesewing/blob/8474477911daed3c383700ab29c9565883f16d66/packages/carlton/src/back.js#L62)
</Note>
```js
for (let i in paths) delete paths[i]
```

View file

@ -1,24 +1,24 @@
***
---
title: Share dimensions between pattern parts
for: developers
about: Shows how to share dimensions between similar pattern parts
------------------------------------------------------------------
---
<Note>
##### See this example in our source code
* [packages/aaron/src/shared.js](https://github.com/freesewing/freesewing/blob/develop/packages/aaron/src/shared.js)
* [packages/aaron/src/front.js](https://github.com/freesewing/freesewing/blob/72f34101792bda4d8e553c3479daa63cb461f3c5/packages/aaron/src/front.js#L160)
- [packages/aaron/src/shared.js](https://github.com/freesewing/freesewing/blob/develop/packages/aaron/src/shared.js)
- [packages/aaron/src/front.js](https://github.com/freesewing/freesewing/blob/72f34101792bda4d8e553c3479daa63cb461f3c5/packages/aaron/src/front.js#L160)
</Note>
When you have different pattern parts that look similar -- like the front
and back of a garment -- you may find that there's a lot of dimensions
and back of a garment -- you may find that there's a lot of dimensions
shared between them.
The example below is from Aaron where dimensions are shared between
The example below is from Aaron where dimensions are shared between
the back and front part.
Aaron has a file called `shared.js` that looks like this:
@ -49,7 +49,8 @@ import { dimensions } from './shared'
<Note>
Since our shared dimension method is a so-called *named export* we need to
Since our shared dimension method is a so-called _named export_ we need to
import it with the syntax you see above.
</Note>

View file

@ -1,16 +1,15 @@
***
---
title: Using shorthand
for: developers
about: Shows you how to use our shorthand method and notation
-------------------------------------------------------------
---
The [Part.shorthand()](/reference/api/part/#shorthand) method will become your best friend.
By using [object destructuring](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Destructuring\_assignment#Object\_destructuring) you'll get access to a bunch
By using [object destructuring](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Destructuring_assignment#Object_destructuring) you'll get access to a bunch
of handy variables to make your code more concise and readable.
[Part.shorthand()](/reference/api/part/#shorthand) provides a lot of things, and you typically
[Part.shorthand()](/reference/api/part/#shorthand) provides a lot of things, and you typically
don't need all of them, but here's everything it has to offer:
```js

View file

@ -1,15 +1,14 @@
***
---
title: Sharing data between parts
for: developers
about: Shows how you use the pattern store to share data between parts
----------------------------------------------------------------------
---
Sometimes, you'll want to access data from one part into another part.
For example, you may store the length of the armhole in your front and back parts,
and then read that value when drafting the sleeve so you can verify the sleeve fits the armhole.
For this, you should use the [Store](/reference/api/store/), which is available via
For this, you should use the [Store](/reference/api/store/), which is available via
the [shorthand](/howtos/code/shorthand/) call:
```js

View file

@ -1,19 +1,18 @@
***
---
title: Storing the seam length to use in another part
for: developers
about: Shows how to store a seam length so you can true the seam of another part
--------------------------------------------------------------------------------
---
<Note>
##### See this example in our source code
* [packages/aaron/src/front.js](https://github.com/freesewing/freesewing/blob/develop/packages/aaron/src/front.js#L103)
- [packages/aaron/src/front.js](https://github.com/freesewing/freesewing/blob/develop/packages/aaron/src/front.js#L103)
</Note>
Often when designing patterns, we need to *true a seam* which means to make sure
Often when designing patterns, we need to _true a seam_ which means to make sure
that two parts that need to be joined together are the same distance.
The example below is from Aaron and stores the length of the armhole seam:
@ -28,3 +27,4 @@ The example below is from Aaron and stores the length of the armhole seam:
.length()
)
```