Compare commits

..

2 Commits

Author SHA1 Message Date
Atanas Korchev
759cd71259 Add inline Keywords to generated component markdown pages
Parse Tags from ExampleService.cs via Roslyn (handling new[], string[],
and C#12 collection expressions) and emit an inline Keywords line in each
generated .md page. The keywords are placed after the description so they
land in the first chunk during heading-based splitting, directly enriching
embedding vectors for improved RAG retrieval.
2026-02-17 20:54:12 +02:00
Atanas Korchev
adc31c4024 Generate llms.txt index and per-component markdown documentation
Rewrite the RadzenBlazorDemos.Tools to produce a spec-compliant llms.txt
index with semantic grouping (parsed from ExampleService.cs via Roslyn) and
individual .md files per component page enriched with API reference tables
extracted from Radzen.Blazor XML documentation. Primary component pages
include full parameter/event tables; sub-feature pages link back to the
primary page's API reference.

Add a MapGet endpoint in the Host to serve .md files at their corresponding
URLs (e.g. /accordion.md). Update the Dockerfile to restore the Tools
project dependencies for proper Docker builds.
2026-02-17 18:28:03 +02:00
5 changed files with 678 additions and 374 deletions

View File

@@ -8,12 +8,14 @@ WORKDIR /src
COPY Radzen.Blazor/*.csproj Radzen.Blazor/
COPY RadzenBlazorDemos/*.csproj RadzenBlazorDemos/
COPY RadzenBlazorDemos.Host/*.csproj RadzenBlazorDemos.Host/
COPY RadzenBlazorDemos.Tools/*.csproj RadzenBlazorDemos.Tools/
# Radzen.DocFX usually has no csproj → copy full folder
COPY Radzen.DocFX/ Radzen.DocFX/
# Restore dependencies
RUN dotnet restore RadzenBlazorDemos.Host/RadzenBlazorDemos.Host.csproj
# Restore dependencies (Host + Tools for llms.txt generation)
RUN dotnet restore RadzenBlazorDemos.Host/RadzenBlazorDemos.Host.csproj \
&& dotnet restore RadzenBlazorDemos.Tools/RadzenBlazorDemos.Tools.csproj
# Copy full source after restore layer
COPY . .

View File

@@ -146,6 +146,17 @@ app.MapGet("/llms.txt", () =>
? Results.File(path, "text/plain")
: Results.NotFound();
});
app.MapGet("/{*path}", (string path, IWebHostEnvironment env) =>
{
if (string.IsNullOrEmpty(path) || !path.EndsWith(".md", StringComparison.OrdinalIgnoreCase))
return Results.NotFound();
var fileInfo = env.WebRootFileProvider.GetFileInfo($"md/{path}");
return fileInfo.Exists
? Results.Stream(fileInfo.CreateReadStream(), "text/markdown")
: Results.NotFound();
});
app.MapRazorPages();
app.MapRazorComponents<RadzenBlazorDemos.Host.App>()
.AddInteractiveWebAssemblyRenderMode().AddAdditionalAssemblies(typeof(RadzenBlazorDemos.Routes).Assembly)

File diff suppressed because it is too large Load Diff

View File

@@ -1,9 +1,12 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net8.0</TargetFramework>
<TargetFramework>net10.0</TargetFramework>
<Nullable>disable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.CodeAnalysis.CSharp" Version="4.*" />
</ItemGroup>
</Project>

View File

@@ -56,31 +56,32 @@
<Copy SourceFiles="@(DemoHostControllersCs)" DestinationFiles="@(DemoHostControllersCs->'$(ProjectDir)wwwroot\demos\Controllers\%(RecursiveDir)%(Filename).txt')" SkipUnchangedFiles="true" />
</Target>
<!-- Generate llms.txt from demo pages -->
<!-- Generate llms.txt and per-component .md files -->
<!-- Usage: dotnet build -p:GenerateLlmsTxt=true -->
<Target Name="GenerateLlmsTxt"
BeforeTargets="Build"
Condition="'$(Configuration)' == 'Release' OR '$(GenerateLlmsTxt)' == 'true'">
<PropertyGroup>
<LlmsTxtOutputPath>$(ProjectDir)wwwroot\llms.txt</LlmsTxtOutputPath>
<LlmsTxtOutputDir>$(ProjectDir)wwwroot</LlmsTxtOutputDir>
<LlmsTxtToolPath>$(MSBuildThisFileDirectory)..\RadzenBlazorDemos.Tools\RadzenBlazorDemos.Tools.csproj</LlmsTxtToolPath>
<LlmsTxtToolDir>$(MSBuildThisFileDirectory)..\RadzenBlazorDemos.Tools\bin\$(Configuration)\net8.0\</LlmsTxtToolDir>
<LlmsTxtToolDir>$(MSBuildThisFileDirectory)..\RadzenBlazorDemos.Tools\bin\$(Configuration)\net10.0\</LlmsTxtToolDir>
<LlmsTxtToolExe Condition="'$(OS)' == 'Windows_NT'">$(LlmsTxtToolDir)RadzenBlazorDemos.Tools.exe</LlmsTxtToolExe>
<LlmsTxtToolExe Condition="'$(OS)' != 'Windows_NT'">$(LlmsTxtToolDir)RadzenBlazorDemos.Tools</LlmsTxtToolExe>
<RadzenBlazorXmlDoc>$(MSBuildThisFileDirectory)..\Radzen.Blazor\bin\$(Configuration)\net8.0\Radzen.Blazor.xml</RadzenBlazorXmlDoc>
</PropertyGroup>
<Message Text="Generating llms.txt..." Importance="high" />
<Message Text="Generating llms.txt and component .md files..." Importance="high" />
<!-- Build the tool first -->
<Exec Command="dotnet build &quot;$(LlmsTxtToolPath)&quot; --configuration $(Configuration) --no-incremental"
ContinueOnError="false"
Condition="Exists('$(LlmsTxtToolPath)')" />
<!-- Run the tool -->
<Exec Command="&quot;$(LlmsTxtToolExe)&quot; &quot;$(LlmsTxtOutputPath)&quot; &quot;$(ProjectDir)Pages&quot; &quot;$(ProjectDir)Services&quot; &quot;$(ProjectDir)Models&quot;"
<!-- Run the tool: <outputDir> <pagesPath> <exampleServicePath> [xmlDocPath] -->
<Exec Command="&quot;$(LlmsTxtToolExe)&quot; &quot;$(LlmsTxtOutputDir)&quot; &quot;$(ProjectDir)Pages&quot; &quot;$(ProjectDir)Services\ExampleService.cs&quot; &quot;$(RadzenBlazorXmlDoc)&quot;"
ContinueOnError="false"
Condition="Exists('$(LlmsTxtToolExe)')" />
<Message Text="llms.txt generated at: $(LlmsTxtOutputPath)" Importance="high" />
<Message Text="llms.txt and .md files generated in: $(LlmsTxtOutputDir)" Importance="high" />
</Target>
</Project>