More docs fixes (#6733)

* Fix various docs errors around std module

Signed-off-by: Nick Cameron <nrc@ncameron.org>

* remove KCL from lang docs titles and move settings docs

Signed-off-by: Nick Cameron <nrc@ncameron.org>

* Include functions declared in Rust in module docs

Signed-off-by: Nick Cameron <nrc@ncameron.org>

---------

Signed-off-by: Nick Cameron <nrc@ncameron.org>
This commit is contained in:
Nick Cameron
2025-05-08 08:26:56 +12:00
committed by GitHub
parent 43d5a72514
commit 2fee3a424c
84 changed files with 203 additions and 100 deletions

View File

@ -1,5 +1,5 @@
--- ---
title: "KCL Known Issues" title: "Known Issues"
excerpt: "Known issues with the KCL standard library for the Zoo Design Studio." excerpt: "Known issues with the KCL standard library for the Zoo Design Studio."
layout: manual layout: manual
--- ---

View File

@ -1,5 +1,5 @@
--- ---
title: "KCL Modules" title: "Modules"
excerpt: "Documentation of modules for the KCL language for the Zoo Design Studio." excerpt: "Documentation of modules for the KCL language for the Zoo Design Studio."
layout: manual layout: manual
--- ---

View File

@ -1,5 +1,5 @@
--- ---
title: "KCL Settings" title: "Settings"
excerpt: "Documentation of settings for the KCL language and Zoo Design Studio." excerpt: "Documentation of settings for the KCL language and Zoo Design Studio."
layout: manual layout: manual
--- ---
@ -8,16 +8,16 @@ layout: manual
There are three levels of settings available in Zoo Design Studio: There are three levels of settings available in Zoo Design Studio:
1. [User Settings](/docs/kcl/settings-user): Global settings that apply to all projects, stored in `user.toml` 1. [User Settings](/docs/kcl/settings/user): Global settings that apply to all projects, stored in `user.toml`
2. [Project Settings](/docs/kcl/settings-project): Settings specific to a project, stored in `project.toml` 2. [Project Settings](/docs/kcl/settings/project): Settings specific to a project, stored in `project.toml`
3. Per-file Settings: Settings that apply to a single KCL file, specified using the `@settings` attribute 3. Per-file Settings: Settings that apply to a single KCL file, specified using the `@settings` attribute
## Configuration Files ## Configuration Files
Zoo Design Studio uses TOML files for configuration: Zoo Design Studio uses TOML files for configuration:
* **User Settings**: `user.toml` - See [complete documentation](/docs/kcl/settings-user) * **User Settings**: `user.toml` - See [complete documentation](/docs/kcl/settings/user)
* **Project Settings**: `project.toml` - See [complete documentation](/docs/kcl/settings-project) * **Project Settings**: `project.toml` - See [complete documentation](/docs/kcl/settings/project)
## Per-file settings ## Per-file settings

View File

@ -1,5 +1,5 @@
--- ---
title: "KCL Types" title: "Types"
excerpt: "Documentation of types for the KCL standard library for the Zoo Design Studio." excerpt: "Documentation of types for the KCL standard library for the Zoo Design Studio."
layout: manual layout: manual
--- ---

View File

@ -1,6 +1,6 @@
--- ---
title: "END" title: "END"
subtitle: "Constant in prelude" subtitle: "Constant in std"
excerpt: "Identifies the ending face of an extrusion. I.e., the new face created by an extrusion." excerpt: "Identifies the ending face of an extrusion. I.e., the new face created by an extrusion."
layout: manual layout: manual
--- ---

View File

@ -1,6 +1,6 @@
--- ---
title: "START" title: "START"
subtitle: "Constant in prelude" subtitle: "Constant in std"
excerpt: "Identifies the starting face of an extrusion. I.e., the face which is extruded." excerpt: "Identifies the starting face of an extrusion. I.e., the face which is extruded."
layout: manual layout: manual
--- ---

View File

@ -1,6 +1,6 @@
--- ---
title: "X" title: "X"
subtitle: "Constant in prelude" subtitle: "Constant in std"
excerpt: "" excerpt: ""
layout: manual layout: manual
--- ---

View File

@ -1,6 +1,6 @@
--- ---
title: "XY" title: "XY"
subtitle: "Constant in prelude" subtitle: "Constant in std"
excerpt: "" excerpt: ""
layout: manual layout: manual
--- ---

View File

@ -1,6 +1,6 @@
--- ---
title: "XZ" title: "XZ"
subtitle: "Constant in prelude" subtitle: "Constant in std"
excerpt: "" excerpt: ""
layout: manual layout: manual
--- ---

View File

@ -1,6 +1,6 @@
--- ---
title: "Y" title: "Y"
subtitle: "Constant in prelude" subtitle: "Constant in std"
excerpt: "" excerpt: ""
layout: manual layout: manual
--- ---

View File

@ -1,6 +1,6 @@
--- ---
title: "YZ" title: "YZ"
subtitle: "Constant in prelude" subtitle: "Constant in std"
excerpt: "" excerpt: ""
layout: manual layout: manual
--- ---

View File

@ -1,6 +1,6 @@
--- ---
title: "Z" title: "Z"
subtitle: "Constant in prelude" subtitle: "Constant in std"
excerpt: "" excerpt: ""
layout: manual layout: manual
--- ---

View File

@ -1,6 +1,6 @@
--- ---
title: "E" title: "E"
subtitle: "Constant in math" subtitle: "Constant in std::math"
excerpt: "The value of Eulers number `e`." excerpt: "The value of Eulers number `e`."
layout: manual layout: manual
--- ---

View File

@ -1,6 +1,6 @@
--- ---
title: "PI" title: "PI"
subtitle: "Constant in math" subtitle: "Constant in std::math"
excerpt: "The value of `pi`, Archimedes constant (π)." excerpt: "The value of `pi`, Archimedes constant (π)."
layout: manual layout: manual
--- ---

View File

@ -1,6 +1,6 @@
--- ---
title: "TAU" title: "TAU"
subtitle: "Constant in math" subtitle: "Constant in std::math"
excerpt: "The value of `tau`, the full circle constant (τ). Equal to 2π." excerpt: "The value of `tau`, the full circle constant (τ). Equal to 2π."
layout: manual layout: manual
--- ---

View File

@ -1,6 +1,6 @@
--- ---
title: "turns::HALF_TURN" title: "turns::HALF_TURN"
subtitle: "Constant in turns" subtitle: "Constant in std::turns"
excerpt: "" excerpt: ""
layout: manual layout: manual
--- ---

View File

@ -1,6 +1,6 @@
--- ---
title: "turns::QUARTER_TURN" title: "turns::QUARTER_TURN"
subtitle: "Constant in turns" subtitle: "Constant in std::turns"
excerpt: "" excerpt: ""
layout: manual layout: manual
--- ---

View File

@ -1,6 +1,6 @@
--- ---
title: "turns::THREE_QUARTER_TURN" title: "turns::THREE_QUARTER_TURN"
subtitle: "Constant in turns" subtitle: "Constant in std::turns"
excerpt: "" excerpt: ""
layout: manual layout: manual
--- ---

View File

@ -1,6 +1,6 @@
--- ---
title: "turns::ZERO" title: "turns::ZERO"
subtitle: "Constant in turns" subtitle: "Constant in std::turns"
excerpt: "" excerpt: ""
layout: manual layout: manual
--- ---

View File

@ -1,6 +1,6 @@
--- ---
title: "helix" title: "helix"
subtitle: "Function in prelude" subtitle: "Function in std"
excerpt: "Create a helix." excerpt: "Create a helix."
layout: manual layout: manual
--- ---

View File

@ -1,6 +1,6 @@
--- ---
title: "abs" title: "abs"
subtitle: "Function in math" subtitle: "Function in std::math"
excerpt: "Compute the absolute value of a number." excerpt: "Compute the absolute value of a number."
layout: manual layout: manual
--- ---

View File

@ -1,6 +1,6 @@
--- ---
title: "acos" title: "acos"
subtitle: "Function in math" subtitle: "Function in std::math"
excerpt: "Compute the arccosine of a number." excerpt: "Compute the arccosine of a number."
layout: manual layout: manual
--- ---

View File

@ -1,6 +1,6 @@
--- ---
title: "asin" title: "asin"
subtitle: "Function in math" subtitle: "Function in std::math"
excerpt: "Compute the arcsine of a number." excerpt: "Compute the arcsine of a number."
layout: manual layout: manual
--- ---

View File

@ -1,6 +1,6 @@
--- ---
title: "atan" title: "atan"
subtitle: "Function in math" subtitle: "Function in std::math"
excerpt: "Compute the arctangent of a number." excerpt: "Compute the arctangent of a number."
layout: manual layout: manual
--- ---

View File

@ -1,6 +1,6 @@
--- ---
title: "atan2" title: "atan2"
subtitle: "Function in math" subtitle: "Function in std::math"
excerpt: "Compute the four quadrant arctangent of Y and X." excerpt: "Compute the four quadrant arctangent of Y and X."
layout: manual layout: manual
--- ---

View File

@ -1,6 +1,6 @@
--- ---
title: "ceil" title: "ceil"
subtitle: "Function in math" subtitle: "Function in std::math"
excerpt: "Compute the smallest integer greater than or equal to a number." excerpt: "Compute the smallest integer greater than or equal to a number."
layout: manual layout: manual
--- ---

View File

@ -1,6 +1,6 @@
--- ---
title: "cos" title: "cos"
subtitle: "Function in math" subtitle: "Function in std::math"
excerpt: "Compute the cosine of a number." excerpt: "Compute the cosine of a number."
layout: manual layout: manual
--- ---

View File

@ -1,6 +1,6 @@
--- ---
title: "floor" title: "floor"
subtitle: "Function in math" subtitle: "Function in std::math"
excerpt: "Compute the largest integer less than or equal to a number." excerpt: "Compute the largest integer less than or equal to a number."
layout: manual layout: manual
--- ---

View File

@ -1,6 +1,6 @@
--- ---
title: "ln" title: "ln"
subtitle: "Function in math" subtitle: "Function in std::math"
excerpt: "Compute the natural logarithm of the number." excerpt: "Compute the natural logarithm of the number."
layout: manual layout: manual
--- ---

View File

@ -1,6 +1,6 @@
--- ---
title: "log" title: "log"
subtitle: "Function in math" subtitle: "Function in std::math"
excerpt: "Compute the logarithm of the number with respect to an arbitrary base." excerpt: "Compute the logarithm of the number with respect to an arbitrary base."
layout: manual layout: manual
--- ---

View File

@ -1,6 +1,6 @@
--- ---
title: "log10" title: "log10"
subtitle: "Function in math" subtitle: "Function in std::math"
excerpt: "Compute the base 10 logarithm of the number." excerpt: "Compute the base 10 logarithm of the number."
layout: manual layout: manual
--- ---

View File

@ -1,6 +1,6 @@
--- ---
title: "log2" title: "log2"
subtitle: "Function in math" subtitle: "Function in std::math"
excerpt: "Compute the base 2 logarithm of the number." excerpt: "Compute the base 2 logarithm of the number."
layout: manual layout: manual
--- ---

View File

@ -1,6 +1,6 @@
--- ---
title: "max" title: "max"
subtitle: "Function in math" subtitle: "Function in std::math"
excerpt: "Compute the maximum of the given arguments." excerpt: "Compute the maximum of the given arguments."
layout: manual layout: manual
--- ---

View File

@ -1,6 +1,6 @@
--- ---
title: "min" title: "min"
subtitle: "Function in math" subtitle: "Function in std::math"
excerpt: "Compute the minimum of the given arguments." excerpt: "Compute the minimum of the given arguments."
layout: manual layout: manual
--- ---

View File

@ -1,6 +1,6 @@
--- ---
title: "polar" title: "polar"
subtitle: "Function in math" subtitle: "Function in std::math"
excerpt: "" excerpt: ""
layout: manual layout: manual
--- ---

View File

@ -1,6 +1,6 @@
--- ---
title: "pow" title: "pow"
subtitle: "Function in math" subtitle: "Function in std::math"
excerpt: "Compute the number to a power." excerpt: "Compute the number to a power."
layout: manual layout: manual
--- ---

View File

@ -1,6 +1,6 @@
--- ---
title: "rem" title: "rem"
subtitle: "Function in math" subtitle: "Function in std::math"
excerpt: "" excerpt: ""
layout: manual layout: manual
--- ---

View File

@ -1,6 +1,6 @@
--- ---
title: "round" title: "round"
subtitle: "Function in math" subtitle: "Function in std::math"
excerpt: "Round a number to the nearest integer." excerpt: "Round a number to the nearest integer."
layout: manual layout: manual
--- ---

View File

@ -1,6 +1,6 @@
--- ---
title: "sin" title: "sin"
subtitle: "Function in math" subtitle: "Function in std::math"
excerpt: "Compute the sine of a number." excerpt: "Compute the sine of a number."
layout: manual layout: manual
--- ---

View File

@ -1,6 +1,6 @@
--- ---
title: "sqrt" title: "sqrt"
subtitle: "Function in math" subtitle: "Function in std::math"
excerpt: "Compute the square root of a number." excerpt: "Compute the square root of a number."
layout: manual layout: manual
--- ---

View File

@ -1,6 +1,6 @@
--- ---
title: "tan" title: "tan"
subtitle: "Function in math" subtitle: "Function in std::math"
excerpt: "Compute the tangent of a number." excerpt: "Compute the tangent of a number."
layout: manual layout: manual
--- ---

View File

@ -1,6 +1,6 @@
--- ---
title: "offsetPlane" title: "offsetPlane"
subtitle: "Function in prelude" subtitle: "Function in std"
excerpt: "Offset a plane by a distance along its normal." excerpt: "Offset a plane by a distance along its normal."
layout: manual layout: manual
--- ---

View File

@ -1,6 +1,6 @@
--- ---
title: "circle" title: "circle"
subtitle: "Function in sketch" subtitle: "Function in std::sketch"
excerpt: "" excerpt: ""
layout: manual layout: manual
--- ---

View File

@ -1,6 +1,6 @@
--- ---
title: "revolve" title: "revolve"
subtitle: "Function in sketch" subtitle: "Function in std::sketch"
excerpt: "Rotate a sketch around some provided axis, creating a solid from its extent." excerpt: "Rotate a sketch around some provided axis, creating a solid from its extent."
layout: manual layout: manual
--- ---

View File

@ -1,6 +1,6 @@
--- ---
title: "chamfer" title: "chamfer"
subtitle: "Function in solid" subtitle: "Function in std::solid"
excerpt: "Cut a straight transitional edge along a tagged path." excerpt: "Cut a straight transitional edge along a tagged path."
layout: manual layout: manual
--- ---

View File

@ -1,6 +1,6 @@
--- ---
title: "fillet" title: "fillet"
subtitle: "Function in solid" subtitle: "Function in std::solid"
excerpt: "Blend a transitional edge along a tagged path, smoothing the sharp edge." excerpt: "Blend a transitional edge along a tagged path, smoothing the sharp edge."
layout: manual layout: manual
--- ---

View File

@ -1,6 +1,6 @@
--- ---
title: "hollow" title: "hollow"
subtitle: "Function in solid" subtitle: "Function in std::solid"
excerpt: "Make the inside of a 3D object hollow." excerpt: "Make the inside of a 3D object hollow."
layout: manual layout: manual
--- ---

View File

@ -1,6 +1,6 @@
--- ---
title: "shell" title: "shell"
subtitle: "Function in solid" subtitle: "Function in std::solid"
excerpt: "" excerpt: ""
layout: manual layout: manual
--- ---

View File

@ -1,6 +1,6 @@
--- ---
title: "mirror2d" title: "mirror2d"
subtitle: "Function in transform" subtitle: "Function in std::transform"
excerpt: "Mirror a sketch." excerpt: "Mirror a sketch."
layout: manual layout: manual
--- ---

View File

@ -1,6 +1,6 @@
--- ---
title: "units::toCentimeters" title: "units::toCentimeters"
subtitle: "Function in units" subtitle: "Function in std::units"
excerpt: "Convert a number to centimeters from its current units." excerpt: "Convert a number to centimeters from its current units."
layout: manual layout: manual
--- ---

View File

@ -1,6 +1,6 @@
--- ---
title: "units::toDegrees" title: "units::toDegrees"
subtitle: "Function in units" subtitle: "Function in std::units"
excerpt: "Converts a number to degrees from its current units." excerpt: "Converts a number to degrees from its current units."
layout: manual layout: manual
--- ---

View File

@ -1,6 +1,6 @@
--- ---
title: "units::toFeet" title: "units::toFeet"
subtitle: "Function in units" subtitle: "Function in std::units"
excerpt: "Convert a number to feet from its current units." excerpt: "Convert a number to feet from its current units."
layout: manual layout: manual
--- ---

View File

@ -1,6 +1,6 @@
--- ---
title: "units::toInches" title: "units::toInches"
subtitle: "Function in units" subtitle: "Function in std::units"
excerpt: "Convert a number to inches from its current units." excerpt: "Convert a number to inches from its current units."
layout: manual layout: manual
--- ---

View File

@ -1,6 +1,6 @@
--- ---
title: "units::toMeters" title: "units::toMeters"
subtitle: "Function in units" subtitle: "Function in std::units"
excerpt: "Convert a number to meters from its current units." excerpt: "Convert a number to meters from its current units."
layout: manual layout: manual
--- ---

View File

@ -1,6 +1,6 @@
--- ---
title: "units::toMillimeters" title: "units::toMillimeters"
subtitle: "Function in units" subtitle: "Function in std::units"
excerpt: "Convert a number to millimeters from its current units." excerpt: "Convert a number to millimeters from its current units."
layout: manual layout: manual
--- ---

View File

@ -1,6 +1,6 @@
--- ---
title: "units::toRadians" title: "units::toRadians"
subtitle: "Function in units" subtitle: "Function in std::units"
excerpt: "Converts a number to radians from its current units." excerpt: "Converts a number to radians from its current units."
layout: manual layout: manual
--- ---

View File

@ -1,6 +1,6 @@
--- ---
title: "units::toYards" title: "units::toYards"
subtitle: "Function in units" subtitle: "Function in std::units"
excerpt: "Converts a number to yards from its current units." excerpt: "Converts a number to yards from its current units."
layout: manual layout: manual
--- ---

View File

@ -10,4 +10,10 @@ layout: manual
## Functions and constants
* [`map`](/docs/kcl-std/map)
* [`pop`](/docs/kcl-std/pop)
* [`push`](/docs/kcl-std/push)
* [`reduce`](/docs/kcl-std/reduce)

View File

@ -23,6 +23,9 @@ layout: manual
* [`ceil`](/docs/kcl-std/functions/std-math-ceil) * [`ceil`](/docs/kcl-std/functions/std-math-ceil)
* [`cos`](/docs/kcl-std/functions/std-math-cos) * [`cos`](/docs/kcl-std/functions/std-math-cos)
* [`floor`](/docs/kcl-std/functions/std-math-floor) * [`floor`](/docs/kcl-std/functions/std-math-floor)
* [`legAngX`](/docs/kcl-std/legAngX)
* [`legAngY`](/docs/kcl-std/legAngY)
* [`legLen`](/docs/kcl-std/legLen)
* [`ln`](/docs/kcl-std/functions/std-math-ln) * [`ln`](/docs/kcl-std/functions/std-math-ln)
* [`log`](/docs/kcl-std/functions/std-math-log) * [`log`](/docs/kcl-std/functions/std-math-log)
* [`log10`](/docs/kcl-std/functions/std-math-log10) * [`log10`](/docs/kcl-std/functions/std-math-log10)

View File

@ -12,6 +12,44 @@ layout: manual
## Functions and constants ## Functions and constants
* [`angledLine`](/docs/kcl-std/angledLine)
* [`angledLineThatIntersects`](/docs/kcl-std/angledLineThatIntersects)
* [`arc`](/docs/kcl-std/arc)
* [`bezierCurve`](/docs/kcl-std/bezierCurve)
* [`circle`](/docs/kcl-std/functions/std-sketch-circle) * [`circle`](/docs/kcl-std/functions/std-sketch-circle)
* [`circleThreePoint`](/docs/kcl-std/circleThreePoint)
* [`close`](/docs/kcl-std/close)
* [`extrude`](/docs/kcl-std/extrude)
* [`getCommonEdge`](/docs/kcl-std/getCommonEdge)
* [`getNextAdjacentEdge`](/docs/kcl-std/getNextAdjacentEdge)
* [`getOppositeEdge`](/docs/kcl-std/getOppositeEdge)
* [`getPreviousAdjacentEdge`](/docs/kcl-std/getPreviousAdjacentEdge)
* [`involuteCircular`](/docs/kcl-std/involuteCircular)
* [`lastSegX`](/docs/kcl-std/lastSegX)
* [`lastSegY`](/docs/kcl-std/lastSegY)
* [`line`](/docs/kcl-std/line)
* [`loft`](/docs/kcl-std/loft)
* [`patternCircular2d`](/docs/kcl-std/patternCircular2d)
* [`patternTransform2d`](/docs/kcl-std/patternTransform2d)
* [`polygon`](/docs/kcl-std/polygon)
* [`profileStart`](/docs/kcl-std/profileStart)
* [`profileStartX`](/docs/kcl-std/profileStartX)
* [`profileStartY`](/docs/kcl-std/profileStartY)
* [`revolve`](/docs/kcl-std/functions/std-sketch-revolve) * [`revolve`](/docs/kcl-std/functions/std-sketch-revolve)
* [`segAng`](/docs/kcl-std/segAng)
* [`segEnd`](/docs/kcl-std/segEnd)
* [`segEndX`](/docs/kcl-std/segEndX)
* [`segEndY`](/docs/kcl-std/segEndY)
* [`segLen`](/docs/kcl-std/segLen)
* [`segStart`](/docs/kcl-std/segStart)
* [`segStartX`](/docs/kcl-std/segStartX)
* [`segStartY`](/docs/kcl-std/segStartY)
* [`startProfile`](/docs/kcl-std/startProfile)
* [`startSketchOn`](/docs/kcl-std/startSketchOn)
* [`subtract2d`](/docs/kcl-std/subtract2d)
* [`sweep`](/docs/kcl-std/sweep)
* [`tangentToEnd`](/docs/kcl-std/tangentToEnd)
* [`tangentialArc`](/docs/kcl-std/tangentialArc)
* [`xLine`](/docs/kcl-std/xLine)
* [`yLine`](/docs/kcl-std/yLine)

View File

@ -15,5 +15,11 @@ layout: manual
* [`chamfer`](/docs/kcl-std/functions/std-solid-chamfer) * [`chamfer`](/docs/kcl-std/functions/std-solid-chamfer)
* [`fillet`](/docs/kcl-std/functions/std-solid-fillet) * [`fillet`](/docs/kcl-std/functions/std-solid-fillet)
* [`hollow`](/docs/kcl-std/functions/std-solid-hollow) * [`hollow`](/docs/kcl-std/functions/std-solid-hollow)
* [`intersect`](/docs/kcl-std/intersect)
* [`patternCircular3d`](/docs/kcl-std/patternCircular3d)
* [`patternLinear3d`](/docs/kcl-std/patternLinear3d)
* [`patternTransform`](/docs/kcl-std/patternTransform)
* [`shell`](/docs/kcl-std/functions/std-solid-shell) * [`shell`](/docs/kcl-std/functions/std-solid-shell)
* [`subtract`](/docs/kcl-std/subtract)
* [`union`](/docs/kcl-std/union)

View File

@ -13,4 +13,7 @@ layout: manual
## Functions and constants ## Functions and constants
* [`mirror2d`](/docs/kcl-std/functions/std-transform-mirror2d) * [`mirror2d`](/docs/kcl-std/functions/std-transform-mirror2d)
* [`rotate`](/docs/kcl-std/rotate)
* [`scale`](/docs/kcl-std/scale)
* [`translate`](/docs/kcl-std/translate)

View File

@ -1,6 +1,6 @@
--- ---
title: "prelude" title: "std"
subtitle: "Module in " subtitle: "Module in std::"
excerpt: "The KCL standard library " excerpt: "The KCL standard library "
layout: manual layout: manual
--- ---
@ -30,6 +30,11 @@ Contains frequently used constants, functions for interacting with the KittyCAD
* [`Y`](/docs/kcl-std/consts/std-Y) * [`Y`](/docs/kcl-std/consts/std-Y)
* [`YZ`](/docs/kcl-std/consts/std-YZ) * [`YZ`](/docs/kcl-std/consts/std-YZ)
* [`Z`](/docs/kcl-std/consts/std-Z) * [`Z`](/docs/kcl-std/consts/std-Z)
* [`appearance`](/docs/kcl-std/appearance)
* [`assert`](/docs/kcl-std/assert)
* [`assertIs`](/docs/kcl-std/assertIs)
* [`clone`](/docs/kcl-std/clone)
* [`helix`](/docs/kcl-std/functions/std-helix) * [`helix`](/docs/kcl-std/functions/std-helix)
* [`offsetPlane`](/docs/kcl-std/functions/std-offsetPlane) * [`offsetPlane`](/docs/kcl-std/functions/std-offsetPlane)
* [`patternLinear2d`](/docs/kcl-std/patternLinear2d)

View File

@ -1,6 +1,6 @@
--- ---
title: "Axis2d" title: "Axis2d"
subtitle: "Type in types" subtitle: "Type in std::types"
excerpt: "An infinite line in 2d space." excerpt: "An infinite line in 2d space."
layout: manual layout: manual
--- ---

View File

@ -1,6 +1,6 @@
--- ---
title: "Axis3d" title: "Axis3d"
subtitle: "Type in types" subtitle: "Type in std::types"
excerpt: "An infinite line in 3d space." excerpt: "An infinite line in 3d space."
layout: manual layout: manual
--- ---

View File

@ -1,6 +1,6 @@
--- ---
title: "Edge" title: "Edge"
subtitle: "Type in types" subtitle: "Type in std::types"
excerpt: "The edge of a solid." excerpt: "The edge of a solid."
layout: manual layout: manual
--- ---

View File

@ -1,6 +1,6 @@
--- ---
title: "Face" title: "Face"
subtitle: "Type in types" subtitle: "Type in std::types"
excerpt: "A face." excerpt: "A face."
layout: manual layout: manual
--- ---

View File

@ -1,6 +1,6 @@
--- ---
title: "Helix" title: "Helix"
subtitle: "Type in types" subtitle: "Type in std::types"
excerpt: "A helix." excerpt: "A helix."
layout: manual layout: manual
--- ---

View File

@ -1,6 +1,6 @@
--- ---
title: "Plane" title: "Plane"
subtitle: "Type in types" subtitle: "Type in std::types"
excerpt: "A plane." excerpt: "A plane."
layout: manual layout: manual
--- ---

View File

@ -1,6 +1,6 @@
--- ---
title: "Point2d" title: "Point2d"
subtitle: "Type in types" subtitle: "Type in std::types"
excerpt: "A point in two dimensional space." excerpt: "A point in two dimensional space."
layout: manual layout: manual
--- ---

View File

@ -1,6 +1,6 @@
--- ---
title: "Point3d" title: "Point3d"
subtitle: "Type in types" subtitle: "Type in std::types"
excerpt: "A point in three dimensional space." excerpt: "A point in three dimensional space."
layout: manual layout: manual
--- ---

View File

@ -1,6 +1,6 @@
--- ---
title: "Sketch" title: "Sketch"
subtitle: "Type in types" subtitle: "Type in std::types"
excerpt: "A sketch is a collection of paths." excerpt: "A sketch is a collection of paths."
layout: manual layout: manual
--- ---

View File

@ -1,6 +1,6 @@
--- ---
title: "Solid" title: "Solid"
subtitle: "Type in types" subtitle: "Type in std::types"
excerpt: "A solid is a collection of extrude surfaces." excerpt: "A solid is a collection of extrude surfaces."
layout: manual layout: manual
--- ---

View File

@ -1,6 +1,6 @@
--- ---
title: "any" title: "any"
subtitle: "Type in types" subtitle: "Type in std::types"
excerpt: "Any value." excerpt: "Any value."
layout: manual layout: manual
--- ---

View File

@ -1,6 +1,6 @@
--- ---
title: "bool" title: "bool"
subtitle: "Type in types" subtitle: "Type in std::types"
excerpt: "A boolean value." excerpt: "A boolean value."
layout: manual layout: manual
--- ---

View File

@ -1,6 +1,6 @@
--- ---
title: "number" title: "number"
subtitle: "Type in types" subtitle: "Type in std::types"
excerpt: "A number" excerpt: "A number"
layout: manual layout: manual
--- ---

View File

@ -1,6 +1,6 @@
--- ---
title: "string" title: "string"
subtitle: "Type in types" subtitle: "Type in std::types"
excerpt: "A sequence of characters" excerpt: "A sequence of characters"
layout: manual layout: manual
--- ---

View File

@ -1,6 +1,6 @@
--- ---
title: "tag" title: "tag"
subtitle: "Type in types" subtitle: "Type in std::types"
excerpt: "Tags are used to give a name (tag) to a specific path." excerpt: "Tags are used to give a name (tag) to a specific path."
layout: manual layout: manual
--- ---

View File

@ -273,7 +273,7 @@ fn generate_type_from_kcl(ty: &TyData, file_name: String, example_name: String)
let data = json!({ let data = json!({
"name": ty.preferred_name, "name": ty.preferred_name,
"module": ty.module_name, "module": mod_name_std(&ty.module_name),
"definition": ty.alias.as_ref().map(|t| format!("type {} = {t}", ty.preferred_name)), "definition": ty.alias.as_ref().map(|t| format!("type {} = {t}", ty.preferred_name)),
"summary": ty.summary, "summary": ty.summary,
"description": ty.description, "description": ty.description,
@ -288,14 +288,38 @@ fn generate_type_from_kcl(ty: &TyData, file_name: String, example_name: String)
Ok(()) Ok(())
} }
fn generate_mod_from_kcl(m: &ModData, file_name: String) -> Result<()> { fn generate_mod_from_kcl(m: &ModData, file_name: String, combined: &IndexMap<String, Box<dyn StdLibFn>>) -> Result<()> {
fn list_items(m: &ModData, namespace: &str) -> Vec<gltf_json::Value> { fn list_items(
m: &ModData,
namespace: &str,
combined: &IndexMap<String, Box<dyn StdLibFn>>,
) -> Vec<gltf_json::Value> {
let mut items: Vec<_> = m let mut items: Vec<_> = m
.children .children
.iter() .iter()
.filter(|(k, _)| k.starts_with(namespace)) .filter(|(k, _)| k.starts_with(namespace))
.map(|(_, v)| (v.preferred_name(), v.file_name())) .map(|(_, v)| (v.preferred_name().to_owned(), v.file_name()))
.collect(); .collect();
if namespace == "I:" {
// Add in functions declared in Rust
items.extend(
combined
.values()
.filter(|f| {
if f.unpublished() || f.deprecated() {
return false;
}
let tags = f.tags();
let module = tags.first().map(|s| format!("std::{s}")).unwrap_or("std".to_owned());
module == m.qual_name
})
.map(|f| (f.name(), f.name())),
)
}
items.sort(); items.sort();
items items
.into_iter() .into_iter()
@ -309,14 +333,13 @@ fn generate_mod_from_kcl(m: &ModData, file_name: String) -> Result<()> {
} }
let hbs = init_handlebars()?; let hbs = init_handlebars()?;
// TODO for prelude, items from Rust let functions = list_items(m, "I:", combined);
let functions = list_items(m, "I:"); let modules = list_items(m, "M:", combined);
let modules = list_items(m, "M:"); let types = list_items(m, "T:", combined);
let types = list_items(m, "T:");
let data = json!({ let data = json!({
"name": m.name, "name": m.name,
"module": m.module_name, "module": mod_name_std(&m.module_name),
"summary": m.summary, "summary": m.summary,
"description": m.description, "description": m.description,
"modules": modules, "modules": modules,
@ -330,6 +353,15 @@ fn generate_mod_from_kcl(m: &ModData, file_name: String) -> Result<()> {
Ok(()) Ok(())
} }
fn mod_name_std(name: &str) -> String {
assert_ne!(name, "prelude");
if name == "std" {
name.to_owned()
} else {
format!("std::{name}")
}
}
fn generate_function_from_kcl( fn generate_function_from_kcl(
function: &FnData, function: &FnData,
file_name: String, file_name: String,
@ -351,7 +383,7 @@ fn generate_function_from_kcl(
let data = json!({ let data = json!({
"name": function.preferred_name, "name": function.preferred_name,
"module": function.module_name, "module": mod_name_std(&function.module_name),
"summary": function.summary, "summary": function.summary,
"description": function.description, "description": function.description,
"deprecated": function.properties.deprecated, "deprecated": function.properties.deprecated,
@ -395,7 +427,7 @@ fn generate_const_from_kcl(cnst: &ConstData, file_name: String, example_name: St
let data = json!({ let data = json!({
"name": cnst.preferred_name, "name": cnst.preferred_name,
"module": cnst.module_name, "module": mod_name_std(&cnst.module_name),
"summary": cnst.summary, "summary": cnst.summary,
"description": cnst.description, "description": cnst.description,
"deprecated": cnst.properties.deprecated, "deprecated": cnst.properties.deprecated,
@ -685,10 +717,10 @@ fn test_generate_stdlib_markdown_docs() {
DocData::Fn(f) => generate_function_from_kcl(f, d.file_name(), d.example_name(), &kcl_std).unwrap(), DocData::Fn(f) => generate_function_from_kcl(f, d.file_name(), d.example_name(), &kcl_std).unwrap(),
DocData::Const(c) => generate_const_from_kcl(c, d.file_name(), d.example_name()).unwrap(), DocData::Const(c) => generate_const_from_kcl(c, d.file_name(), d.example_name()).unwrap(),
DocData::Ty(t) => generate_type_from_kcl(t, d.file_name(), d.example_name()).unwrap(), DocData::Ty(t) => generate_type_from_kcl(t, d.file_name(), d.example_name()).unwrap(),
DocData::Mod(m) => generate_mod_from_kcl(m, d.file_name()).unwrap(), DocData::Mod(m) => generate_mod_from_kcl(m, d.file_name(), &combined).unwrap(),
} }
} }
generate_mod_from_kcl(&kcl_std, "modules/std".to_owned()).unwrap(); generate_mod_from_kcl(&kcl_std, "modules/std".to_owned(), &combined).unwrap();
} }
#[test] #[test]
@ -718,7 +750,11 @@ fn test_generate_stdlib_json_schema() {
async fn test_code_in_topics() { async fn test_code_in_topics() {
let mut join_set = JoinSet::new(); let mut join_set = JoinSet::new();
for entry in fs::read_dir("../../docs/kcl-lang").unwrap() { for entry in fs::read_dir("../../docs/kcl-lang").unwrap() {
let path = entry.unwrap().path(); let entry = entry.unwrap();
if entry.file_type().unwrap().is_dir() {
continue;
}
let path = entry.path();
let text = std::fs::read_to_string(&path).unwrap(); let text = std::fs::read_to_string(&path).unwrap();
for (i, (eg, attr)) in find_examples(&text, &path).into_iter().enumerate() { for (i, (eg, attr)) in find_examples(&text, &path).into_iter().enumerate() {

View File

@ -117,8 +117,10 @@ fn visit_module(name: &str, preferred_prefix: &str, names: WalkForNames) -> Resu
} }
let qual = format!("{}::", &result.qual_name); let qual = format!("{}::", &result.qual_name);
let mut dd = match var.kind { let mut dd = match var.kind {
VariableKind::Fn => DocData::Fn(FnData::from_ast(var, qual, preferred_prefix, name)), VariableKind::Fn => DocData::Fn(FnData::from_ast(var, qual, preferred_prefix, &result.name)),
VariableKind::Const => DocData::Const(ConstData::from_ast(var, qual, preferred_prefix, name)), VariableKind::Const => {
DocData::Const(ConstData::from_ast(var, qual, preferred_prefix, &result.name))
}
}; };
let key = format!("I:{}", dd.qual_name()); let key = format!("I:{}", dd.qual_name());
if result.children.contains_key(&key) { if result.children.contains_key(&key) {
@ -138,7 +140,7 @@ fn visit_module(name: &str, preferred_prefix: &str, names: WalkForNames) -> Resu
continue; continue;
} }
let qual = format!("{}::", &result.qual_name); let qual = format!("{}::", &result.qual_name);
let mut dd = DocData::Ty(TyData::from_ast(ty, qual, preferred_prefix, name)); let mut dd = DocData::Ty(TyData::from_ast(ty, qual, preferred_prefix, &result.name));
let key = format!("T:{}", dd.qual_name()); let key = format!("T:{}", dd.qual_name());
if result.children.contains_key(&key) { if result.children.contains_key(&key) {
continue; continue;
@ -452,10 +454,10 @@ pub struct ModData {
impl ModData { impl ModData {
fn new(name: &str, preferred_prefix: &str) -> Self { fn new(name: &str, preferred_prefix: &str) -> Self {
let (qual_name, module_name) = if name == "prelude" { let (name, qual_name, module_name) = if name == "prelude" {
("std".to_owned(), String::new()) ("std", "std".to_owned(), String::new())
} else { } else {
(format!("std::{}", name), "std".to_owned()) (name, format!("std::{}", name), "std".to_owned())
}; };
Self { Self {
preferred_name: format!("{preferred_prefix}{name}"), preferred_name: format!("{preferred_prefix}{name}"),

View File

@ -1,6 +1,10 @@
--- ---
title: "{{name}}" title: "{{name}}"
{{#if module}}
subtitle: "Module in {{module}}" subtitle: "Module in {{module}}"
{{else}}
subtitle: "Module"
{{/if}}
excerpt: "{{safe_yaml summary}}" excerpt: "{{safe_yaml summary}}"
layout: manual layout: manual
--- ---

View File

@ -39,8 +39,8 @@ base_unit = "mm"
text_wrapping = false text_wrapping = false
"#; "#;
const PROJECT_SETTINGS_DOC_PATH: &str = "../../docs/kcl-lang/settings-project.md"; const PROJECT_SETTINGS_DOC_PATH: &str = "../../docs/kcl-lang/settings/project.md";
const USER_SETTINGS_DOC_PATH: &str = "../../docs/kcl-lang/settings-user.md"; const USER_SETTINGS_DOC_PATH: &str = "../../docs/kcl-lang/settings/user.md";
fn init_handlebars() -> handlebars::Handlebars<'static> { fn init_handlebars() -> handlebars::Handlebars<'static> {
let mut hbs = handlebars::Handlebars::new(); let mut hbs = handlebars::Handlebars::new();