Skip to content

Commit

Permalink
Update docs
Browse files Browse the repository at this point in the history
  • Loading branch information
baku89 committed Dec 1, 2023
1 parent c3ccee7 commit 6ee9753
Show file tree
Hide file tree
Showing 6 changed files with 33 additions and 16 deletions.
4 changes: 3 additions & 1 deletion docs/.vuepress/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,14 +44,16 @@ module.exports = defineUserConfig({
plugins: [palettePlugin({preset: 'sass'})],
markdown: {
linkify: true,
typographer: true,
},
extendsMarkdown: md => {
const defaultRender = md.renderer.rules.fence!

md.renderer.rules.fence = (tokens, idx, options, env, self) => {
const token = tokens[idx]
if (token.tag === 'code' && token.info === 'js:pathed') {
return `<Example code="${token.content}"></Example>`
const code = md.utils.escapeHtml(token.content)
return `<Example code="${code}"></Example>`
}
return defaultRender(tokens, idx, options, env, self)
}
Expand Down
7 changes: 6 additions & 1 deletion docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,12 @@ Currently, the library heavily depends on [Bazier.js](https://pomax.github.io/be

## API

See the full documentation on [API](./api/modules.md)
See the full documentation on [API](./api)

- [Path](./api/modules/Path): The basic module for manipulating paths.
- [Bezier](./api/modules/Bezier): The cubic bezier functions which wraps Bezier.js.
- [BBox](./api/modules/BBox): The functions for handling bounding boxes.
- [Type Aliases](./api#type-aliases)

## Getting Started

Expand Down
1 change: 1 addition & 0 deletions src/BBox.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import {vec2} from 'linearly'

/**
* A bounding box represented as a tuple of two diagonal points.
* @category Type Aliases
*/
export type BBox = readonly [min: vec2, max: vec2]

Expand Down
1 change: 1 addition & 0 deletions src/Bezier.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import {vec2} from 'linearly'

/**
* A cubic Bezier curve, whose control points are specified in absolute coordinates.
* @category Type Aliases
*/
export type Bezier = readonly [
start: vec2,
Expand Down
25 changes: 12 additions & 13 deletions src/Path.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,70 +9,70 @@ paper.setup(document.createElement('canvas'))

/**
* Move-to command.
* @category Path Commands
* @category Type Aliases
* @see https://developer.mozilla.org/en-US/docs/Web/SVG/Tutorial/Paths#line_commands
*/
export type CommandM = readonly ['M', end: vec2]

/**
* Line-to command.
* @category Path Commands
* @category Type Aliases
* @see https://developer.mozilla.org/en-US/docs/Web/SVG/Tutorial/Paths#line_commands
*/
export type CommandL = readonly ['L', end: vec2]

/**
* Horizontal line-to command.
* @category Path Commands
* @category Type Aliases
* @see https://developer.mozilla.org/en-US/docs/Web/SVG/Tutorial/Paths#line_commands
*/
export type CommandH = readonly ['H', end: number]

/**
* Vertical line-to command.
* @category Path Commands
* @category Type Aliases
* @see https://developer.mozilla.org/en-US/docs/Web/SVG/Tutorial/Paths#line_commands
*/
export type CommandV = readonly ['V', end: number]

/**
* Cubic Bézier curve command.
* @category Path Commands
* @category Type Aliases
* @see https://developer.mozilla.org/en-US/docs/Web/SVG/Tutorial/Paths#curve_commands
*/
export type CommandC = readonly ['C', control1: vec2, control2: vec2, end: vec2]

/**
* Cubic Bézier curve command with implicit first control point (the reflection of the previous control point).
* @category Path Commands
* @category Type Aliases
* @see https://developer.mozilla.org/en-US/docs/Web/SVG/Tutorial/Paths#curve_commands
*/
export type CommandS = readonly ['S', control2: vec2, end: vec2]

/**
* Quadratic Bézier curve command.
* @category Path Commands
* @category Type Aliases
* @see https://developer.mozilla.org/en-US/docs/Web/SVG/Tutorial/Paths#curve_commands
*/
export type CommandQ = readonly ['Q', control: vec2, end: vec2]

/**
* Quadratic Bézier curve command with implicit control point (the reflection of the previous control point).
* @category Path Commands
* @category Type Aliases
* @see https://developer.mozilla.org/en-US/docs/Web/SVG/Tutorial/Paths#curve_commands
*/
export type CommandT = readonly ['T', end: vec2]

/**
* Close path command
* @category Path Commands
* @category Type Aliases
* @see https://developer.mozilla.org/en-US/docs/Web/SVG/Tutorial/Paths#line_commands
*/
export type CommandZ = readonly ['Z']

/**
* Arc command
* @category Path Commands
* @category Type Aliases
* @see https://developer.mozilla.org/en-US/docs/Web/SVG/Tutorial/Paths#arcs
*/
export type CommandA = [
Expand Down Expand Up @@ -100,7 +100,7 @@ export type CommandA = [
]

/**
* @category Path Commands
* @category Type Aliases
*/
export type Command =
| CommandM
Expand All @@ -116,13 +116,12 @@ export type Command =

/**
* A path represented as an array of commands. All of the points are represented as tuple of vector `[x: number, y: number]` and represented in absolute coordinates.
* @category Path
* @category Type Aliases
*/
export type Path = readonly Command[]

/**
* Functions for manipulating paths represented as {@link Path}.
* @category Path
*/
export namespace Path {
/**
Expand Down
11 changes: 10 additions & 1 deletion typedoc.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,14 @@
"sort": ["alphabetical"],
"cleanOutputDir": true,
"includeVersion": true,
"hideInPageTOC": true
"hideInPageTOC": true,
"categoryOrder": [
"Primitives",
"Properties",
"Modifiers",
"Boolean Operations",
"Converters",
"Draw Functions",
"Utilities"
]
}

0 comments on commit 6ee9753

Please sign in to comment.