Skip to content

frist#465

Merged
ignatandrei merged 2 commits intomainfrom
SvgIconGenerator
Apr 3, 2026
Merged

frist#465
ignatandrei merged 2 commits intomainfrom
SvgIconGenerator

Conversation

@ignatandrei
Copy link
Copy Markdown
Owner

@ignatandrei ignatandrei commented Apr 3, 2026

Summary by CodeRabbit

Release Notes

  • New Features

    • Added SvgIconGenerator (automixin #262)—a source generator that converts SVG icons into type-safe C# code, complete with documentation and interactive tutorials
  • Documentation

    • Updated example count across the collection (261 → 262 examples)
    • Added author profile for Matt Schneeberger
    • Updated FilesToCode category listing and dates

Copilot AI review requested due to automatic review settings April 3, 2026 09:01
@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Apr 3, 2026

📝 Walkthrough

Walkthrough

This pull request adds a new RSCG (Roslyn Source Code Generator) example for SvgIconGenerator to the documentation repository. It includes the demo project files, comprehensive documentation, metadata entries, interactive tour configuration, and updates example counts across all documentation pages to reflect the new 262nd example.

Changes

Cohort / File(s) Summary
Core Documentation Updates
README.md, later.md, v2/rscg_examples_site/docs/about.md
Updated example count from 261 to 262 and advanced the latest update date from 2026-04-03 to 2026-04-04.
Example Metadata & Configuration
v2/RSCGExamplesData/GeneratorDataRec.json, v2/rscg_examples/SvgIconGenerator/...json, v2/rscg_examples/SvgIconGenerator/nuget.txt, v2/book/pandocHTML.yaml, v2/rscg_examples_site/static/exports/RSCG.json
Added SvgIconGenerator metadata entries including generator data record, description configuration, and export listing.
Example Documentation Pages
v2/book/examples/SvgIconGenerator.html, v2/rscg_examples_site/docs/RSCG-Examples/SvgIconGenerator.md, v2/rscg_examples/SvgIconGenerator/readme.txt
Created comprehensive documentation covering SVG-to-C# generation, usage instructions, integration patterns with icon libraries, and generated artifacts.
Demo Project Implementation
v2/rscg_examples/SvgIconGenerator/src/DemoSvg.slnx, v2/rscg_examples/SvgIconGenerator/src/DemoSvg/DemoSvg.csproj, v2/rscg_examples/SvgIconGenerator/src/DemoSvg/Icons.cs, v2/rscg_examples/SvgIconGenerator/src/DemoSvg/Program.cs
Added complete demo project with solution, project file, and sample code demonstrating SvgIconGenerator usage.
Interactive Guides
v2/.tours/SvgIconGenerator.tour, v2/rscg_examples/SvgIconGenerator/video.json
Added CodeTour walkthrough and video script configuration for interactive presentation of the example.
Example List & Categorization Updates
v2/book/list.html, v2/rscg_examples_site/docs/Categories/FilesToCode.md, v2/rscg_examples_site/docs/Categories/_PrimitiveFilesToCode.mdx, v2/rscg_examples_site/docs/RSCG-Examples/index.md, v2/rscg_examples_site/docs/indexRSCG.md
Updated example list entries, counts, and categorization to include SvgIconGenerator in FilesToCode category (now 19 examples).
Author & Homepage
v2/rscg_examples_site/docs/Authors/Matt_Schneeberger.md, v2/rscg_examples_site/src/components/HomepageFeatures/index.js
Added author profile for Matt Schneeberger and updated homepage feature card example count from 261 to 262.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~15 minutes

Poem

🐰 A generator new, for icons so bright,
SVGs transformed to C# delight!
From Matt's clever tool, the examples grow,
Two-sixty-two strong, with a radiant glow! ✨

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Title check ⚠️ Warning The PR title 'frist' does not clearly describe or relate to the substantial changes in this pull request, which adds comprehensive documentation and integration for a new SvgIconGenerator example across 24+ files. Update the title to clearly describe the main change, such as 'Add SvgIconGenerator example to documentation and metadata' or 'Add 262nd RSCG example: SvgIconGenerator'.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch SvgIconGenerator

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 5

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
README.md (1)

7-31: ⚠️ Potential issue | 🟡 Minor

Update date in README.md to match PR timestamp or clarify if intentionally scheduled.

Lines 7 and 31 show 2026-04-04, but this PR was created on 2026-04-03. Either adjust the date to the actual generation date or document if this is an intentional scheduled update.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@README.md` around lines 7 - 31, The README's "Latest Update : 2026-04-04 =>
04 April 2026" and "Generated on : 2026-04-04 => 04 April 2026" dates are
inconsistent with the PR creation date (2026-04-03); update those date strings
(search for the exact text "Latest Update : 2026-04-04 => 04 April 2026" and
"Generated on : 2026-04-04 => 04 April 2026") to the actual generation/PR date
(2026-04-03) or, if the future date is intentional, add a short clarifying note
next to those lines stating this is a scheduled/published-on date so reviewers
know it's intentional.
🧹 Nitpick comments (3)
v2/.tours/SvgIconGenerator.tour (1)

26-42: Generated file steps are in reverse order.

The generated file steps are numbered inconsistently: they show "Generated File 3 from 3" first, then "2 from 3", then "1 from 3". Consider reordering them 1→2→3 for a more intuitive walkthrough.

♻️ Suggested reordering
         ,{
-        "file": "rscg_examples/SvgIconGenerator/src/DemoSvg/obj/GX/SvgIconGenerator/SvgIconGenerator.IconGenerator/MyIcons.g.cs",
-        "description": "Generated File 3  from 3 : MyIcons.g.cs ",
+        "file": "rscg_examples/SvgIconGenerator/src/DemoSvg/obj/GX/SvgIconGenerator/SvgIconGenerator.IconGenerator/GenerateIconsAttribute.g.cs",
+        "description": "Generated File 1  from 3 : GenerateIconsAttribute.g.cs ",
         "line": 1
         }
     
         ,{
         "file": "rscg_examples/SvgIconGenerator/src/DemoSvg/obj/GX/SvgIconGenerator/SvgIconGenerator.IconGenerator/IconDto.g.cs",
         "description": "Generated File 2  from 3 : IconDto.g.cs ",
         "line": 1
         }
     
         ,{
-        "file": "rscg_examples/SvgIconGenerator/src/DemoSvg/obj/GX/SvgIconGenerator/SvgIconGenerator.IconGenerator/GenerateIconsAttribute.g.cs",
-        "description": "Generated File 1  from 3 : GenerateIconsAttribute.g.cs ",
+        "file": "rscg_examples/SvgIconGenerator/src/DemoSvg/obj/GX/SvgIconGenerator/SvgIconGenerator.IconGenerator/MyIcons.g.cs",
+        "description": "Generated File 3  from 3 : MyIcons.g.cs ",
         "line": 1
         }
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@v2/.tours/SvgIconGenerator.tour` around lines 26 - 42, The tour lists
generated files in reverse order; reorder the entries so they read 1→2→3
(GenerateIconsAttribute.g.cs as "Generated File 1 from 3", IconDto.g.cs as
"Generated File 2 from 3", MyIcons.g.cs as "Generated File 3 from 3") and update
the sequence in the SvgIconGenerator.tour JSON block so the walkthrough presents
files in ascending logical order.
v2/rscg_examples/SvgIconGenerator/src/DemoSvg/Icons.cs (1)

1-4: Consider removing unused imports.

The System, System.Collections.Generic, and System.Text namespaces appear unused in this file. Only SvgIconGenerator is needed for the [GenerateIcons()] attribute.

♻️ Optional cleanup
-using System;
-using System.Collections.Generic;
-using System.Text;
 using SvgIconGenerator;
 namespace DemoSvg;
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@v2/rscg_examples/SvgIconGenerator/src/DemoSvg/Icons.cs` around lines 1 - 4,
Remove the unused using directives at the top of Icons.cs — specifically delete
using System;, using System.Collections.Generic;, and using System.Text; —
leaving only using SvgIconGenerator; so the file only imports the namespace
required for the [GenerateIcons()] attribute (look for the GenerateIcons
attribute and the Icons.cs file to locate the code).
v2/rscg_examples/SvgIconGenerator/description.json (1)

15-16: Consider using empty arrays instead of arrays with empty strings.

Using [""] instead of [] is unconventional. While the code handles this via length checks (skipping items with item.Length==0), using empty arrays would be cleaner and more explicit about intent.

♻️ Cleaner empty array notation
-      "excludeDirectoryGenerated":[""],
-      "includeAdditionalFiles":[""]
+      "excludeDirectoryGenerated":[],
+      "includeAdditionalFiles":[]
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@v2/rscg_examples/SvgIconGenerator/description.json` around lines 15 - 16, The
JSON properties excludeDirectoryGenerated and includeAdditionalFiles currently
use arrays with an empty string ([""]); change both to empty arrays ([]) to
express intent clearly and avoid relying on downstream length or empty-string
checks; update the values for "excludeDirectoryGenerated" and
"includeAdditionalFiles" in description.json to use [] instead of [""].
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@v2/rscg_examples_site/docs/indexRSCG.md`:
- Line 23: Remove the trailing space inside the markdown link label in
indexRSCG.md by editing the table row that contains "[SvgIconGenerator by Matt
Schneeberger ]" and change it to "[SvgIconGenerator by Matt Schneeberger]"
(i.e., delete the space immediately before the closing bracket) so the link text
no longer triggers markdownlint MD039.

In `@v2/rscg_examples_site/docs/RSCG-Examples/SvgIconGenerator.md`:
- Around line 296-302: Remove the stray backslashes before braces in the C#
fenced-code examples so the dictionary initializer uses real braces instead of
escaped ones; e.g., change occurrences like "\{ \"width\", \"24\" }" and similar
entries ("height", "viewBox", "fill", "stroke", "stroke-width") to use plain "{
\"width\", \"24\" }" (apply the same fix to the other csharp block with the
escaped braces).
- Around line 363-467: The TabItem value attributes in the generated Markdown
use absolute Windows paths (the TabItem elements in SvgIconGenerator.md that
contain Program.cs, Icons.cs and generated file tabs) which makes the docs
non-portable; update each TabItem's value attribute to a relative, semantic
kebab-case identifier (e.g., "program-cs", "icons-cs", "generated-gx-icondto",
"generated-gx-generateiconsattribute", "generated-gx-myicons") while keeping the
label text and enclosed code blocks unchanged so the TabItem elements still
display the correct file name.
- Around line 56-266: The markdown uses invalid heading levels (lines like
"###### Installation" and many "######### ..." with 9 hashes), breaking
rendering; update heading levels so the top-level 6-hash becomes level 4 (change
"###### Installation" to "#### Installation") and change every "######### ..."
(the repeated 9-hash headings such as "######### 1. Organize Your SVG Files",
"######### 2. Add SVG Files as AdditionalFiles", "######### 3. Create an Icon
Class", "######### 4. Access Generated Icons", "######### 5. Render Icons", and
other similar sections) to level 5 (replace 9 hashes with 5: "##### ...") to
produce a consistent, incrementally-increasing hierarchy throughout the
document.

In `@v2/rscg_examples/SvgIconGenerator/video.json`:
- Around line 35-38: The JSON is invalid because the object in the steps array
uses assignment syntax SpeakTest=" " instead of a JSON key/value pair; update
that entry to use proper JSON syntax (e.g., "SpeakTest": " ") within the same
object in the array (the objects represented by
{"typeStep":"browser","arg":"https://...","SpeakTest": " "}) and ensure commas
and brackets remain valid so the file parses as JSON; after the change, validate
the file to confirm it's well-formed.

---

Outside diff comments:
In `@README.md`:
- Around line 7-31: The README's "Latest Update : 2026-04-04 => 04 April 2026"
and "Generated on : 2026-04-04 => 04 April 2026" dates are inconsistent with the
PR creation date (2026-04-03); update those date strings (search for the exact
text "Latest Update : 2026-04-04 => 04 April 2026" and "Generated on :
2026-04-04 => 04 April 2026") to the actual generation/PR date (2026-04-03) or,
if the future date is intentional, add a short clarifying note next to those
lines stating this is a scheduled/published-on date so reviewers know it's
intentional.

---

Nitpick comments:
In `@v2/.tours/SvgIconGenerator.tour`:
- Around line 26-42: The tour lists generated files in reverse order; reorder
the entries so they read 1→2→3 (GenerateIconsAttribute.g.cs as "Generated File 1
from 3", IconDto.g.cs as "Generated File 2 from 3", MyIcons.g.cs as "Generated
File 3 from 3") and update the sequence in the SvgIconGenerator.tour JSON block
so the walkthrough presents files in ascending logical order.

In `@v2/rscg_examples/SvgIconGenerator/description.json`:
- Around line 15-16: The JSON properties excludeDirectoryGenerated and
includeAdditionalFiles currently use arrays with an empty string ([""]); change
both to empty arrays ([]) to express intent clearly and avoid relying on
downstream length or empty-string checks; update the values for
"excludeDirectoryGenerated" and "includeAdditionalFiles" in description.json to
use [] instead of [""].

In `@v2/rscg_examples/SvgIconGenerator/src/DemoSvg/Icons.cs`:
- Around line 1-4: Remove the unused using directives at the top of Icons.cs —
specifically delete using System;, using System.Collections.Generic;, and using
System.Text; — leaving only using SvgIconGenerator; so the file only imports the
namespace required for the [GenerateIcons()] attribute (look for the
GenerateIcons attribute and the Icons.cs file to locate the code).
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 782fe3bf-c155-461a-b19e-d3f74ec1fa52

📥 Commits

Reviewing files that changed from the base of the PR and between b040910 and 0783aed.

⛔ Files ignored due to path filters (5)
  • v2/Generator/all.csv is excluded by !**/*.csv
  • v2/rscg_examples/SvgIconGenerator/src/DemoSvg/Icons/Circle.svg is excluded by !**/*.svg
  • v2/rscg_examples/SvgIconGenerator/src/DemoSvg/Icons/Rect.svg is excluded by !**/*.svg
  • v2/rscg_examples_site/static/exports/RSCG.xlsx is excluded by !**/*.xlsx
  • v2/rscg_examples_site/static/sources/SvgIconGenerator.zip is excluded by !**/*.zip
📒 Files selected for processing (24)
  • README.md
  • later.md
  • v2/.tours/SvgIconGenerator.tour
  • v2/RSCGExamplesData/GeneratorDataRec.json
  • v2/book/examples/SvgIconGenerator.html
  • v2/book/list.html
  • v2/book/pandocHTML.yaml
  • v2/rscg_examples/SvgIconGenerator/description.json
  • v2/rscg_examples/SvgIconGenerator/nuget.txt
  • v2/rscg_examples/SvgIconGenerator/readme.txt
  • v2/rscg_examples/SvgIconGenerator/src/DemoSvg.slnx
  • v2/rscg_examples/SvgIconGenerator/src/DemoSvg/DemoSvg.csproj
  • v2/rscg_examples/SvgIconGenerator/src/DemoSvg/Icons.cs
  • v2/rscg_examples/SvgIconGenerator/src/DemoSvg/Program.cs
  • v2/rscg_examples/SvgIconGenerator/video.json
  • v2/rscg_examples_site/docs/Authors/Matt_Schneeberger.md
  • v2/rscg_examples_site/docs/Categories/FilesToCode.md
  • v2/rscg_examples_site/docs/Categories/_PrimitiveFilesToCode.mdx
  • v2/rscg_examples_site/docs/RSCG-Examples/SvgIconGenerator.md
  • v2/rscg_examples_site/docs/RSCG-Examples/index.md
  • v2/rscg_examples_site/docs/about.md
  • v2/rscg_examples_site/docs/indexRSCG.md
  • v2/rscg_examples_site/src/components/HomepageFeatures/index.js
  • v2/rscg_examples_site/static/exports/RSCG.json


| No | Name | Date | Category |
| --------- | ----- | ---- | -------- |
|262| [SvgIconGenerator by Matt Schneeberger ](/docs/SvgIconGenerator)|2026-04-04 => 04 April 2026 | [FilesToCode](/docs/Categories/FilesToCode) |
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Remove trailing space inside link text (markdownlint MD039).

Line 23 has a space before ] in [SvgIconGenerator by Matt Schneeberger ], which triggers lint noise and can fail strict markdown checks.

✂️ Suggested fix
-|262| [SvgIconGenerator by Matt Schneeberger ](/docs/SvgIconGenerator)|2026-04-04 => 04 April 2026 | [FilesToCode](/docs/Categories/FilesToCode) |
+|262| [SvgIconGenerator by Matt Schneeberger](/docs/SvgIconGenerator)|2026-04-04 => 04 April 2026 | [FilesToCode](/docs/Categories/FilesToCode) |
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
|262| [SvgIconGenerator by Matt Schneeberger ](/docs/SvgIconGenerator)|2026-04-04 => 04 April 2026 | [FilesToCode](/docs/Categories/FilesToCode) |
|262| [SvgIconGenerator by Matt Schneeberger](/docs/SvgIconGenerator)|2026-04-04 => 04 April 2026 | [FilesToCode](/docs/Categories/FilesToCode) |
🧰 Tools
🪛 markdownlint-cli2 (0.22.0)

[warning] 23-23: Spaces inside link text

(MD039, no-space-in-links)

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@v2/rscg_examples_site/docs/indexRSCG.md` at line 23, Remove the trailing
space inside the markdown link label in indexRSCG.md by editing the table row
that contains "[SvgIconGenerator by Matt Schneeberger ]" and change it to
"[SvgIconGenerator by Matt Schneeberger]" (i.e., delete the space immediately
before the closing bracket) so the link text no longer triggers markdownlint
MD039.

Comment on lines +56 to +266
###### Installation

Install the NuGet package in your project:

```bash
dotnet add package SvgIconGenerator
```

###### Usage

######### 1. Organize Your SVG Files

Place your SVG icon files in a folder within your project (e.g., `Icons/`):

```
YourProject/
├── Icons/
│ ├── user-circle.svg
│ ├── home.svg
│ └── settings.svg
└── Program.cs
```

######### 2. Add SVG Files as AdditionalFiles

In your `.csproj` file, add the SVG files as `AdditionalFiles`:

```xml
<ItemGroup>
<AdditionalFiles Include="Icons/*.svg" />
</ItemGroup>
```

**Important**: Adding files as `AdditionalFiles` ensures that changes to SVG files trigger regeneration during incremental compilation.

######### 3. Create an Icon Class

Create a `static partial` class and decorate it with the `[GenerateIcons]` attribute:

```csharp
[GenerateIcons]
internal static partial class MyIcons;
```

You can optionally specify a glob pattern to filter which SVG files to include:

```csharp
// Include all SVG files from AdditionalFiles
[GenerateIcons]
internal static partial class AllIcons;

// Filter by glob pattern
[GenerateIcons("Icons/*.svg")]
internal static partial class MyIcons;
```

######### 4. Access Generated Icons

The source generator will create properties for each SVG file. Property names are automatically converted from kebab-case to PascalCase:

```csharp
// user-circle.svg becomes UserCircle
IconDto icon = MyIcons.UserCircle;

Console.WriteLine($"Icon name: {icon.Name}");
Console.WriteLine($"ViewBox: {icon.DefaultAttributes["viewBox"]}");
Console.WriteLine($"SVG content: {icon.InnerContent}");
```

######### 5. Render Icons

The `IconDto` contains everything needed to render the icon:

```csharp
public static string RenderIcon(IconDto icon, Dictionary<string, string>? customAttributes = null)
{
// Merge default attributes with custom overrides
var attributes = new Dictionary<string, string>(icon.DefaultAttributes);
if (customAttributes != null)
{
foreach (var kvp in customAttributes)
{
attributes[kvp.Key] = kvp.Value;
}
}

// Build attribute string
var attrString = string.Join(" ", attributes.Select(kvp => $"{kvp.Key}=\"{kvp.Value}\""));

// Return complete SVG
return $"<svg {attrString}>{icon.InnerContent}</svg>";
}

// Use it
string svg = RenderIcon(MyIcons.UserCircle, new Dictionary<string, string>
{
["class"] = "icon",
["width"] = "24",
["height"] = "24"
});
```

###### Using with Popular Icon Libraries

You can use this generator with popular icon libraries installed via NPM, such as Bootstrap Icons, Lucide, Heroicons, or Feather Icons.

######### Example: Lucide Icons

1. Install Lucide icons via NPM:

```bash
npm install lucide-static
```

2. Add the icons as `AdditionalFiles` in your `.csproj`:

```xml
<ItemGroup>
<AdditionalFiles Include="node_modules/lucide-static/icons/*.svg" />
</ItemGroup>
```

3. Create the icon class with optional glob pattern filter:

```csharp
[GenerateIcons("node_modules/lucide-static/icons/*.svg")]
internal static partial class LucideIcons;
```

4. Access any Lucide icon:

```csharp
IconDto icon = LucideIcons.UserCircle;
IconDto icon2 = LucideIcons.ShoppingCart;
IconDto icon3 = LucideIcons.AlertTriangle;
```

######### Example: Bootstrap Icons

```bash
npm install bootstrap-icons
```

```xml
<ItemGroup>
<AdditionalFiles Include="node_modules/bootstrap-icons/icons/*.svg" />
</ItemGroup>
```

```csharp
[GenerateIcons("node_modules/bootstrap-icons/icons/*.svg")]
internal static partial class BootstrapIcons;
```

######### Example: Heroicons

```bash
npm install heroicons
```

```xml
<ItemGroup>
<AdditionalFiles Include="node_modules/heroicons/24/outline/*.svg" />
<AdditionalFiles Include="node_modules/heroicons/24/solid/*.svg" />
</ItemGroup>
```

```csharp
// Outline style icons
[GenerateIcons("node_modules/heroicons/24/outline/*.svg")]
internal static partial class HeroiconsOutline;

// Solid style icons
[GenerateIcons("node_modules/heroicons/24/solid/*.svg")]
internal static partial class HeroiconsSolid;
```

######### Multiple Icon Sets

You can create multiple icon classes in the same project to organize different icon sets:

```xml
<ItemGroup>
<AdditionalFiles Include="node_modules/lucide-static/icons/*.svg" />
<AdditionalFiles Include="Icons/custom/*.svg" />
<AdditionalFiles Include="Icons/logos/*.svg" />
</ItemGroup>
```

```csharp
[GenerateIcons("node_modules/lucide-static/icons/*.svg")]
internal static partial class LucideIcons;

[GenerateIcons("Icons/custom/*.svg")]
internal static partial class CustomIcons;

[GenerateIcons("Icons/logos/*.svg")]
internal static partial class LogoIcons;
```

###### How It Works

1. The source generator reads SVG files from `AdditionalFiles` in your project
2. Files are optionally filtered by glob pattern (if specified in the attribute)
3. For each SVG file, it:
- Extracts the root element's attributes (excluding `xmlns` and `class`)
- Captures the inner SVG content
- Converts the filename to PascalCase for the property name
4. Generates a partial class with `IconDto` properties for each icon
5. **Incremental compilation**: Changes to SVG files automatically trigger regeneration

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
rg -nP '^#{7,}\s' v2/rscg_examples_site/docs/RSCG-Examples/SvgIconGenerator.md

Repository: ignatandrei/RSCG_Examples

Length of output: 405


Normalize heading levels — multiple headings use invalid syntax (9 hashes exceed markdown maximum of 6).

Lines 66, 79, 91, 112, 125, 162, 193, 210, 233 all start with 9 hashes (#########), which is invalid markdown and breaks heading rendering, linting, and TOC generation. Line 56 uses 6 hashes (###### Installation), which is the maximum valid level but inconsistent with the section structure.

Reduce 6-hash headings to #### (level 4) and 9-hash headings to ##### (level 5) for a consistent, incrementally-increasing hierarchy:

Proposed fix pattern
-###### Installation
+#### Installation

-######### 1. Organize Your SVG Files
+##### 1. Organize Your SVG Files

Apply to all ######### sections (9 lines total) and adjust 6-hash headings accordingly.

🧰 Tools
🪛 markdownlint-cli2 (0.22.0)

[warning] 56-56: Heading levels should only increment by one level at a time
Expected: h4; Actual: h6

(MD001, heading-increment)


[warning] 70-70: Fenced code blocks should have a language specified

(MD040, fenced-code-language)

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@v2/rscg_examples_site/docs/RSCG-Examples/SvgIconGenerator.md` around lines 56
- 266, The markdown uses invalid heading levels (lines like "######
Installation" and many "######### ..." with 9 hashes), breaking rendering;
update heading levels so the top-level 6-hash becomes level 4 (change "######
Installation" to "#### Installation") and change every "######### ..." (the
repeated 9-hash headings such as "######### 1. Organize Your SVG Files",
"######### 2. Add SVG Files as AdditionalFiles", "######### 3. Create an Icon
Class", "######### 4. Access Generated Icons", "######### 5. Render Icons", and
other similar sections) to level 5 (replace 9 hashes with 5: "##### ...") to
produce a consistent, incrementally-increasing hierarchy throughout the
document.

Comment on lines +296 to +302
\{ "width", "24" },
\{ "height", "24" },
\{ "viewBox", "0 0 24 24" },
\{ "fill", "none" },
\{ "stroke", "currentColor" },
\{ "stroke-width", "2" },
},
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
rg -n '\\\{' v2/rscg_examples_site/docs/RSCG-Examples/SvgIconGenerator.md

Repository: ignatandrei/RSCG_Examples

Length of output: 454


🏁 Script executed:

sed -n '285,310p' v2/rscg_examples_site/docs/RSCG-Examples/SvgIconGenerator.md

Repository: ignatandrei/RSCG_Examples

Length of output: 752


🏁 Script executed:

sed -n '480,510p' v2/rscg_examples_site/docs/RSCG-Examples/SvgIconGenerator.md

Repository: ignatandrei/RSCG_Examples

Length of output: 1047


Remove escaped braces from C# code blocks.

Lines 296–301 and 488–500 contain escaped braces \{ ... } within csharp fence blocks. In markdown, these backslashes render literally and make the example code appear syntactically invalid. Remove the backslashes to display proper C# dictionary initialization syntax: { ... }.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@v2/rscg_examples_site/docs/RSCG-Examples/SvgIconGenerator.md` around lines
296 - 302, Remove the stray backslashes before braces in the C# fenced-code
examples so the dictionary initializer uses real braces instead of escaped ones;
e.g., change occurrences like "\{ \"width\", \"24\" }" and similar entries
("height", "viewBox", "fill", "stroke", "stroke-width") to use plain "{
\"width\", \"24\" }" (apply the same fix to the other csharp block with the
escaped braces).

Comment on lines +363 to +467
<TabItem value="D:\gth\RSCG_Examples\v2\rscg_examples\SvgIconGenerator\src\DemoSvg\Program.cs" label="Program.cs" >

This is the use of **SvgIconGenerator** in *Program.cs*

```csharp showLineNumbers
using DemoSvg;

Console.WriteLine(MyIcons.Circle.Name);

Console.WriteLine(MyIcons.Rect.InnerContent);

```
</TabItem>

<TabItem value="D:\gth\RSCG_Examples\v2\rscg_examples\SvgIconGenerator\src\DemoSvg\Icons.cs" label="Icons.cs" >

This is the use of **SvgIconGenerator** in *Icons.cs*

```csharp showLineNumbers
using System;
using System.Collections.Generic;
using System.Text;
using SvgIconGenerator;
namespace DemoSvg;

[GenerateIcons()]
internal static partial class MyIcons;


```
</TabItem>

</Tabs>

### Generated Files

Those are taken from $(BaseIntermediateOutputPath)\GX
<Tabs>


<TabItem value="D:\gth\RSCG_Examples\v2\rscg_examples\SvgIconGenerator\src\DemoSvg\obj\GX\SvgIconGenerator\SvgIconGenerator.IconGenerator\GenerateIconsAttribute.g.cs" label="GenerateIconsAttribute.g.cs" >
```csharp showLineNumbers
namespace SvgIconGenerator
{
/// <summary>
/// Marks a static partial class for icon generation.
/// The source generator will scan AdditionalFiles for SVG files matching the specified glob pattern
/// and generate static readonly IconDto properties for each icon found.
/// </summary>
/// <remarks>
/// SVG files must be added to the project as AdditionalFiles in the .csproj file:
/// <code>
/// &lt;ItemGroup&gt;
/// &lt;AdditionalFiles Include="icons/**/*.svg" /&gt;
/// &lt;/ItemGroup&gt;
/// </code>
/// </remarks>
[global::System.AttributeUsage(global::System.AttributeTargets.Class, Inherited = false, AllowMultiple = false)]
internal sealed class GenerateIconsAttribute : global::System.Attribute
{
/// <summary>
/// Initializes a new instance of the <see cref="GenerateIconsAttribute"/> class.
/// </summary>
public GenerateIconsAttribute()
{
}

/// <summary>
/// Initializes a new instance of the <see cref="GenerateIconsAttribute"/> class.
/// </summary>
/// <param name="globPattern">
/// Optional glob pattern to filter SVG files from AdditionalFiles.
/// If not specified, all SVG files in AdditionalFiles will be included.
/// Supports * (wildcard) and ** (recursive) patterns.
/// Example: <code>"node_modules/lucide-static/icons/*.svg"</code>
/// </param>
public GenerateIconsAttribute(string globPattern)
{
}
}
}

```
</TabItem>


<TabItem value="D:\gth\RSCG_Examples\v2\rscg_examples\SvgIconGenerator\src\DemoSvg\obj\GX\SvgIconGenerator\SvgIconGenerator.IconGenerator\IconDto.g.cs" label="IconDto.g.cs" >
```csharp showLineNumbers
namespace SvgIconGenerator
{
/// <summary>
/// Represents an icon with its SVG metadata and content.
/// This type is generated by the IconGenerator source generator.
/// </summary>
/// <param name="Name">The kebab-case name of the icon (e.g., "circle-user-round").</param>
/// <param name="DefaultAttributes">The default attributes from the SVG root element (excluding xmlns). Common attributes include: width, height, viewBox, fill, stroke, stroke-width, stroke-linecap, stroke-linejoin.</param>
/// <param name="InnerContent">The inner HTML content of the SVG element (paths, circles, lines, etc.).</param>
public sealed record IconDto(string Name, global::System.Collections.Generic.IReadOnlyDictionary<string, string> DefaultAttributes, string InnerContent);
}

```
</TabItem>


<TabItem value="D:\gth\RSCG_Examples\v2\rscg_examples\SvgIconGenerator\src\DemoSvg\obj\GX\SvgIconGenerator\SvgIconGenerator.IconGenerator\MyIcons.g.cs" label="MyIcons.g.cs" >
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
rg -nP '<TabItem value="[^"]*\\[^"]*"' v2/rscg_examples_site/docs/RSCG-Examples/SvgIconGenerator.md

Repository: ignatandrei/RSCG_Examples

Length of output: 875


Replace absolute Windows paths in TabItem value attributes with relative identifiers.

Lines 363, 377, 403, 449, and 467 use absolute Windows paths (e.g., D:\gth\RSCG_Examples\...) as TabItem identifiers. These are machine-specific and reduce portability. Use kebab-case semantic identifiers instead.

Suggested replacements
-<TabItem value="D:\gth\RSCG_Examples\v2\rscg_examples\SvgIconGenerator\src\DemoSvg\Program.cs" label="Program.cs" >
+<TabItem value="program-cs" label="Program.cs" >

-<TabItem value="D:\gth\RSCG_Examples\v2\rscg_examples\SvgIconGenerator\src\DemoSvg\Icons.cs" label="Icons.cs" >
+<TabItem value="icons-cs" label="Icons.cs" >

-<TabItem value="D:\gth\RSCG_Examples\v2\rscg_examples\SvgIconGenerator\src\DemoSvg\obj\GX\SvgIconGenerator\SvgIconGenerator.IconGenerator\GenerateIconsAttribute.g.cs" label="GenerateIconsAttribute.g.cs" >
+<TabItem value="generate-icons-attribute-g-cs" label="GenerateIconsAttribute.g.cs" >

-<TabItem value="D:\gth\RSCG_Examples\v2\rscg_examples\SvgIconGenerator\src\DemoSvg\obj\GX\SvgIconGenerator\SvgIconGenerator.IconGenerator\IconDto.g.cs" label="IconDto.g.cs" >
+<TabItem value="icon-dto-g-cs" label="IconDto.g.cs" >

-<TabItem value="D:\gth\RSCG_Examples\v2\rscg_examples\SvgIconGenerator\src\DemoSvg\obj\GX\SvgIconGenerator\SvgIconGenerator.IconGenerator\MyIcons.g.cs" label="MyIcons.g.cs" >
+<TabItem value="my-icons-g-cs" label="MyIcons.g.cs" >
🧰 Tools
🪛 markdownlint-cli2 (0.22.0)

[warning] 430-430: Code block style
Expected: fenced; Actual: indented

(MD046, code-block-style)


[warning] 445-445: Fenced code blocks should have a language specified

(MD040, fenced-code-language)

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@v2/rscg_examples_site/docs/RSCG-Examples/SvgIconGenerator.md` around lines
363 - 467, The TabItem value attributes in the generated Markdown use absolute
Windows paths (the TabItem elements in SvgIconGenerator.md that contain
Program.cs, Icons.cs and generated file tabs) which makes the docs non-portable;
update each TabItem's value attribute to a relative, semantic kebab-case
identifier (e.g., "program-cs", "icons-cs", "generated-gx-icondto",
"generated-gx-generateiconsattribute", "generated-gx-myicons") while keeping the
label text and enclosed code blocks unchanged so the TabItem elements still
display the correct file name.

Comment on lines +35 to +38
{"typeStep":"browser","arg":"https://ignatandrei.github.io/RSCG_Examples/v2/docs/SvgIconGenerator#download-example-net--c-",
SpeakTest=" "},
{"typeStep":"waitseconds","arg":"30"},
]
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🔴 Critical

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
python - <<'PY'
import json
from pathlib import Path

p = Path("v2/rscg_examples/SvgIconGenerator/video.json")
try:
    json.loads(p.read_text(encoding="utf-8"))
    print("OK: JSON is valid")
except Exception as e:
    print(f"ERROR: JSON is invalid -> {e}")
PY

Repository: ignatandrei/RSCG_Examples

Length of output: 174


Fix invalid JSON syntax (parse blocker).

Line 36 uses assignment syntax (SpeakTest=" ") instead of JSON key/value syntax, making the file unparseable.

Proposed fix
-{"typeStep":"browser","arg":"https://ignatandrei.github.io/RSCG_Examples/v2/docs/SvgIconGenerator#download-example-net--c-",
-SpeakTest=" "},
+{"typeStep":"browser","arg":"https://ignatandrei.github.io/RSCG_Examples/v2/docs/SvgIconGenerator#download-example-net--c-"},
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
{"typeStep":"browser","arg":"https://ignatandrei.github.io/RSCG_Examples/v2/docs/SvgIconGenerator#download-example-net--c-",
SpeakTest=" "},
{"typeStep":"waitseconds","arg":"30"},
]
{"typeStep":"browser","arg":"https://ignatandrei.github.io/RSCG_Examples/v2/docs/SvgIconGenerator#download-example-net--c-"},
{"typeStep":"waitseconds","arg":"30"},
]
🧰 Tools
🪛 Biome (2.4.9)

[error] 36-36: Property key must be double quoted

(parse)


[error] 36-36: unexpected character =

(parse)


[error] 36-36: expected , but instead found " "

(parse)


[error] 36-36: expected : but instead found }

(parse)


[error] 38-38: Expected an array, an object, or a literal but instead found ']'.

(parse)

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@v2/rscg_examples/SvgIconGenerator/video.json` around lines 35 - 38, The JSON
is invalid because the object in the steps array uses assignment syntax
SpeakTest=" " instead of a JSON key/value pair; update that entry to use proper
JSON syntax (e.g., "SpeakTest": " ") within the same object in the array (the
objects represented by {"typeStep":"browser","arg":"https://...","SpeakTest": "
"}) and ensure commas and brackets remain valid so the file parses as JSON;
after the change, validate the file to confirm it's well-formed.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a new RSCG example for SvgIconGenerator to the v2 catalog and site assets, including a minimal demo project and accompanying metadata/resources used by the documentation/site pipeline.

Changes:

  • Register SvgIconGenerator in the central generator data list.
  • Add a new SvgIconGenerator example (demo project, icons, metadata, and video script).
  • Add/refresh downloadable/export artifacts for the site (example zip + Excel export).

Reviewed changes

Copilot reviewed 25 out of 29 changed files in this pull request and generated no comments.

Show a summary per file
File Description
v2/RSCGExamplesData/GeneratorDataRec.json Adds the SvgIconGenerator entry (ID/category/date/show) to the generator registry.
v2/rscg_examples/SvgIconGenerator/video.json Adds the scripted steps for producing the example walkthrough video.
v2/rscg_examples/SvgIconGenerator/src/DemoSvg/Program.cs Demo usage of generated icon properties.
v2/rscg_examples/SvgIconGenerator/src/DemoSvg/Icons/Rect.svg Adds a sample rectangle SVG input.
v2/rscg_examples/SvgIconGenerator/src/DemoSvg/Icons/Circle.svg Adds a sample circle SVG input.
v2/rscg_examples/SvgIconGenerator/src/DemoSvg/Icons.cs Declares the partial icon container class with [GenerateIcons].
v2/rscg_examples/SvgIconGenerator/src/DemoSvg/DemoSvg.csproj New demo project referencing SvgIconGenerator and including SVGs as AdditionalFiles.
v2/rscg_examples/SvgIconGenerator/src/DemoSvg.slnx Solution wrapper for the demo project.
v2/rscg_examples/SvgIconGenerator/readme.txt Adds the generator’s usage/readme content for the example.
v2/rscg_examples/SvgIconGenerator/nuget.txt Short NuGet description snippet used by the site pipeline.
v2/rscg_examples/SvgIconGenerator/description.json Site metadata describing the generator, links, and demo file list.
v2/rscg_examples_site/static/sources/SvgIconGenerator.zip Downloadable packaged source for the example.
v2/rscg_examples_site/static/exports/RSCG.xlsx Updated/added Excel export of the RSCG list.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@ignatandrei ignatandrei merged commit d7e46d2 into main Apr 3, 2026
7 checks passed
@ignatandrei ignatandrei deleted the SvgIconGenerator branch April 3, 2026 11:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants