Skip to content

Commit

Permalink
Merge pull request #2965 from quantified-uncertainty/docs-version-added
Browse files Browse the repository at this point in the history
Adds versionAdded to Docs
  • Loading branch information
OAGr authored Jan 12, 2024
2 parents 3cabe41 + f1ef68c commit 7867967
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 1 deletion.
6 changes: 6 additions & 0 deletions .changeset/popular-fireants-boil.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
"@quri/squiggle-lang": patch
"@quri/squiggle-components": patch
---

Adds versionAdded flag for functions, to tag with version information in documentation.
12 changes: 11 additions & 1 deletion packages/components/src/components/ui/FnDocumentation.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ export const FnDocumentation: FC<{
definitions,
examples,
interactiveExamples,
versionAdded,
} = documentation;
const textSize = size === "small" ? "text-xs" : "text-sm";
const fullName = `${nameSpace ? nameSpace + "." : ""}${name}`;
Expand Down Expand Up @@ -102,7 +103,11 @@ export const FnDocumentation: FC<{
</div>
</Section>
)}
{(isUnit || shorthand || isExperimental || !requiresNamespace) && (
{(isUnit ||
shorthand ||
isExperimental ||
!requiresNamespace ||
versionAdded) && (
<Section>
<div className="flex gap-3">
{isUnit && (
Expand All @@ -128,6 +133,11 @@ export const FnDocumentation: FC<{
{`Namespace optional`}
</div>
)}
{versionAdded && (
<div className={clsx("bg-purple-50 text-slate-600", tagCss)}>
v{versionAdded}
</div>
)}
</div>
</Section>
)}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ Plot.scatter({
shorthand: { type: "unary", symbol: "-" },
description: `**Lorem Ipsum**
More content *here*`,
versionAdded: "0.9.0",
};

export const Simple: Story = {
Expand Down
2 changes: 2 additions & 0 deletions packages/squiggle-lang/src/library/registry/core.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ export type FRFunction = {
isUnit?: boolean;
shorthand?: Shorthand;
displaySection?: string;
versionAdded?: string;
};

type FnNameDict = Map<string, FnDefinition[]>;
Expand All @@ -42,6 +43,7 @@ export type FnDocumentation = Pick<
| "isUnit"
| "shorthand"
| "displaySection"
| "versionAdded"
> & { signatures: string[] };

export class Registry {
Expand Down

3 comments on commit 7867967

@vercel
Copy link

@vercel vercel bot commented on 7867967 Jan 12, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@vercel
Copy link

@vercel vercel bot commented on 7867967 Jan 12, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@vercel
Copy link

@vercel vercel bot commented on 7867967 Jan 12, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.