feat: Flat import of markdown repo
This is a flat (without history) import of (some of) the content from our markdown module. We've imported this without history because the repo contains our blog posts and showcases posts content prior to porting them to strapi. Since this contains many images, it would balloon the size of this repo to import the full history. Instead, please refer to the history of the (archived) markdown repo at: https://github.com/freesewing/markdown
This commit is contained in:
parent
1671a896b5
commit
b34a2ee2ed
6132 changed files with 244167 additions and 0 deletions
19
markdown/dev/reference/api/part/copy/en.md
Normal file
19
markdown/dev/reference/api/part/copy/en.md
Normal file
|
@ -0,0 +1,19 @@
|
|||
---
|
||||
title: copy()
|
||||
---
|
||||
|
||||
```js
|
||||
Part part.copy(Part original)
|
||||
```
|
||||
|
||||
This will copy the points, paths, and snippets from a part you pass into it.
|
||||
|
||||
<Note>
|
||||
|
||||
This method is used internally, you are unlikely to need this.
|
||||
|
||||
If you want one part to build on another, you should set
|
||||
up [part inheritance](/advanced/inject) in your pattern's [configuration](../config) file.
|
||||
|
||||
</Note>
|
||||
|
17
markdown/dev/reference/api/part/en.md
Normal file
17
markdown/dev/reference/api/part/en.md
Normal file
|
@ -0,0 +1,17 @@
|
|||
---
|
||||
title: Part
|
||||
order: 20
|
||||
---
|
||||
|
||||
Part objects hold the actual information, and together they make up your pattern.
|
||||
|
||||
Each Part object comes with the following properties:
|
||||
|
||||
- `paths` : A plain object to store your paths in
|
||||
- `points` : A plain object to store your points in
|
||||
- `render` : A flag that controls whether to include the part in the render output
|
||||
- `snippets` : A plain object to store your snippets in
|
||||
|
||||
In addition, a Part object exposes the following methods:
|
||||
|
||||
<ReadMore list />
|
13
markdown/dev/reference/api/part/getid/en.md
Normal file
13
markdown/dev/reference/api/part/getid/en.md
Normal file
|
@ -0,0 +1,13 @@
|
|||
---
|
||||
title: getId()
|
||||
---
|
||||
|
||||
```js
|
||||
int part.getId(prefix='')
|
||||
```
|
||||
Returns a integer as an available ID that you can use as for Points/Paths/Snippets.
|
||||
|
||||
Takes an options `prefix` to prefix the ID with.
|
||||
|
||||
This is typically used when adding points programmatically.
|
||||
|
20
markdown/dev/reference/api/part/raise/debug/en.md
Normal file
20
markdown/dev/reference/api/part/raise/debug/en.md
Normal file
|
@ -0,0 +1,20 @@
|
|||
---
|
||||
title: raise.debug()
|
||||
---
|
||||
|
||||
```js
|
||||
raise.debug(data)
|
||||
```
|
||||
|
||||
The `raise.debug()` method adds an event of type `debug` to the pattern.
|
||||
|
||||
What happens with this data is entirely up to the frontend developer.
|
||||
As such, data can by anything you like. A string is common, but you
|
||||
can also add arrays or objects with data or information you want to
|
||||
use in your frontend.
|
||||
|
||||
<Tip>
|
||||
|
||||
All raise methods are available via [the shorthand method](/reference/api/part/shorthand)
|
||||
|
||||
</Tip>
|
55
markdown/dev/reference/api/part/raise/en.md
Normal file
55
markdown/dev/reference/api/part/raise/en.md
Normal file
|
@ -0,0 +1,55 @@
|
|||
---
|
||||
title: raise methods
|
||||
---
|
||||
|
||||
The various `raise` methods are used to bring information to the attention
|
||||
of the user, or developer.
|
||||
|
||||
There are four different types of information with their own method:
|
||||
|
||||
<ReadMore list />
|
||||
|
||||
Practically, the pattern object has an `events` property as such:
|
||||
|
||||
```js
|
||||
events: {
|
||||
debug: [],
|
||||
error: [],
|
||||
info: [],
|
||||
warning: []
|
||||
}
|
||||
```
|
||||
|
||||
Calling the relevant `raise` method will add the data you pass to it to the relevant array.
|
||||
|
||||
For example, if we use:
|
||||
|
||||
```js
|
||||
raise.info('Hello')
|
||||
```
|
||||
|
||||
The result will be:
|
||||
|
||||
```js
|
||||
events: {
|
||||
debug: [],
|
||||
error: [],
|
||||
info: [
|
||||
'Hello'
|
||||
],
|
||||
warning: []
|
||||
}
|
||||
```
|
||||
|
||||
<Note>
|
||||
|
||||
##### Errors are not harmless, the rest is
|
||||
|
||||
It's important to note that only the `error` type has an impact.
|
||||
The other types merely add information to the pattern.
|
||||
|
||||
But if an error is raised, core won't attempt to pack the pattern parts on the page.
|
||||
In other words, it will abort after the draft, and not provide a layout.
|
||||
|
||||
</Note>
|
||||
|
27
markdown/dev/reference/api/part/raise/error/en.md
Normal file
27
markdown/dev/reference/api/part/raise/error/en.md
Normal file
|
@ -0,0 +1,27 @@
|
|||
---
|
||||
title: raise.error()
|
||||
---
|
||||
|
||||
```js
|
||||
raise.error(data)
|
||||
```
|
||||
|
||||
The `raise.error()` method adds an event of type `error` to the pattern.
|
||||
|
||||
<Note>
|
||||
|
||||
##### Raising an error will prevent the pattern from being completed
|
||||
|
||||
Unlike other events, which have no side-effects, if there is one or more
|
||||
events of type `error`, the pattern will not be completed.
|
||||
|
||||
In other words, you should only use this when the situation is unrecoverable.
|
||||
If not, [raise a warning](/reference/api/part/raise/warning).
|
||||
|
||||
</Note>
|
||||
|
||||
<Tip>
|
||||
|
||||
All raise methods are available via [the shorthand method](/reference/api/part/shorthand)
|
||||
|
||||
</Tip>
|
20
markdown/dev/reference/api/part/raise/info/en.md
Normal file
20
markdown/dev/reference/api/part/raise/info/en.md
Normal file
|
@ -0,0 +1,20 @@
|
|||
---
|
||||
title: raise.info()
|
||||
---
|
||||
|
||||
```js
|
||||
raise.info(data)
|
||||
```
|
||||
|
||||
The `raise.info()` method adds an event of type `info` to the pattern.
|
||||
|
||||
What happens with this data is entirely up to the frontend developer.
|
||||
As such, data can by anything you like. A string is common, but you
|
||||
can also add arrays or objects with data or information you want to
|
||||
use in your frontend.
|
||||
|
||||
<Tip>
|
||||
|
||||
All raise methods are available via [the shorthand method](/reference/api/part/shorthand)
|
||||
|
||||
</Tip>
|
20
markdown/dev/reference/api/part/raise/warning/en.md
Normal file
20
markdown/dev/reference/api/part/raise/warning/en.md
Normal file
|
@ -0,0 +1,20 @@
|
|||
---
|
||||
title: raise.warning()
|
||||
---
|
||||
|
||||
```js
|
||||
raise.warning(data)
|
||||
```
|
||||
|
||||
The `raise.warning()` method adds an event of type `warning` to the pattern.
|
||||
|
||||
What happens with this data is entirely up to the frontend developer.
|
||||
As such, data can by anything you like. A string is common, but you
|
||||
can also add arrays or objects with data or information you want to
|
||||
use in your frontend.
|
||||
|
||||
<Tip>
|
||||
|
||||
All raise methods are available via [the shorthand method](/reference/api/part/shorthand)
|
||||
|
||||
</Tip>
|
68
markdown/dev/reference/api/part/shorthand/en.md
Normal file
68
markdown/dev/reference/api/part/shorthand/en.md
Normal file
|
@ -0,0 +1,68 @@
|
|||
---
|
||||
title: shorthand()
|
||||
---
|
||||
|
||||
```js
|
||||
object Part.shorthand();
|
||||
```
|
||||
|
||||
This method returns a plain object with the following properties:
|
||||
|
||||
- `events` : An object holding the raised events (see `raise`)
|
||||
- `final` : `true` is this is a full draft, or `false` if this is a sample.
|
||||
- `macro` : The macro runner
|
||||
- `measurements` = `pattern.settings.measurements`
|
||||
- `paperless` = `pattern.settings.paperless`
|
||||
- `Path` : the [Path](/reference/api/path) constructor
|
||||
- `paths` = `part.paths`
|
||||
- `Point` : the [Point](/reference/api/point) constructor
|
||||
- `points` = `part.points`
|
||||
- `Snippet` : the [Snippet](/reference/api/snippet) constructor
|
||||
- `snippets` = `part.snippets`
|
||||
- `options` = `pattern.settings.options`
|
||||
- `raise` : An object holding the various methods that allow you to [raise events](/reference/api/part/raise/)
|
||||
- `sa` = `pattern.settings.sa`
|
||||
- `store` = `pattern.store`, a [Store](/reference/api/store) instance that is shared across parts
|
||||
- `utils` : A [Utils](/reference/api/utils) instance with utility methods
|
||||
- `units` : A context-aware version of `utils.units`
|
||||
|
||||
As the name implies, this method can save you a bunch of typing, and keep your
|
||||
code concise. We highly recommend it. Below are some examples:
|
||||
|
||||
```js{16}
|
||||
// You could write this:
|
||||
part.points.from = new part.Point(
|
||||
pattern.measurements.chestCircumference / 2,
|
||||
pattern.options.armholeDepth);
|
||||
|
||||
part.points.to = new part.Point(
|
||||
part.points.from.x + pattern.settings.sa,
|
||||
part.points.from.y);
|
||||
|
||||
part.paths.example = new part.Path()
|
||||
.move(parts.points.from)
|
||||
.line(parts.points.to);
|
||||
|
||||
// Or use shorthand:
|
||||
let { Point, points, measurements, options, sa } = part.shorthand();
|
||||
|
||||
points.from = new Point(
|
||||
measurements.chestCircumference / 2,
|
||||
options.armholeDepth);
|
||||
|
||||
points.to = new part.Point(
|
||||
points.from.x + sa,
|
||||
points.from.y);
|
||||
|
||||
paths.example = new Path()
|
||||
.move(points.from)
|
||||
.line(points.to);
|
||||
```
|
||||
|
||||
<Tip>
|
||||
|
||||
As you can see in the example above, you can/should load only
|
||||
the shorthand you need by using object destructuring.
|
||||
|
||||
</Tip>
|
||||
|
22
markdown/dev/reference/api/part/units/en.md
Normal file
22
markdown/dev/reference/api/part/units/en.md
Normal file
|
@ -0,0 +1,22 @@
|
|||
---
|
||||
title: units()
|
||||
---
|
||||
|
||||
```js
|
||||
string part.units(float number)
|
||||
```
|
||||
|
||||
Formats input (in mm) as the units requested by the user.
|
||||
|
||||
<Tip>
|
||||
|
||||
###### This method is available as shorthand
|
||||
|
||||
You can access this units method from the [Part.shorthand](#shorthand) method:
|
||||
|
||||
```js
|
||||
let { units } = part.shorthand();
|
||||
```
|
||||
|
||||
</Tip>
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue