diff --git a/flake.lock b/flake.lock index af436db..6839be2 100644 --- a/flake.lock +++ b/flake.lock @@ -155,11 +155,11 @@ "nixpkgs-regression": "nixpkgs-regression" }, "locked": { - "lastModified": 1702384142, - "narHash": "sha256-AzZ/FLCMp8rqfY5wyFW+VvyEUA8OoZ43aBkAWp7NdPg=", + "lastModified": 1704367076, + "narHash": "sha256-wy+M/+mryU2w4HXO0cWiKeoL2IICR715q+yWacnSg4o=", "owner": "hsjobeki", "repo": "nix", - "rev": "1c33d81594c08fc62e3e94e5496a53524beedf7a", + "rev": "d86596aabc7e480858fd5d024deb8c4092200d47", "type": "github" }, "original": { diff --git a/pesto/test_data/atom/functor.expect b/pesto/test_data/atom/functor.expect new file mode 100644 index 0000000..f856e08 --- /dev/null +++ b/pesto/test_data/atom/functor.expect @@ -0,0 +1 @@ +Some(NixDocComment { content: Some("Docs"), count_applied: None }) \ No newline at end of file diff --git a/pesto/test_data/atom/functor.nix b/pesto/test_data/atom/functor.nix new file mode 100644 index 0000000..a8b473f --- /dev/null +++ b/pesto/test_data/atom/functor.nix @@ -0,0 +1,7 @@ +let + /**Docs*/ + foo = { + __functor = self: x: self; + }; +in +{ inherit foo; } diff --git a/pesto/test_data/atom/functor.pos b/pesto/test_data/atom/functor.pos new file mode 100644 index 0000000..6b3bf13 --- /dev/null +++ b/pesto/test_data/atom/functor.pos @@ -0,0 +1,4 @@ +{ + "line": 3, + "column": 9 +} diff --git a/website/src/app/f/[...path]/page.tsx b/website/src/app/f/[...path]/page.tsx index 1e4dd33..4d5489b 100644 --- a/website/src/app/f/[...path]/page.tsx +++ b/website/src/app/f/[...path]/page.tsx @@ -24,10 +24,11 @@ export async function generateStaticParams(): Promise<{ path: string[] }[]> { interface TocProps { mdxSource: string; + title?: string; } const Toc = async (props: TocProps) => { - const { mdxSource } = props; + const { mdxSource, title } = props; const headings = await extractHeadings(mdxSource); return ( @@ -52,6 +53,21 @@ const Toc = async (props: TocProps) => { No sections )} + {title && ( + + + {title} + + + )} {headings.map((h, idx) => ( { justifyContent: "start", textTransform: "none", color: "text.secondary", - pl: h.level - 1, + pl: h.level, py: 0.5, }} > @@ -150,7 +166,7 @@ export default async function Page(props: { params: { path: string[] } }) { return ( <> - + {item?.meta.title} diff --git a/website/src/components/PositionLink.tsx b/website/src/components/PositionLink.tsx index 7549f57..9576381 100644 --- a/website/src/components/PositionLink.tsx +++ b/website/src/components/PositionLink.tsx @@ -89,7 +89,7 @@ export const PositionLink = ({ Underlying function - {count_applied && count_applied > 0 && ( + {!!count_applied && count_applied > 0 && ( - {next.meta.title} diff --git a/website/src/models/nix.ts b/website/src/models/nix.ts index f7e1704..ed13da0 100644 --- a/website/src/models/nix.ts +++ b/website/src/models/nix.ts @@ -7,6 +7,7 @@ export type NixType = | "string" | "number" | "bool" + | "path" | "never" | "any"; @@ -15,6 +16,7 @@ export const nixTypes: NixType[] = [ "attrset", "list", "string", + "path", "bool", "never", "number", @@ -29,6 +31,10 @@ const interpretToken = (token: string): NixType | undefined => { return token as NixType; } else if (["int", "float", "double"].includes(token)) { return "number"; + } else if (["derivation", "package"].includes(token)) { + return "attrset"; + } else if (["storepath"].includes(token) || token.includes("path")) { + return "path"; } else if (["a", "b", "c", "d", "e"].includes(token)) { return "any"; } else {