Skip to content

Commit 43e9669

Browse files
phil-scott-78patriksvensson
authored andcommitted
Update documentation packages to latest versions
* HighlightService was modified to support GetClassifiedSpansAsync method * Updated Program.cs to pull in the proper location of the Json and ImageSharp extension projects * Statiq must have changed how they are doing xrefs, so I adjusted those to be more specific with a few links
1 parent ab8384a commit 43e9669

12 files changed

+39
-26
lines changed

docs/Docs.csproj

+7-7
Original file line numberDiff line numberDiff line change
@@ -33,13 +33,13 @@
3333
</ItemGroup>
3434

3535
<ItemGroup>
36-
<PackageReference Include="Microsoft.Playwright" Version="1.19.0" />
37-
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
38-
<PackageReference Include="Statiq.CodeAnalysis" Version="1.0.0-beta.58" />
39-
<PackageReference Include="Statiq.Common" Version="1.0.0-beta.58" />
40-
<PackageReference Include="Statiq.Web" Version="1.0.0-beta.44" />
41-
<PackageReference Include="MinVer" PrivateAssets="All" Version="2.5.0" />
42-
<PackageReference Include="Statiq.Web.Netlify" Version="1.0.0-beta.44" />
36+
<PackageReference Include="Microsoft.Playwright" Version="1.49.0" />
37+
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
38+
<PackageReference Include="Statiq.CodeAnalysis" Version="1.0.0-beta.72" />
39+
<PackageReference Include="Statiq.Common" Version="1.0.0-beta.72" />
40+
<PackageReference Include="Statiq.Web" Version="1.0.0-beta.60" />
41+
<PackageReference Include="MinVer" PrivateAssets="All" Version="6.0.0" />
42+
<PackageReference Include="Statiq.Web.Netlify" Version="1.0.0-beta.60" />
4343
</ItemGroup>
4444

4545
<ItemGroup>

docs/Program.cs

+2-2
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@ await Bootstrapper.Factory
2323
{
2424
"../../src/Spectre.Console/**/{!bin,!obj,!packages,!*.Tests,}/**/*.cs",
2525
"../../src/Spectre.Console.Cli/**/{!bin,!obj,!packages,!*.Tests,}/**/*.cs",
26-
"../../src/Spectre.Console.ImageSharp/**/{!bin,!obj,!packages,!*.Tests,}/**/*.cs",
27-
"../../src/Spectre.Console.Json/**/{!bin,!obj,!packages,!*.Tests,}/**/*.cs"
26+
"../../src/Extensions/Spectre.Console.ImageSharp/**/{!bin,!obj,!packages,!*.Tests,}/**/*.cs",
27+
"../../src/Extensions/Spectre.Console.Json/**/{!bin,!obj,!packages,!*.Tests,}/**/*.cs"
2828
})
2929
.AddSetting(Constants.ExampleSourceFiles, new List<string>
3030
{

docs/input/appendix/spinners.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ For all available spinners, see https://jsfiddle.net/sindresorhus/2eLtsbey/embed
1010

1111
## Usage
1212

13-
Spinners can be used with [Progress](xref:progress) and [Status](xref:status).
13+
Spinners can be used with [Progress](xref:live-progress) and [Status](xref:live-status).
1414

1515
```csharp
1616
AnsiConsole.Status()

docs/input/appendix/styles.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ Highlights:
66
- Dim, Invert
77
- Conceal, slowblink, rapidblink
88
- Links
9+
Xref: appendix-styles
910
---
1011

1112
Note that what styles that can be used is defined by the system or your terminal software, and may not appear as they should.
@@ -48,7 +49,7 @@ Note that what styles that can be used is defined by the system or your terminal
4849
<td>Shows text with a horizontal line through the center</td>
4950
</tr>
5051
<tr>
51-
<td><code>link</link></td>
52+
<td><code>link</code></td>
5253
<td>Creates a clickable link within text</td>
5354
</tr>
5455
</table>

docs/input/blog/posts/2023-11-22-spectre-console-0.48-released.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,9 @@ New features have been added, such as the ability to show separators between tab
2626
## Rendering
2727

2828
* Add .NET 8 support by [@patriksvensson](https://github.com/patriksvensson) in [#1367](https://github.com/spectreconsole/spectre.console/pull/1367)
29-
* Fixed render issue where writeline inside status caused corrupt output #415 #694 by [@fredrikbentzen](https://github.com/fredrikbentzen) in [#1132]([#1132](https://github.com/spectreconsole/spectre.console/pull/1132))
30-
* Relax the SDK requirements by rolling forward to the latest feature by [@0xced](https://github.com/0xced) in [#1237]([#1237](https://github.com/spectreconsole/spectre.console/pull/1237))
31-
* Add fix to avoid exception on rows with no children by [@jeppevammenkristensen](https://github.com/jeppevammenkristensen) in [#1241]([#1241](https://github.com/spectreconsole/spectre.console/pull/1241))
29+
* Fixed render issue where writeline inside status caused corrupt output #415 #694 by [@fredrikbentzen](https://github.com/fredrikbentzen) in [#1132](https://github.com/spectreconsole/spectre.console/pull/1132))
30+
* Relax the SDK requirements by rolling forward to the latest feature by [@0xced](https://github.com/0xced) in [#1237](https://github.com/spectreconsole/spectre.console/pull/1237))
31+
* Add fix to avoid exception on rows with no children by [@jeppevammenkristensen](https://github.com/jeppevammenkristensen) in [#1241](https://github.com/spectreconsole/spectre.console/pull/1241))
3232
* Set `end_of_line` to `LF` instead of `CRLF` by [@0xced](https://github.com/0xced) in [#1256](https://github.com/spectreconsole/spectre.console/pull/1256)
3333
* Fix `Rule` widget docs by [@tomaszprasolek](https://github.com/tomaszprasolek) in [#1257](https://github.com/spectreconsole/spectre.console/pull/1257)
3434
* Added the missing columns-cast by [@nils](https://github.com/nils)-a in [#1294](https://github.com/spectreconsole/spectre.console/pull/1294)
@@ -46,7 +46,7 @@ New features have been added, such as the ability to show separators between tab
4646

4747
## CLI
4848
* Add async command unit tests by [@FrankRay78](https://github.com/FrankRay78) in [#1228](https://github.com/spectreconsole/spectre.console/pull/1228)
49-
* Add support for async delegate by [@icalvo](https://github.com/icalvo) in [#1215]([#1215](https://github.com/spectreconsole/spectre.console/pull/1215))
49+
* Add support for async delegate by [@icalvo](https://github.com/icalvo) in [#1215](https://github.com/spectreconsole/spectre.console/pull/1215))
5050
* Remove unnecessary `[NotNull]` attributes by [@0xced](https://github.com/0xced) in [#1255](https://github.com/spectreconsole/spectre.console/pull/1255)
5151
* Allow custom help providers by [@FrankRay78](https://github.com/FrankRay78) in [#1259](https://github.com/spectreconsole/spectre.console/pull/1259)
5252
* Specified details for settings for the argument vector by [@nils](https://github.com/nils)-a in [#1301](https://github.com/spectreconsole/spectre.console/pull/1301)

docs/input/cli/command-help.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ Removing all styling from help text is also possible, a good choice for ensuring
4141
config.Settings.HelpProviderStyles = null;
4242
```
4343

44-
See [Markup](../markup) for information about the use of markup in Spectre.Console, and [Styles](xref:styles) for a listing of supported styles.
44+
See [Markup](../markup) for information about the use of markup in Spectre.Console, and [Styles](xref:appendix-styles) for a listing of supported styles.
4545

4646
## Custom help providers
4747

docs/input/cli/composing.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
Title: Composing Commands
22
RedirectFrom: introduction
33
Order: 8
4-
Description: "The underlying philosophy behind *Spectre.Console.Cli* is to rely on the .NET type system to
5-
declare the commands, but tie everything together via composition."
4+
Description: The underlying philosophy behind *Spectre.Console.Cli* is
5+
to rely on the .NET type system to declare the commands, but tie everything together via composition.
66
---
77

88
The underlying philosophy behind `Spectre.Console.Cli` is to rely on the .NET type system to

docs/input/cli/introduction.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
Title: Introduction
22
Order: 1
33
Description: "*Spectre.Console.Cli* is a modern library for parsing command line arguments. While it's extremely
4-
opinionated in what it does, it tries to follow established industry conventions, and draws
5-
its inspiration from applications you use everyday."
4+
opinionated in what it does, it tries to follow established industry conventions, and draws
5+
its inspiration from applications you use everyday."
66
---
77

88
`Spectre.Console.Cli` is a modern library for parsing command line arguments. While it's extremely

docs/input/live/progress.md

+1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ Highlights:
99
Reference:
1010
- T:Spectre.Console.Progress
1111
- M:Spectre.Console.AnsiConsole.Progress
12+
Xref: live-progress
1213
---
1314

1415
Spectre.Console can display information about long running tasks in the console.

docs/input/live/status.md

+1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ Highlights:
88
Reference:
99
- T:Spectre.Console.Status
1010
- M:Spectre.Console.AnsiConsole.Status
11+
Xref: live-status
1112
---
1213

1314
Spectre.Console can display information about long running tasks in the console.

docs/src/SocialCards/index.cshtml

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515

1616
<div id="container">
1717
<div id="console">
18-
<div class="line"><span style="color:var(--brightBlack)">╭─</span><span style="color:var(--folder)">&#xe0b2;</span><span style="background-color:var(--folder);color:var(--black)"> ~/spectre.console</span><span style="color:var(--folder);background-color:var(--dotnet)">&#xe0b0;</span><span style="background-color:var(--blue)"> .NET 8.0 </span><span style="color:var(--dotnet);background-color:var(--git)">&#xe0b0;</span><span style="background-color:var(--git);color:var(--background)"> &#xe0a0; main </span><span style="color:var(--git)">&#xe0b4;</span></div>
18+
<div class="line"><span style="color:var(--brightBlack)">╭─</span><span style="color:var(--folder)">&#xe0b2;</span><span style="background-color:var(--folder);color:var(--black)"> ~/spectre.console</span><span style="color:var(--folder);background-color:var(--dotnet)">&#xe0b0;</span><span style="background-color:var(--blue)"> .NET 9.0 </span><span style="color:var(--dotnet);background-color:var(--git)">&#xe0b0;</span><span style="background-color:var(--git);color:var(--background)"> &#xe0a0; main </span><span style="color:var(--git)">&#xe0b4;</span></div>
1919
<div class="line"><span style="color:var(--brightBlack)">╰─</span> dotnet run</div>
2020
<div class="line"></div>
2121
<div class="line">╭────────────────────────────────────────────────────────╮</div>

docs/src/Utilities/HighlightService.cs

+15-5
Original file line numberDiff line numberDiff line change
@@ -58,21 +58,31 @@ public static async Task<string> Highlight(Compilation compilation, ISymbol symb
5858
}
5959

6060
var text = await syntaxReference.SyntaxTree.GetTextAsync();
61-
// we need a workspace, but it seems it is only used to resolve a few services and nothing else so an empty one will suffice
62-
return HighlightElement(_emptyWorkspace, model, text, textSpan, indent);
61+
62+
// we need a document for the syntax highlighter, so create a temporary solution and project to hold it.
63+
var workspace = new AdhocWorkspace();
64+
var solution = workspace.CurrentSolution
65+
.AddProject("TempProject", "TempProject", "C#")
66+
.AddDocument("TempDocument", await syntaxReference.SyntaxTree.GetTextAsync());
67+
68+
var document = solution.Project.Documents.First();
69+
70+
var highlightElement = await HighlightElement(document, text, textSpan, indent);
71+
return highlightElement;
6372
}
6473

6574
private static int GetIndent(SyntaxTriviaList leadingTrivia)
6675
{
67-
var whitespace = leadingTrivia.FirstOrDefault(i => i.Kind() == SyntaxKind.WhitespaceTrivia);
76+
var whitespace = leadingTrivia.FirstOrDefault(i => i.IsKind(SyntaxKind.WhitespaceTrivia));
6877
return whitespace == default ? 0 : whitespace.Span.Length;
6978
}
7079

71-
private static string HighlightElement(Workspace workspace, SemanticModel semanticModel, SourceText fullSourceText,
80+
private static async Task<string> HighlightElement(Document document,
81+
SourceText fullSourceText,
7282
TextSpan textSpan, int indent)
7383
{
7484

75-
var classifiedSpans = Classifier.GetClassifiedSpans(semanticModel, textSpan, workspace);
85+
var classifiedSpans = await Classifier.GetClassifiedSpansAsync(document, textSpan);
7686
return HighlightElement(classifiedSpans, fullSourceText, indent);
7787
}
7888

0 commit comments

Comments
 (0)