improved rendering of types & builtins types

This commit is contained in:
hsjobeki 2023-01-31 10:06:14 +01:00
parent 358048027d
commit c1932d5cd0
4 changed files with 87 additions and 84 deletions

View File

@ -28,10 +28,10 @@ export const CodeHighlight = (props: CodeHighlightProps) => {
sx={{ sx={{
"&.MuiBox-root": { "&.MuiBox-root": {
width: "100%", width: "100%",
marginTop: 0, margin: 0,
}, },
"&.MuiBox-root>pre": { "&.MuiBox-root>pre": {
marginTop: 0, margin: 0,
}, },
"&.MuiBox-root>pre code.hljs": { "&.MuiBox-root>pre code.hljs": {
bgcolor: background || undefined, bgcolor: background || undefined,

View File

@ -178,8 +178,8 @@ export const Preview = (props: PreviewProps) => {
fontSize: 14, fontSize: 14,
}} }}
secondaryTypographyProps={{ secondaryTypographyProps={{
color: fn_type ? "text.primary" : "text.secondary", // color: fn_type ? "text.primary" : "text.secondary",
fontSize: "1rem", fontSize: theme.typography.fontSize + 4,
}} }}
secondary={ secondary={
fn_type ? ( fn_type ? (
@ -195,6 +195,7 @@ export const Preview = (props: PreviewProps) => {
primary="function signature " primary="function signature "
/> />
</ListItem> </ListItem>
{console.log({ fn_type })}
{example && ( {example && (
<ListItem <ListItem
sx={{ sx={{

View File

@ -315,11 +315,11 @@
"rust-overlay": "rust-overlay" "rust-overlay": "rust-overlay"
}, },
"locked": { "locked": {
"lastModified": 1675069119, "lastModified": 1675155227,
"narHash": "sha256-iEIPjUIZ3NYcESF5AWj/BPCuO5//r7NvyTzYSZlCaTk=", "narHash": "sha256-2yOid81G2AloUVoTKZfKQyalNFJ2EvvHxnzcFMDt1qU=",
"owner": "hsjobeki", "owner": "hsjobeki",
"repo": "nixdoc", "repo": "nixdoc",
"rev": "c3e3dde0af8f7e2a61db7e3f51768e764b7643e0", "rev": "6a6c165e2c1fa8b05b22ac683e2c71fff15fe87b",
"type": "github" "type": "github"
}, },
"original": { "original": {

View File

@ -1,107 +1,109 @@
{ {
"abort": { "fn_type": "abort :: string" }, "abort": { "fn_type": "abort :: String" },
"add": { "fn_type": "add :: number -> number -> number" }, "add": { "fn_type": "add :: Number -> Number -> Number" },
"all": { "fn_type": "all :: (a -> bool) -> [a] -> bool" }, "all": { "fn_type": "all :: (a -> Bool) -> [a] -> Bool" },
"any": { "fn_type": "any :: (a -> bool) -> [a] -> bool" }, "Any": { "fn_type": "Any :: (a -> Bool) -> [a] -> Bool" },
"attrNames": { "fn_type": "attrNames :: AttrSet -> [a]" }, "attrNames": { "fn_type": "attrNames :: AttrSet -> [a]" },
"attrValues": { "fn_type": "attrValues :: AttrSet -> [a]" }, "attrValues": { "fn_type": "attrValues :: AttrSet -> [a]" },
"baseNameOf": { "fn_type": "baseNameOf :: string -> string" }, "baseNameOf": { "fn_type": "baseNameOf :: String -> String" },
"bitAnd": { "fn_type": "bitAnd :: int -> int -> int" }, "bitAnd": { "fn_type": "bitAnd :: Int -> Int -> Int" },
"bitOr": { "fn_type": "bitOr :: int -> int -> int" }, "bitOr": { "fn_type": "bitOr :: Int -> Int -> Int" },
"bitXor": { "fn_type": "bitXor :: int -> int -> int" }, "bitXor": { "fn_type": "bitXor :: Int -> Int -> Int" },
"break": { "fn_type": "break :: a -> a" }, "break": { "fn_type": "break :: a -> a" },
"catAttrs": { "fn_type": "cattAtrs :: string -> [AttrSet] -> [a]" }, "catAttrs": {
"ceil": { "fn_type": "ceil :: double -> int" }, "fn_type": "cattAtrs :: String -> [ { ${name} :: a } ] -> [a]"
"compareVersions": {
"fn_type": "compareVersions :: string -> string -> int"
}, },
"concatLists": { "fn_type": "concatLists :: [list] -> []" }, "ceil": { "fn_type": "ceil :: Float -> Int" },
"compareVersions": {
"fn_type": "compareVersions :: String -> String -> Int"
},
"concatLists": { "fn_type": "concatLists :: [List] -> []" },
"concatMap": { "fn_type": "concatMap :: (a -> b) -> [a] -> [b]" }, "concatMap": { "fn_type": "concatMap :: (a -> b) -> [a] -> [b]" },
"concatStringsSep": { "concatStringsSep": {
"fn_type": "concatStringsSep :: string -> [string] -> string" "fn_type": "concatStringsSep :: String -> [String] -> String"
}, },
"deepSeq": { "fn_type": "deepSeq :: a -> b -> b" }, "deepSeq": { "fn_type": "deepSeq :: a -> b -> b" },
"dirOf": { "fn_type": "dirOf :: string -> string" }, "dirOf": { "fn_type": "dirOf :: String -> String" },
"div": { "fn_type": "div :: number -> number -> number" }, "div": { "fn_type": "div :: Number -> Number -> Number" },
"elem": { "fn_type": "elem :: a -> [b] -> bool" }, "elem": { "fn_type": "elem :: a -> [b] -> Bool" },
"elemAt": { "fn_type": "elemAt :: [a] -> int -> b" }, "elemAt": { "fn_type": "elemAt :: [a] -> Int -> b" },
"fetchClosure": { "fn_type": "fetchClosure :: attrSet -> attrSet" }, "fetchClosure": { "fn_type": "fetchClosure :: AttrSet -> AttrSet" },
"fetchGit": { "fn_type": "fetchgit :: attrSet -> attrSet" }, "fetchGit": { "fn_type": "fetchgit :: AttrSet -> AttrSet" },
"fetchTarball": { "fn_type": "fetchTarball :: attrSet -> attrSet" }, "fetchTarball": { "fn_type": "fetchTarball :: AttrSet -> AttrSet" },
"fetchurl": { "fn_type": "fetchurl :: string -> attrSet" }, "fetchurl": { "fn_type": "fetchurl :: String -> AttrSet" },
"filter": { "fn_type": "filter :: (a -> bool) -> [a] -> [b]" }, "filter": { "fn_type": "filter :: (a -> Bool) -> [a] -> [b]" },
"filterSource": { "filterSource": {
"fn_type": "filterSource :: (path :: string -> type :: string -> bool) -> path -> storePath :: string" "fn_type": "filterSource :: (Path -> String -> Bool) -> Path -> StorePath"
}, },
"floor": { "fn_type": "floor :: double -> int" }, "floor": { "fn_type": "floor :: Float -> Int" },
"foldl'": { "foldl'": {
"fn_type": "foldl' :: (acc :: a -> curr :: b -> c) -> init :: a -> [b] -> c" "fn_type": "foldl' :: (a -> b -> c) -> a -> [b] -> c"
}, },
"fromJSON": { "fn_type": "fromJSON :: string -> a" }, "fromJSON": { "fn_type": "fromJSON :: String -> a" },
"functionArgs": { "fn_type": "functionArgs :: (a) -> attrSet" }, "functionArgs": { "fn_type": "functionArgs :: (a) -> AttrSet" },
"genList": { "fn_type": "genList :: (a -> b) -> a -> [b]" }, "genList": { "fn_type": "genList :: (a -> b) -> a -> [b]" },
"genericClosure": { "fn_type": "genericClosure :: attrSet -> [attrSet]" }, "genericClosure": { "fn_type": "genericClosure :: AttrSet -> [AttrSet]" },
"getAttr": { "fn_type": "getAttr :: string -> attrSet -> a" }, "getAttr": { "fn_type": "getAttr :: String -> AttrSet -> a" },
"getEnv": { "fn_type": "getEnv :: string -> string" }, "getEnv": { "fn_type": "getEnv :: String -> String" },
"getFlake": { "fn_type": "getFlake :: attrSet -> attrSet" }, "getFlake": { "fn_type": "getFlake :: AttrSet -> AttrSet" },
"groupBy": { "fn_type": "groupBy :: (a -> b) -> [a] -> attrSet" }, "groupBy": { "fn_type": "groupBy :: (a -> b) -> [a] -> AttrSet" },
"hasAttr": { "fn_type": "hasAttr :: string -> attrSet -> bool" }, "hasAttr": { "fn_type": "hasAttr :: String -> AttrSet -> Bool" },
"hashFile": { "fn_type": "hashFile :: string -> path -> string" }, "hashFile": { "fn_type": "hashFile :: String -> Path -> String" },
"hashString": { "fn_type": "hashString :: string -> string -> string" }, "hashString": { "fn_type": "hashString :: String -> String -> String" },
"head": { "fn_type": "head :: [a] -> a" }, "head": { "fn_type": "head :: [a] -> a" },
"import": { "fn_type": "import :: path -> a" }, "import": { "fn_type": "import :: Path -> a" },
"intersectAttrs": { "intersectAttrs": {
"fn_type": "intersectAttrs :: attrSet -> attrSet -> attrSet" "fn_type": "intersectAttrs :: AttrSet -> AttrSet -> AttrSet"
}, },
"isAttrs": { "fn_type": "isAttrs :: a -> bool" }, "isAttrs": { "fn_type": "isAttrs :: a -> Bool" },
"isBool": { "fn_type": "isBool :: a -> bool" }, "isBool": { "fn_type": "isBool :: a -> Bool" },
"isFloat": { "fn_type": "isFloat :: a -> bool" }, "isFloat": { "fn_type": "isFloat :: a -> Bool" },
"isFunction": { "fn_type": "isFunction :: a -> bool" }, "isFunction": { "fn_type": "isFunction :: a -> Bool" },
"isInt": { "fn_type": "isInt :: a -> bool" }, "isInt": { "fn_type": "isInt :: a -> Bool" },
"isList": { "fn_type": "isList :: a -> bool" }, "isList": { "fn_type": "isList :: a -> Bool" },
"isNull": { "fn_type": "isNull :: a -> bool" }, "isNull": { "fn_type": "isNull :: a -> Bool" },
"isPath": { "fn_type": "isPath :: a -> bool" }, "isPath": { "fn_type": "isPath :: a -> Bool" },
"isString": { "fn_type": "isString :: a -> bool" }, "isString": { "fn_type": "isString :: a -> Bool" },
"length": { "fn_type": "length :: [a] -> int" }, "length": { "fn_type": "length :: [a] -> Int" },
"lessThan": { "fn_type": "lessThan :: number -> number -> bool" }, "lessThan": { "fn_type": "lessThan :: Number -> Number -> Bool" },
"listToAttrs": { "listToAttrs": {
"fn_type": "listToAttrs :: [{name :: string; value :: a}] -> attrSet" "fn_type": "listToAttrs :: [{name :: String; value :: a}] -> AttrSet"
}, },
"map": { "fn_type": "map :: (a -> b) -> [a] -> [b]" }, "map": { "fn_type": "map :: (a -> b) -> [a] -> [b]" },
"mapAttrs": { "fn_type": "mapAttrs :: (a -> b -> c) -> attrSet -> attrSet" }, "mapAttrs": { "fn_type": "mapAttrs :: (a -> b -> c) -> AttrSet -> AttrSet" },
"match": { "fn_type": "match :: string -> string -> bool" }, "match": { "fn_type": "match :: String -> String -> Bool" },
"mul": { "fn_type": "mul :: number -> number -> number" }, "mul": { "fn_type": "mul :: Number -> Number -> Number" },
"parseDrvName": { "fn_type": "parseDrvName :: string -> attrSet" }, "parseDrvName": { "fn_type": "parseDrvName :: String -> AttrSet" },
"partition": { "fn_type": "partition :: (a -> bool) -> [a] -> attrSet" }, "partition": { "fn_type": "partition :: (a -> Bool) -> [a] -> AttrSet" },
"path": { "fn_type": "path :: attrSet -> storePath" }, "Path": { "fn_type": "Path :: AttrSet -> StorePath" },
"pathExists": { "fn_type": "pathExists :: path -> bool" }, "pathExists": { "fn_type": "pathExists :: Path -> Bool" },
"placeholder": { "fn_type": "placeholder :: string -> string" }, "placeholder": { "fn_type": "placeholder :: String -> String" },
"readDir": { "fn_type": "readDir :: path -> attrSet" }, "readDir": { "fn_type": "readDir :: Path -> AttrSet" },
"readFile": { "fn_type": "readFile :: path -> string" }, "readFile": { "fn_type": "readFile :: Path -> String" },
"removeAttrs": { "fn_type": "removeAttrs :: attrSet -> [a] -> attrSet" }, "removeAttrs": { "fn_type": "removeAttrs :: AttrSet -> [a] -> AttrSet" },
"replaceStrings": { "replaceStrings": {
"fn_type": "replaceStrings :: [string] -> [string] -> string -> string" "fn_type": "replaceStrings :: [String] -> [String] -> String -> String"
}, },
"seq": { "fn_type": "seq :: a -> b -> b" }, "seq": { "fn_type": "seq :: a -> b -> b" },
"sort": { "fn_type": "sort :: (a -> b -> bool) -> [a] -> [b]" }, "sort": { "fn_type": "sort :: (a -> b -> Bool) -> [a] -> [b]" },
"split": { "fn_type": "split :: string -> string -> [string]" }, "split": { "fn_type": "split :: String -> String -> [String]" },
"splitVersion": { "fn_type": "splitVersion :: string -> [string]" }, "splitVersion": { "fn_type": "splitVersion :: String -> [String]" },
"storePath": { "fn_type": "storePath :: storePath -> storePath" }, "StorePath": { "fn_type": "StorePath :: StorePath -> StorePath" },
"stringLength": { "fn_type": "stringLength :: string -> int" }, "stringLength": { "fn_type": "stringLength :: String -> Int" },
"sub": { "fn_type": "sub :: number -> number -> number" }, "sub": { "fn_type": "sub :: Number -> Number -> Number" },
"substring": { "fn_type": "substring :: int -> int -> string -> string" }, "substring": { "fn_type": "substring :: Int -> Int -> String -> String" },
"tail": { "fn_type": "tail :: [a] -> a" }, "tail": { "fn_type": "tail :: [a] -> a" },
"throw": { "fn_type": "throw :: string" }, "throw": { "fn_type": "throw :: String" },
"toFile": { "fn_type": "toFile :: path -> string -> storePath" }, "toFile": { "fn_type": "toFile :: Path -> String -> StorePath " },
"toJSON": { "fn_type": "toJSON :: a -> string" }, "toJSON": { "fn_type": "toJSON :: a -> String" },
"toPath": { "fn_type": "toPath :: string -> path" }, "toPath": { "fn_type": "toPath :: String -> Path" },
"toString": { "fn_type": "toString :: a -> string" }, "toString": { "fn_type": "toString :: a -> String" },
"toXML": { "fn_type": "toXML :: a -> string" }, "toXML": { "fn_type": "toXML :: a -> String" },
"trace": { "fn_type": "trace :: a -> b -> b" }, "trace": { "fn_type": "trace :: a -> b -> b" },
"traceVerbose": { "fn_type": "traceVerbose :: a -> b -> b" }, "traceVerbose": { "fn_type": "traceVerbose :: a -> b -> b" },
"tryEval": { "fn_type": "tryEval :: a" }, "tryEval": { "fn_type": "tryEval :: a" },
"typeOf": { "fn_type": "typeOf :: a -> string" }, "typeOf": { "fn_type": "typeOf :: a -> String" },
"zipAttrsWith": { "zipAttrsWith": {
"fn_type": "zipAttrsWith :: (name:: string -> values :: [a]) -> [a] -> attrSet" "fn_type": "zipAttrsWith :: (String -> [a] ) -> [a] -> AttrSet"
} }
} }