diff --git a/docs/content/fsdocs-default.css b/docs/content/fsdocs-default.css index 11aa7e874..1452455b2 100644 --- a/docs/content/fsdocs-default.css +++ b/docs/content/fsdocs-default.css @@ -379,6 +379,8 @@ body { .fsdocs-source-link img { border-style: none; margin-left: 10px; + width: auto; + height: 1.4em; } .fsdocs-source-link .hover { @@ -409,7 +411,7 @@ body { } /*-------------------------------------------------------------------------- - + /*--------------------------------------------------------------------------*/ #fsdocs-content table.pre pre { diff --git a/docs/content/img/copy-blue.png b/docs/content/img/copy-blue.png deleted file mode 100644 index ee45496f9..000000000 Binary files a/docs/content/img/copy-blue.png and /dev/null differ diff --git a/docs/content/img/copy-md-blue.png b/docs/content/img/copy-md-blue.png deleted file mode 100644 index 6a952b7a7..000000000 Binary files a/docs/content/img/copy-md-blue.png and /dev/null differ diff --git a/docs/content/img/copy-md-hover.png b/docs/content/img/copy-md-hover.png new file mode 100644 index 000000000..b14e94129 Binary files /dev/null and b/docs/content/img/copy-md-hover.png differ diff --git a/docs/content/img/copy-md.png b/docs/content/img/copy-md.png index 3a83b331b..72de73815 100644 Binary files a/docs/content/img/copy-md.png and b/docs/content/img/copy-md.png differ diff --git a/docs/content/img/copy-xml-hover.png b/docs/content/img/copy-xml-hover.png new file mode 100644 index 000000000..60fea167a Binary files /dev/null and b/docs/content/img/copy-xml-hover.png differ diff --git a/docs/content/img/copy-xml.png b/docs/content/img/copy-xml.png new file mode 100644 index 000000000..e5606b907 Binary files /dev/null and b/docs/content/img/copy-xml.png differ diff --git a/docs/content/img/copy.png b/docs/content/img/copy.png deleted file mode 100644 index 8fcdc1d4e..000000000 Binary files a/docs/content/img/copy.png and /dev/null differ diff --git a/docs/content/img/github-blue.png b/docs/content/img/github-blue.png deleted file mode 100644 index 57432a035..000000000 Binary files a/docs/content/img/github-blue.png and /dev/null differ diff --git a/docs/content/img/github-hover.png b/docs/content/img/github-hover.png new file mode 100644 index 000000000..65971d4d2 Binary files /dev/null and b/docs/content/img/github-hover.png differ diff --git a/docs/content/img/github.png b/docs/content/img/github.png index 5d48d83fa..ff34f3540 100644 Binary files a/docs/content/img/github.png and b/docs/content/img/github.png differ diff --git a/src/FSharp.Formatting.ApiDocs/GenerateHtml.fs b/src/FSharp.Formatting.ApiDocs/GenerateHtml.fs index 6a9bda82f..564d7ed82 100644 --- a/src/FSharp.Formatting.ApiDocs/GenerateHtml.fs +++ b/src/FSharp.Formatting.ApiDocs/GenerateHtml.fs @@ -41,21 +41,21 @@ type HtmlRender(model: ApiDocModel) = [ match url with | None -> () | Some href -> - a [Href href; Class"fsdocs-source-link" ] [ + a [Href href; Class"fsdocs-source-link"; HtmlProperties.Title "Source on GitHub" ] [ img [Src (sprintf "%scontent/img/github.png" root); Class "normal"] - img [Src (sprintf "%scontent/img/github-blue.png" root); Class "hover"] + img [Src (sprintf "%scontent/img/github-hover.png" root); Class "hover"] ] ] let removeParen (memberName:string) = let firstParen = memberName.IndexOf("(") if firstParen > 0 then memberName.Substring(0, firstParen) else memberName - // Copy XML sig for use in `cref` XML + // Copy XML sig for use in `cref` XML let copyXmlSigIcon xmlDocSig = - div [ Class"fsdocs-source-link"; OnClick (sprintf "Clipboard_CopyTo('')" xmlDocSig) ] [ - img [Src (sprintf "%scontent/img/copy.png" root); Class "normal"] - img [Src (sprintf "%scontent/img/copy-blue.png" root); Class "hover"] - ] + div [ Class"fsdocs-source-link"; HtmlProperties.Title "Copy signature (XML)"; OnClick (sprintf "Clipboard_CopyTo('')" xmlDocSig) ] [ + img [Src (sprintf "%scontent/img/copy-xml.png" root); Class "normal"] + img [Src (sprintf "%scontent/img/copy-xml-hover.png" root); Class "hover"] + ] let copyXmlSigIconForSymbol (symbol: FSharpSymbol) = [ match symbol with @@ -75,10 +75,10 @@ type HtmlRender(model: ApiDocModel) = if xmlDocSig.Contains("``") then "```" elif xmlDocSig.Contains("`") then "``" else "`" - div [ Class"fsdocs-source-link"; OnClick (sprintf "Clipboard_CopyTo('%scref:%s%s')" delim xmlDocSig delim) ] [ + div [ Class"fsdocs-source-link"; HtmlProperties.Title "Copy signature (Markdown)"; OnClick (sprintf "Clipboard_CopyTo('%scref:%s%s')" delim xmlDocSig delim) ] [ img [Src (sprintf "%scontent/img/copy-md.png" root); Class "normal"] - img [Src (sprintf "%scontent/img/copy-md-blue.png" root); Class "hover"] - ] + img [Src (sprintf "%scontent/img/copy-md-hover.png" root); Class "hover"] + ] let copyXmlSigIconForSymbolMarkdown (symbol: FSharpSymbol) = [ match symbol with @@ -104,7 +104,7 @@ type HtmlRender(model: ApiDocModel) = for m in members do tr [] [ td [Class "fsdocs-member-usage"] [ - + codeWithToolTip [ // This adds #MemberName anchor. These may be ambiguous due to overloading p [] [a [Id m.Name] [a [Href ("#"+m.Name)] [embed m.UsageHtml]]] @@ -147,13 +147,13 @@ type HtmlRender(model: ApiDocModel) = // where these have not been explicitly declared match m.FormatTypeArguments with | None -> () - | Some v -> + | Some v -> !!"Type parameters: " encode(v) ] ] ] - + td [Class "fsdocs-member-xmldoc"] [ div [Class "fsdocs-summary"] [ yield! copyXmlSigIconForSymbolMarkdown m.Symbol @@ -209,11 +209,11 @@ type HtmlRender(model: ApiDocModel) = td [] [embed html]] ] - for e in m.Comment.Notes do + for e in m.Comment.Notes do h5 [Class "fsdocs-note-header"] [!! "Note"] p [Class "fsdocs-note"] [embed e] - for e in m.Comment.Examples do + for e in m.Comment.Examples do h5 [Class "fsdocs-example-header"] [!! "Example"] p [Class "fsdocs-example"] [embed e] @@ -240,10 +240,10 @@ type HtmlRender(model: ApiDocModel) = ] ] tbody [] [ - for e in entities do + for e in entities do tr [] [ td [Class "fsdocs-entity-name"] [ - let nm = e.Name + let nm = e.Name let multi = (entities |> List.filter (fun e -> e.Name = nm) |> List.length) > 1 let nmWithSiffix = if multi then (if e.IsTypeDefinition then nm + " (Type)" else nm + " (Module)") else nm @@ -268,7 +268,7 @@ type HtmlRender(model: ApiDocModel) = let entity = info.Entity let members = entity.AllMembers |> List.filter (fun e -> not e.IsObsolete) let byCategory = members |> Categorise.getMembersByCategory - + let usageName = match info.ParentModule with | Some m when m.RequiresQualifiedAccess -> m.Name + "." + entity.Name @@ -283,12 +283,12 @@ type HtmlRender(model: ApiDocModel) = | None -> () | Some parentModule -> dt [] [!! "Parent Module: "; a [Href (parentModule.Url(root, collectionName, qualify, model.FileExtensions.InUrl))] [!! parentModule.Name ]] - + match entity.AbbreviatedType with | Some abbreviatedTyp -> dt [] [!! "Abbreviation For: "; embed abbreviatedTyp] - + | None -> () match entity.BaseType with @@ -305,10 +305,10 @@ type HtmlRender(model: ApiDocModel) = if i <> 0 then !! ", " embed ity ] - + if entity.Symbol.IsValueType then dt [] [!! ("Kind: Struct")] - + match entity.DelegateSignature with | Some d -> dt [] [!! ("Delegate Signature: "); embed d] @@ -338,30 +338,30 @@ type HtmlRender(model: ApiDocModel) = | Some r -> p [Class "fsdocs-remarks"] [embed r] | None -> () - for note in entity.Comment.Notes do + for note in entity.Comment.Notes do h5 [Class "fsdocs-note-header"] [!! "Note"] p [Class "fsdocs-note"] [embed note] - for example in entity.Comment.Examples do + for example in entity.Comment.Examples do h5 [Class "fsdocs-example-header"] [!! "Example"] p [Class "fsdocs-example"] [embed example] ] if (byCategory.Length > 1) then - // If there is more than 1 category in the type, generate TOC + // If there is more than 1 category in the type, generate TOC h3 [] [!!"Table of contents"] ul [] [ for (index, _, name) in byCategory do li [] [ a [Href (sprintf "#section%d" index)] [!! name ] ] ] - + // - + let nestedEntities = entity.NestedEntities |> List.filter (fun e -> not e.IsObsolete) - + if (nestedEntities.Length > 0) then div [] [ h3 [] [!! (if nestedEntities |> List.forall (fun e -> not e.IsTypeDefinition) then "Nested modules" @@ -369,7 +369,7 @@ type HtmlRender(model: ApiDocModel) = else "Types and nested modules")] yield! renderEntities nestedEntities ] - + for (index, ms, name) in byCategory do // Iterate over all the categories and print members. If there are more than one // categories, print the category heading (as

) and add XML comment from the type @@ -400,7 +400,7 @@ type HtmlRender(model: ApiDocModel) = match nsdocs.Remarks with | Some r -> p [] [embed r ] | None -> () - + | None -> () ] @@ -411,17 +411,17 @@ type HtmlRender(model: ApiDocModel) = for category in allByCategory do li [] [a [Href ("#category-" + category.CategoryIndex)] [!!category.CategoryName]] ] - + for category in allByCategory do if (allByCategory.Length > 1) then h3 [] [a [Class "anchor"; Name ("category-" + category.CategoryIndex); Href ("#category-" + category.CategoryIndex)] [!! category.CategoryName]] yield! renderEntities category.CategoryEntites - ] + ] let tableOfNamespacesAux () = [ let categorise = Categorise.model model - + for _allByCategory, ns in categorise do // Generate the entry for the namespace @@ -439,15 +439,15 @@ type HtmlRender(model: ApiDocModel) = [ // For FSharp.Core we make all entries available to other docs else there's not a lot else to show. // - // For non-FSharp.Core we only show one link "API Reference" in the nav menu + // For non-FSharp.Core we only show one link "API Reference" in the nav menu if otherDocs && model.Collection.CollectionName <> "FSharp.Core" then li [Class "nav-header"] [!! "API Reference"] - li [ Class "nav-item" ] [a [Class "nav-link"; Href (model.IndexFileUrl(root, collectionName, qualify, model.FileExtensions.InUrl))] [!! "All Namespaces" ] ] + li [ Class "nav-item" ] [a [Class "nav-link"; Href (model.IndexFileUrl(root, collectionName, qualify, model.FileExtensions.InUrl))] [!! "All Namespaces" ] ] else let categorise = Categorise.model model - - let someExist = categorise.Length > 0 + + let someExist = categorise.Length > 0 if someExist then li [Class "nav-header"] [!! "Namespaces"] @@ -455,7 +455,7 @@ type HtmlRender(model: ApiDocModel) = for allByCategory, ns in categorise do // Generate the entry for the namespace - li [ Class ("nav-item" + + li [ Class ("nav-item" + // add the 'active' class if this is the namespace of the thing being shown match nsOpt with | Some ns2 when ns.Name = ns2.Name -> " active" @@ -521,7 +521,7 @@ type HtmlRender(model: ApiDocModel) = ] ] let pageTitle = sprintf "%s (API Reference)" collectionName - let toc = listOfNamespacesNav false None + let toc = listOfNamespacesNav false None let substitutions = getSubstitutons model.Substitutions toc content pageTitle let outFile = Path.Combine(outDir, model.IndexOutputFile(collectionName, model.Qualify, model.FileExtensions.InFile) ) printfn " Generating %s" outFile @@ -547,4 +547,3 @@ type HtmlRender(model: ApiDocModel) = let outFile = Path.Combine(outDir, info.Entity.OutputFile(collectionName, model.Qualify, model.FileExtensions.InFile)) printfn " Generating %s" outFile SimpleTemplating.UseFileAsSimpleTemplate (substitutions, templateOpt, outFile) -