Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

using an input as a link #718

Merged
merged 12 commits into from
Nov 7, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .config/dotnet-tools.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
]
},
"fantomas-tool": {
"version": "4.6.0-alpha-005",
"version": "4.6.0-alpha-006",
"commands": [
"fantomas"
]
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -43,3 +43,5 @@ tmp
*.binlog
version.props
src/Common/AssemblyInfo.?s
tests/FSharp.Literate.Tests/output1/
.vscode/
63 changes: 3 additions & 60 deletions .paket/Paket.Restore.targets
Original file line number Diff line number Diff line change
Expand Up @@ -289,16 +289,14 @@
<PropertyGroup>
<PaketProjectFile>$(MSBuildProjectDirectory)/$(MSBuildProjectFile)</PaketProjectFile>
<ContinuePackingAfterGeneratingNuspec>true</ContinuePackingAfterGeneratingNuspec>
<UseMSBuild16_10_Pack>false</UseMSBuild16_10_Pack>
<UseMSBuild16_10_Pack Condition=" '@(MSBuildMajorVersion)' >= '16' AND '@(MSBuildMinorVersion)' > '10' ">true</UseMSBuild16_10_Pack>
<UseMSBuild16_0_Pack>false</UseMSBuild16_0_Pack>
<UseMSBuild16_0_Pack Condition=" '@(MSBuildMajorVersion)' >= '16' AND (! $(UseMSBuild16_10_Pack)) ">true</UseMSBuild16_0_Pack>
<UseMSBuild16_0_Pack Condition=" '@(MSBuildMajorVersion)' >= '16' ">true</UseMSBuild16_0_Pack>
<UseMSBuild15_9_Pack>false</UseMSBuild15_9_Pack>
<UseMSBuild15_9_Pack Condition=" '@(MSBuildMajorVersion)' == '15' AND '@(MSBuildMinorVersion)' > '8' ">true</UseMSBuild15_9_Pack>
<UseMSBuild15_8_Pack>false</UseMSBuild15_8_Pack>
<UseMSBuild15_8_Pack Condition=" '$(NuGetToolVersion)' != '4.0.0' AND (! $(UseMSBuild15_9_Pack)) AND (! $(UseMSBuild16_0_Pack)) AND (! $(UseMSBuild16_10_Pack)) ">true</UseMSBuild15_8_Pack>
<UseMSBuild15_8_Pack Condition=" '$(NuGetToolVersion)' != '4.0.0' AND (! $(UseMSBuild15_9_Pack)) AND (! $(UseMSBuild16_0_Pack)) ">true</UseMSBuild15_8_Pack>
<UseNuGet4_Pack>false</UseNuGet4_Pack>
<UseNuGet4_Pack Condition=" (! $(UseMSBuild15_8_Pack)) AND (! $(UseMSBuild15_9_Pack)) AND (! $(UseMSBuild16_0_Pack)) AND (! $(UseMSBuild16_10_Pack)) ">true</UseNuGet4_Pack>
<UseNuGet4_Pack Condition=" (! $(UseMSBuild15_8_Pack)) AND (! $(UseMSBuild15_9_Pack)) AND (! $(UseMSBuild16_0_Pack)) ">true</UseNuGet4_Pack>
<AdjustedNuspecOutputPath>$(PaketIntermediateOutputPath)\$(Configuration)</AdjustedNuspecOutputPath>
<AdjustedNuspecOutputPath Condition="@(_NuspecFilesNewLocation) == ''">$(PaketIntermediateOutputPath)</AdjustedNuspecOutputPath>
</PropertyGroup>
Expand All @@ -316,53 +314,6 @@
</ConvertToAbsolutePath>

<!-- Call Pack -->
<PackTask Condition="$(UseMSBuild16_10_Pack)"
PackItem="$(PackProjectInputFile)"
PackageFiles="@(_PackageFiles)"
PackageFilesToExclude="@(_PackageFilesToExclude)"
PackageVersion="$(PackageVersion)"
PackageId="$(PackageId)"
Title="$(Title)"
Authors="$(Authors)"
Description="$(Description)"
Copyright="$(Copyright)"
RequireLicenseAcceptance="$(PackageRequireLicenseAcceptance)"
LicenseUrl="$(PackageLicenseUrl)"
ProjectUrl="$(PackageProjectUrl)"
IconUrl="$(PackageIconUrl)"
ReleaseNotes="$(PackageReleaseNotes)"
Tags="$(PackageTags)"
DevelopmentDependency="$(DevelopmentDependency)"
BuildOutputInPackage="@(_BuildOutputInPackage)"
TargetPathsToSymbols="@(_TargetPathsToSymbols)"
SymbolPackageFormat="$(SymbolPackageFormat)"
TargetFrameworks="@(_TargetFrameworks)"
AssemblyName="$(AssemblyName)"
PackageOutputPath="$(PackageOutputAbsolutePath)"
IncludeSymbols="$(IncludeSymbols)"
IncludeSource="$(IncludeSource)"
PackageTypes="$(PackageType)"
IsTool="$(IsTool)"
RepositoryUrl="$(RepositoryUrl)"
RepositoryType="$(RepositoryType)"
SourceFiles="@(_SourceFiles->Distinct())"
NoPackageAnalysis="$(NoPackageAnalysis)"
MinClientVersion="$(MinClientVersion)"
Serviceable="$(Serviceable)"
FrameworkAssemblyReferences="@(_FrameworkAssemblyReferences)"
ContinuePackingAfterGeneratingNuspec="$(ContinuePackingAfterGeneratingNuspec)"
NuspecOutputPath="$(AdjustedNuspecOutputPath)"
IncludeBuildOutput="$(IncludeBuildOutput)"
BuildOutputFolders="$(BuildOutputTargetFolder)"
ContentTargetFolders="$(ContentTargetFolders)"
RestoreOutputPath="$(RestoreOutputAbsolutePath)"
NuspecFile="$(NuspecFileAbsolutePath)"
NuspecBasePath="$(NuspecBasePath)"
NuspecProperties="$(NuspecProperties)"
PackageLicenseFile="$(PackageLicenseFile)"
PackageLicenseExpression="$(PackageLicenseExpression)"
PackageLicenseExpressionVersion="$(PackageLicenseExpressionVersion)"
PackageReadmeFile="$(PackageReadmeFile)" />
<PackTask Condition="$(UseMSBuild16_0_Pack)"
PackItem="$(PackProjectInputFile)"
PackageFiles="@(_PackageFiles)"
Expand Down Expand Up @@ -392,8 +343,6 @@
IsTool="$(IsTool)"
RepositoryUrl="$(RepositoryUrl)"
RepositoryType="$(RepositoryType)"
RepositoryBranch="$(RepositoryBranch)"
RepositoryCommit="$(RepositoryCommit)"
SourceFiles="@(_SourceFiles->Distinct())"
NoPackageAnalysis="$(NoPackageAnalysis)"
MinClientVersion="$(MinClientVersion)"
Expand Down Expand Up @@ -441,8 +390,6 @@
IsTool="$(IsTool)"
RepositoryUrl="$(RepositoryUrl)"
RepositoryType="$(RepositoryType)"
RepositoryBranch="$(RepositoryBranch)"
RepositoryCommit="$(RepositoryCommit)"
SourceFiles="@(_SourceFiles->Distinct())"
NoPackageAnalysis="$(NoPackageAnalysis)"
MinClientVersion="$(MinClientVersion)"
Expand Down Expand Up @@ -486,8 +433,6 @@
IsTool="$(IsTool)"
RepositoryUrl="$(RepositoryUrl)"
RepositoryType="$(RepositoryType)"
RepositoryBranch="$(RepositoryBranch)"
RepositoryCommit="$(RepositoryCommit)"
SourceFiles="@(_SourceFiles->Distinct())"
NoPackageAnalysis="$(NoPackageAnalysis)"
MinClientVersion="$(MinClientVersion)"
Expand Down Expand Up @@ -530,8 +475,6 @@
IsTool="$(IsTool)"
RepositoryUrl="$(RepositoryUrl)"
RepositoryType="$(RepositoryType)"
RepositoryBranch="$(RepositoryBranch)"
RepositoryCommit="$(RepositoryCommit)"
SourceFiles="@(_SourceFiles->Distinct())"
NoPackageAnalysis="$(NoPackageAnalysis)"
MinClientVersion="$(MinClientVersion)"
Expand Down
2 changes: 1 addition & 1 deletion FSharp.Formatting.sln
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ Project("{6EC3EE1D-3C4E-46DD-8F32-0CC8E7565705}") = "FSharp.Formatting.Literate"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "FSharp.Formatting.CSharpFormat", "src\FSharp.Formatting.CSharpFormat\FSharp.Formatting.CSharpFormat.csproj", "{9AB3650B-CC24-4404-A175-A573DA928475}"
EndProject
Project("{6EC3EE1D-3C4E-46DD-8F32-0CC8E7565705}") = "FSharp.Formatting.CommandTool", "src\FSharp.Formatting.CommandTool\FSharp.Formatting.CommandTool.fsproj", "{D30F7F2B-A4E3-4A07-A1BD-ED3EB21768F8}"
Project("{6EC3EE1D-3C4E-46DD-8F32-0CC8E7565705}") = "fsdocs-tool", "src\fsdocs-tool\fsdocs-tool.fsproj", "{D30F7F2B-A4E3-4A07-A1BD-ED3EB21768F8}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "test", "test", "{8D44B659-E9F7-4CE4-B5DA-D37CDDCD2525}"
ProjectSection(SolutionItems) = preProject
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ See https://fsprojects.github.io/FSharp.Formatting/
One built you can run the command-line tool to self-build the docs for this directory using

dotnet build
src\FSharp.Formatting.CommandTool\bin\Debug\net5.0\fsdocs.exe watch
src\FSharp.Formatting.CommandTool\bin\Debug\net5.0\fsdocs.exe build --clean
src\fsdocs-tool\bin\Debug\net5.0\fsdocs.exe watch
src\fsdocs-tool\bin\Debug\net5.0\fsdocs.exe build --clean


## Maintainer(s)
Expand Down
6 changes: 5 additions & 1 deletion RELEASE_NOTES.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 12.0.0

* [Allow input-->output link translation](https://github.com/fsprojects/FSharp.Formatting/pull/718)

## 11.5.1

* [Allow user-set ids for xmldoc example nodes](https://github.com/fsprojects/FSharp.Formatting/pull/704)
Expand Down Expand Up @@ -558,7 +562,7 @@
* 2.2.12-beta - Better compatibility for the default font style
* 2.3.1-beta - Using new compiler services API, improved docs
* 2.3.2-beta - Update to FSharp.Compiler.Service v0.0.10
* 2.3.3-beta - Update FSharp.Compiler.Service and add FSharp.Formatting.CommandTool package
* 2.3.3-beta - Update FSharp.Compiler.Service and add fsdocs-tool package
* 2.3.4-beta - Fix dependency in NuGet package
* 2.3.5-beta - Omit non-public members from metadata docs by default
* 2.3.6-beta - Update documentation, fixes for Mono compatibility
Expand Down
7 changes: 3 additions & 4 deletions build.fsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,7 @@ let artifactsDir = __SOURCE_DIRECTORY__ @@ "artifacts"
// Read release notes document
let release = ReleaseNotes.load "RELEASE_NOTES.md"

let projectRepo =
"https://github.com/fsprojects/FSharp.Formatting"
let projectRepo = "https://github.com/fsprojects/FSharp.Formatting"

// --------------------------------------------------------------------------------------
// Generate assembly info files with the right version & up-to-date information
Expand Down Expand Up @@ -124,7 +123,7 @@ Target.create "GenerateDocs" (fun _ ->
+ artifactsDir
+ " --tool-path "
+ artifactsDir
+ " FSharp.Formatting.CommandTool")
+ " fsdocs-tool")
|> ignore

CreateProcess.fromRawCommand
Expand All @@ -138,7 +137,7 @@ Target.create "GenerateDocs" (fun _ ->
|> Proc.run
|> ignore
// DotNet.exec id "fsdocs" "build --strict --clean --properties Configuration=Release" |> ignore
// DotNet.exec id "tool" "uninstall --local FSharp.Formatting.CommandTool" |> ignore
// DotNet.exec id "tool" "uninstall --local fsdocs-tool" |> ignore
Shell.cleanDir ".packages")

Target.create "All" ignore
Expand Down
2 changes: 1 addition & 1 deletion docs/_template.ipynb
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{{cells}}

3 changes: 1 addition & 2 deletions docs/apidocs.fsx
Original file line number Diff line number Diff line change
Expand Up @@ -254,8 +254,7 @@ open System.IO
For example the `cref:M:FSharp.Formatting.ApiDocs.ApiDocs.GenerateHtml` method:
*)

let file =
Path.Combine(root, "bin/YourLibrary.dll")
let file = Path.Combine(root, "bin/YourLibrary.dll")

let input = ApiDocInput.FromFile(file)

Expand Down
2 changes: 1 addition & 1 deletion docs/commandline.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ index: 1
To use F# Formatting tools via the command line, you can use the `fsdocs` dotnet tool.

[lang=text]
dotnet tool install FSharp.Formatting.CommandTool
dotnet tool install fsdocs-tool
dotnet fsdocs [command] [options]

## The build command
Expand Down
10 changes: 10 additions & 0 deletions docs/content.fsx
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,17 @@ The `categoryindex` determines the ordering of categories.
The `index` determines the ordering of within each category.
The `title` is used in the navigation bar instead of any title inferred from the document.

## Link Translation for Inputs

If an input is used in markdown as a target of a markdown direct link then that is replaced by the output file. For example:

[Some Text](some-file.md)

becomes

[Some Text](some-file.html)

if `some-file.md` is one of the inputs.

## Multi-language Content

Expand Down
6 changes: 2 additions & 4 deletions docs/evaluation.fsx
Original file line number Diff line number Diff line change
Expand Up @@ -119,8 +119,7 @@ let a = 10
// Create evaluator and parse script
let fsi = FsiEvaluator()

let doc =
Literate.ParseScriptString(content, fsiEvaluator = fsi)
let doc = Literate.ParseScriptString(content, fsiEvaluator = fsi)

Literate.ToHtml(doc)
(**
Expand Down Expand Up @@ -184,8 +183,7 @@ let listy =
let test = ["one";"two";"three"]
(*** include-value:test ***)"""

let docOl =
Literate.ParseScriptString(listy, fsiEvaluator = fsiEvaluator)
let docOl = Literate.ParseScriptString(listy, fsiEvaluator = fsiEvaluator)

Literate.ToHtml(docOl)
(**
Expand Down
2 changes: 1 addition & 1 deletion docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ generating API documentation. F# Formatting package is used by this project and
To use the tool, install and use the [fsdocs](commandline.html) tool in a typical F# project with
F# project files plus markdown and script content in the `docs` directory:

dotnet tool install FSharp.Formatting.CommandTool
dotnet tool install fsdocs-tool
dotnet fsdocs build
dotnet fsdocs watch

Expand Down
40 changes: 17 additions & 23 deletions docs/literate.fsx
Original file line number Diff line number Diff line change
Expand Up @@ -195,20 +195,20 @@ Literate scripts and markdown can by turned into LaTex, Python Notebooks and F#
A header may be needed to get the code to load, a typical example is this:

```text
(*** condition: prepare ***)
#nowarn "211"
#I "../src/FSharp.Formatting/bin/Release/netstandard2.1"
#r "FSharp.Formatting.Common.dll"
#r "FSharp.Formatting.Markdown.dll"
#r "FSharp.Formatting.CodeFormat.dll"
#r "FSharp.Formatting.Literate.dll"
(*** condition: fsx ***)
(*** condition: prepare ***)
#nowarn "211"
#I "../src/FSharp.Formatting/bin/Release/netstandard2.1"
#r "FSharp.Formatting.Common.dll"
#r "FSharp.Formatting.Markdown.dll"
#r "FSharp.Formatting.CodeFormat.dll"
#r "FSharp.Formatting.Literate.dll"
(*** condition: fsx ***)
#if FSX
#r "nuget: FSharp.Formatting,{{package-version}}"
#r "nuget: FSharp.Formatting,{{package-version}}"
#endif // FSX
(*** condition: ipynb ***)
(*** condition: ipynb ***)
#if IPYNB
#r "nuget: FSharp.Formatting,{{package-version}}"
#r "nuget: FSharp.Formatting,{{package-version}}"
#endif // IPYNB
```

Expand All @@ -223,13 +223,11 @@ open FSharp.Formatting.Literate
let source = __SOURCE_DIRECTORY__
let template = Path.Combine(source, "template.html")

let script =
Path.Combine(source, "../docs/script.fsx")
let script = Path.Combine(source, "../docs/script.fsx")

Literate.ConvertScriptFile(script, template)

let doc =
Path.Combine(source, "../docs/document.md")
let doc = Path.Combine(source, "../docs/document.md")

Literate.ConvertMarkdownFile(doc, template)

Expand Down Expand Up @@ -257,13 +255,11 @@ example shows how to call the methods to generate LaTeX documents:
*)
let templateTex = Path.Combine(source, "template.tex")

let scriptTex =
Path.Combine(source, "../docs/script.fsx")
let scriptTex = Path.Combine(source, "../docs/script.fsx")

Literate.ConvertScriptFile(scriptTex, templateTex, outputKind = OutputKind.Latex)

let docTex =
Path.Combine(source, "../docs/document.md")
let docTex = Path.Combine(source, "../docs/document.md")

Literate.ConvertMarkdownFile(docTex, templateTex, outputKind = OutputKind.Latex)

Expand All @@ -275,13 +271,11 @@ by setting the named parameter `format` to `OutputKind.Pynb`:
*)

// Process script file, Markdown document and a directory
let scriptPynb =
Path.Combine(source, "../docs/script.fsx")
let scriptPynb = Path.Combine(source, "../docs/script.fsx")

Literate.ConvertScriptFile(scriptPynb, outputKind = OutputKind.Pynb)

let docPynb =
Path.Combine(source, "../docs/document.md")
let docPynb = Path.Combine(source, "../docs/document.md")

Literate.ConvertMarkdownFile(docPynb, outputKind = OutputKind.Pynb)

Expand Down
4 changes: 2 additions & 2 deletions docs/upgrade.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ Here are the typical steps to upgrade a repo based on `ProjectScaffold` to use `

[lang=text]
dotnet new tool
dotnet tool install FSharp.Formatting.CommandTool
dotnet tool install fsdocs-tool

2. Delete all of `docs\tools` particularly `docs\tool\generate.fsx`. Keep a copy of any templates for reference as you'll have to copy some bits across to the new template.

Expand Down Expand Up @@ -54,7 +54,7 @@ Here are the typical steps to upgrade a repo based on `ProjectScaffold` to use `
Sample commands:

[lang=text]
dotnet tool install FSharp.Formatting.CommandTool --local
dotnet tool install fsdocs-tool --local
git add dotnet-tools.json
git rm -fr docs/tools
git mv docs/input/* docs
Expand Down
10 changes: 5 additions & 5 deletions paket.dependencies
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@ storage: none
nuget FSharp.Core >= 4.7 lowest_matching:true
nuget FSharp.Compiler.Service 40.0.0
nuget CommandLineParser ~> 2.8
nuget Microsoft.Build.Framework copy_local: false
nuget Microsoft.Build.Tasks.Core copy_local: false
nuget Microsoft.Build.Utilities.Core copy_local: false
nuget Ionide.ProjInfo
nuget Ionide.ProjInfo.Sln
nuget Microsoft.Build.Framework
nuget Microsoft.Build.Tasks.Core
nuget Microsoft.Build.Utilities.Core
nuget Ionide.ProjInfo 0.53.1
nuget Ionide.ProjInfo.Sln 0.53.1
nuget Newtonsoft.Json
nuget Suave
nuget System.Memory
Expand Down
Loading