@@ -49,21 +49,21 @@ Matt Schneeberger
4949## Original Readme
5050::: note
5151
52- # SVG Icon Generator
52+ ### SVG Icon Generator
5353
5454A C# source generator that automatically creates strongly-typed icon properties from SVG files.
5555
56- ## Installation
56+ ###### Installation
5757
5858Install the NuGet package in your project:
5959
6060``` bash
6161dotnet add package SvgIconGenerator
6262```
6363
64- ## Usage
64+ ###### Usage
6565
66- ### 1. Organize Your SVG Files
66+ ######### 1. Organize Your SVG Files
6767
6868Place your SVG icon files in a folder within your project (e.g., ` Icons/ ` ):
6969
@@ -76,7 +76,7 @@ YourProject/
7676└── Program.cs
7777```
7878
79- ### 2. Add SVG Files as AdditionalFiles
79+ ######### 2. Add SVG Files as AdditionalFiles
8080
8181In your ` .csproj ` file, add the SVG files as ` AdditionalFiles ` :
8282
@@ -88,7 +88,7 @@ In your `.csproj` file, add the SVG files as `AdditionalFiles`:
8888
8989** Important** : Adding files as ` AdditionalFiles ` ensures that changes to SVG files trigger regeneration during incremental compilation.
9090
91- ### 3. Create an Icon Class
91+ ######### 3. Create an Icon Class
9292
9393Create a ` static partial ` class and decorate it with the ` [GenerateIcons] ` attribute:
9494
@@ -109,7 +109,7 @@ internal static partial class AllIcons;
109109internal static partial class MyIcons ;
110110```
111111
112- ### 4. Access Generated Icons
112+ ######### 4. Access Generated Icons
113113
114114The source generator will create properties for each SVG file. Property names are automatically converted from kebab-case to PascalCase:
115115
@@ -122,7 +122,7 @@ Console.WriteLine($"ViewBox: {icon.DefaultAttributes["viewBox"]}");
122122Console .WriteLine ($" SVG content: {icon .InnerContent }" );
123123```
124124
125- ### 5. Render Icons
125+ ######### 5. Render Icons
126126
127127The ` IconDto ` contains everything needed to render the icon:
128128
@@ -155,11 +155,11 @@ string svg = RenderIcon(MyIcons.UserCircle, new Dictionary<string, string>
155155});
156156```
157157
158- ## Using with Popular Icon Libraries
158+ ###### Using with Popular Icon Libraries
159159
160160You can use this generator with popular icon libraries installed via NPM, such as Bootstrap Icons, Lucide, Heroicons, or Feather Icons.
161161
162- ### Example: Lucide Icons
162+ ######### Example: Lucide Icons
163163
1641641 . Install Lucide icons via NPM:
165165
@@ -190,7 +190,7 @@ IconDto icon2 = LucideIcons.ShoppingCart;
190190IconDto icon3 = LucideIcons .AlertTriangle ;
191191```
192192
193- ### Example: Bootstrap Icons
193+ ######### Example: Bootstrap Icons
194194
195195``` bash
196196npm install bootstrap-icons
@@ -207,7 +207,7 @@ npm install bootstrap-icons
207207internal static partial class BootstrapIcons ;
208208```
209209
210- ### Example: Heroicons
210+ ######### Example: Heroicons
211211
212212``` bash
213213npm install heroicons
@@ -230,7 +230,7 @@ internal static partial class HeroiconsOutline;
230230internal static partial class HeroiconsSolid ;
231231```
232232
233- ### Multiple Icon Sets
233+ ######### Multiple Icon Sets
234234
235235You can create multiple icon classes in the same project to organize different icon sets:
236236
@@ -253,7 +253,7 @@ internal static partial class CustomIcons;
253253internal static partial class LogoIcons ;
254254```
255255
256- ## How It Works
256+ ###### How It Works
257257
2582581 . The source generator reads SVG files from ` AdditionalFiles ` in your project
2592592 . Files are optionally filtered by glob pattern (if specified in the attribute)
@@ -264,15 +264,15 @@ internal static partial class LogoIcons;
2642644 . Generates a partial class with ` IconDto ` properties for each icon
2652655 . ** Incremental compilation** : Changes to SVG files automatically trigger regeneration
266266
267- ## IconDto Structure
267+ ###### IconDto Structure
268268
269269The generated ` IconDto ` record contains:
270270
271271- ** Name** (` string ` ): The original kebab-case filename without extension
272272- ** DefaultAttributes** (` IReadOnlyDictionary<string, string> ` ): SVG root attributes like ` viewBox ` , ` fill ` , ` stroke ` , etc.
273273- ** InnerContent** (` string ` ): The inner HTML content (paths, circles, etc.)
274274
275- ## Example SVG Input
275+ ###### Example SVG Input
276276
277277Given an SVG file ` Icons/user-circle.svg ` :
278278
@@ -303,12 +303,12 @@ public static readonly IconDto UserCircle = new IconDto(
303303 " <circle cx=\" 12\" cy=\" 12\" r=\" 10\" /><circle cx=\" 12\" cy=\" 10\" r=\" 3\" /><path d=\" M7 20.662V19a2 2 0 0 1 2-2h6a2 2 0 0 1 2 2v1.662\" />" );
304304```
305305
306- ## Requirements
306+ ###### Requirements
307307
308308- .NET Standard 2.0 or higher
309309- C# 9.0 or higher (for record types)
310310
311- ## License
311+ ###### License
312312
313313See the repository for license information.
314314
@@ -360,7 +360,7 @@ This is the CSharp Project that references **SvgIconGenerator**
360360
361361</TabItem >
362362
363- <TabItem value =" D:\gth\RSCG_Examples\v2\rscg_examples\SvgIconGenerator\src\DemoSvg\DemoSvg\ Program.cs " label =" Program.cs " >
363+ <TabItem value =" D:\gth\RSCG_Examples\v2\rscg_examples\SvgIconGenerator\src\DemoSvg\Program.cs " label =" Program.cs " >
364364
365365 This is the use of ** SvgIconGenerator** in * Program.cs*
366366
@@ -374,7 +374,7 @@ Console.WriteLine(MyIcons.Rect.InnerContent);
374374```
375375 </TabItem >
376376
377- <TabItem value =" D:\gth\RSCG_Examples\v2\rscg_examples\SvgIconGenerator\src\DemoSvg\DemoSvg\ Icons.cs " label =" Icons.cs " >
377+ <TabItem value =" D:\gth\RSCG_Examples\v2\rscg_examples\SvgIconGenerator\src\DemoSvg\Icons.cs " label =" Icons.cs " >
378378
379379 This is the use of ** SvgIconGenerator** in * Icons.cs*
380380
@@ -400,7 +400,7 @@ Those are taken from $(BaseIntermediateOutputPath)\GX
400400<Tabs >
401401
402402
403- <TabItem value =" D:\gth\RSCG_Examples\v2\rscg_examples\SvgIconGenerator\src\DemoSvg\DemoSvg\ obj\GX\SvgIconGenerator\SvgIconGenerator.IconGenerator\GenerateIconsAttribute.g.cs " label =" GenerateIconsAttribute.g.cs " >
403+ <TabItem value =" D:\gth\RSCG_Examples\v2\rscg_examples\SvgIconGenerator\src\DemoSvg\obj\GX\SvgIconGenerator\SvgIconGenerator.IconGenerator\GenerateIconsAttribute.g.cs " label =" GenerateIconsAttribute.g.cs " >
404404``` csharp showLineNumbers
405405namespace SvgIconGenerator
406406{
@@ -446,7 +446,7 @@ namespace SvgIconGenerator
446446 </TabItem >
447447
448448
449- <TabItem value =" D:\gth\RSCG_Examples\v2\rscg_examples\SvgIconGenerator\src\DemoSvg\DemoSvg\ obj\GX\SvgIconGenerator\SvgIconGenerator.IconGenerator\IconDto.g.cs " label =" IconDto.g.cs " >
449+ <TabItem value =" D:\gth\RSCG_Examples\v2\rscg_examples\SvgIconGenerator\src\DemoSvg\obj\GX\SvgIconGenerator\SvgIconGenerator.IconGenerator\IconDto.g.cs " label =" IconDto.g.cs " >
450450``` csharp showLineNumbers
451451namespace SvgIconGenerator
452452{
@@ -464,7 +464,7 @@ namespace SvgIconGenerator
464464 </TabItem >
465465
466466
467- <TabItem value =" D:\gth\RSCG_Examples\v2\rscg_examples\SvgIconGenerator\src\DemoSvg\DemoSvg\ obj\GX\SvgIconGenerator\SvgIconGenerator.IconGenerator\MyIcons.g.cs " label =" MyIcons.g.cs " >
467+ <TabItem value =" D:\gth\RSCG_Examples\v2\rscg_examples\SvgIconGenerator\src\DemoSvg\obj\GX\SvgIconGenerator\SvgIconGenerator.IconGenerator\MyIcons.g.cs " label =" MyIcons.g.cs " >
468468``` csharp showLineNumbers
469469// ------------------------------------------------------------------------------
470470// <auto-generated>
0 commit comments