> ## Documentation Index
> Fetch the complete documentation index at: https://dotnetdocs.com/llms.txt
> Use this file to discover all available pages before exploring further.

# IServiceCollection

> Extension methods for IServiceCollection from Microsoft.Extensions.DependencyInjection.Abstractions

## Definition

**Assembly:** Microsoft.Extensions.DependencyInjection.Abstractions.dll

**Namespace:** Microsoft.Extensions.DependencyInjection

## Syntax

```csharp theme={"dark"}
Microsoft.Extensions.DependencyInjection.IServiceCollection
```

## Summary

This type is defined in Microsoft.Extensions.DependencyInjection.Abstractions.

## Remarks

See [Microsoft documentation](https://learn.microsoft.com/dotnet/api/microsoft.extensions.dependencyinjection.iservicecollection) for more information about the rest of the API.

## Methods

### <Icon icon="puzzle-piece" iconType="duotone" color="#419AC5" size={24} className="mr-2" /> AddDocEnricher <Badge color="green">Extension</Badge>

<Note>Extension method from `Microsoft.Extensions.DependencyInjection.DotNetDocsCore_IServiceCollectionExtensions`</Note>

Adds a custom document enricher to the service collection.

#### Syntax

```csharp theme={"dark"}
public static Microsoft.Extensions.DependencyInjection.IServiceCollection AddDocEnricher<TEnricher>(Microsoft.Extensions.DependencyInjection.IServiceCollection services) where TEnricher : class, CloudNimble.DotNetDocs.Core.IDocEnricher
```

#### Parameters

| Name       | Type                                                          | Description             |
| ---------- | ------------------------------------------------------------- | ----------------------- |
| `services` | `Microsoft.Extensions.DependencyInjection.IServiceCollection` | The service collection. |

#### Returns

Type: `Microsoft.Extensions.DependencyInjection.IServiceCollection`
The service collection for chaining.

#### Type Parameters

* `TEnricher` - The type of enricher to add.

#### Examples

```csharp theme={"dark"}
services.AddDocEnricher&lt;ConceptualContentEnricher&gt;();
```

#### Remarks

Registers the enricher as Scoped implementation of IDocEnricher.
Enrichers add conceptual content to documentation entities.

### <Icon icon="puzzle-piece" iconType="duotone" color="#419AC5" size={24} className="mr-2" /> AddDocRenderer <Badge color="green">Extension</Badge>

<Note>Extension method from `Microsoft.Extensions.DependencyInjection.DotNetDocsCore_IServiceCollectionExtensions`</Note>

Adds a custom document renderer to the service collection.

#### Syntax

```csharp theme={"dark"}
public static Microsoft.Extensions.DependencyInjection.IServiceCollection AddDocRenderer<TRenderer>(Microsoft.Extensions.DependencyInjection.IServiceCollection services) where TRenderer : class, CloudNimble.DotNetDocs.Core.IDocRenderer
```

#### Parameters

| Name       | Type                                                          | Description             |
| ---------- | ------------------------------------------------------------- | ----------------------- |
| `services` | `Microsoft.Extensions.DependencyInjection.IServiceCollection` | The service collection. |

#### Returns

Type: `Microsoft.Extensions.DependencyInjection.IServiceCollection`
The service collection for chaining.

#### Type Parameters

* `TRenderer` - The type of renderer to add.

#### Examples

```csharp theme={"dark"}
services.AddDocRenderer&lt;MyCustomRenderer&gt;();
```

#### Remarks

Registers the renderer as Scoped implementation of IDocRenderer.

### <Icon icon="puzzle-piece" iconType="duotone" color="#419AC5" size={24} className="mr-2" /> AddDocTransformer <Badge color="green">Extension</Badge>

<Note>Extension method from `Microsoft.Extensions.DependencyInjection.DotNetDocsCore_IServiceCollectionExtensions`</Note>

Adds a custom document transformer to the service collection.

#### Syntax

```csharp theme={"dark"}
public static Microsoft.Extensions.DependencyInjection.IServiceCollection AddDocTransformer<TTransformer>(Microsoft.Extensions.DependencyInjection.IServiceCollection services) where TTransformer : class, CloudNimble.DotNetDocs.Core.IDocTransformer
```

#### Parameters

| Name       | Type                                                          | Description             |
| ---------- | ------------------------------------------------------------- | ----------------------- |
| `services` | `Microsoft.Extensions.DependencyInjection.IServiceCollection` | The service collection. |

#### Returns

Type: `Microsoft.Extensions.DependencyInjection.IServiceCollection`
The service collection for chaining.

#### Type Parameters

* `TTransformer` - The type of transformer to add.

#### Examples

```csharp theme={"dark"}
services.AddDocTransformer&lt;InheritDocTransformer&gt;();
```

#### Remarks

Registers the transformer as Scoped implementation of IDocTransformer.
Transformers modify the documentation model before rendering.

### <Icon icon="puzzle-piece" iconType="duotone" color="#419AC5" size={24} className="mr-2" /> AddDotNetDocs <Badge color="green">Extension</Badge>

<Note>Extension method from `Microsoft.Extensions.DependencyInjection.DotNetDocsCore_IServiceCollectionExtensions`</Note>

Adds DotNetDocs services with all built-in renderers to the service collection.

#### Syntax

```csharp theme={"dark"}
public static Microsoft.Extensions.DependencyInjection.IServiceCollection AddDotNetDocs(Microsoft.Extensions.DependencyInjection.IServiceCollection services, System.Action<CloudNimble.DotNetDocs.Core.ProjectContext> configureContext = null)
```

#### Parameters

| Name               | Type                                                          | Description                                      |
| ------------------ | ------------------------------------------------------------- | ------------------------------------------------ |
| `services`         | `Microsoft.Extensions.DependencyInjection.IServiceCollection` | The service collection.                          |
| `configureContext` | `System.Action<CloudNimble.DotNetDocs.Core.ProjectContext>?`  | Optional action to configure the ProjectContext. |

#### Returns

Type: `Microsoft.Extensions.DependencyInjection.IServiceCollection`
The service collection for chaining.

#### Examples

```csharp theme={"dark"}
services.AddDotNetDocs(context =&gt;
{
    context.OutputPath = "docs/api";
    context.ShowPlaceholders = false;
});
```

#### Remarks

This method registers:

* ProjectContext as Singleton
* DocumentationManager as Scoped
* All built-in renderers (Markdown, JSON, YAML) as Scoped
* MarkdownXmlTransformer for processing XML documentation tags

### <Icon icon="puzzle-piece" iconType="duotone" color="#419AC5" size={24} className="mr-2" /> AddDotNetDocsCore <Badge color="green">Extension</Badge>

<Note>Extension method from `Microsoft.Extensions.DependencyInjection.DotNetDocsCore_IServiceCollectionExtensions`</Note>

Adds only the core DotNetDocs services without any renderers.

#### Syntax

```csharp theme={"dark"}
public static Microsoft.Extensions.DependencyInjection.IServiceCollection AddDotNetDocsCore(Microsoft.Extensions.DependencyInjection.IServiceCollection services, System.Action<CloudNimble.DotNetDocs.Core.ProjectContext> configureContext = null)
```

#### Parameters

| Name               | Type                                                          | Description                                      |
| ------------------ | ------------------------------------------------------------- | ------------------------------------------------ |
| `services`         | `Microsoft.Extensions.DependencyInjection.IServiceCollection` | The service collection.                          |
| `configureContext` | `System.Action<CloudNimble.DotNetDocs.Core.ProjectContext>?`  | Optional action to configure the ProjectContext. |

#### Returns

Type: `Microsoft.Extensions.DependencyInjection.IServiceCollection`
The service collection for chaining.

#### Examples

```csharp theme={"dark"}
services.AddDotNetDocsCore(context =&gt;
{
    context.OutputPath = "docs";
});
services.AddMarkdownRenderer();
```

#### Remarks

Use this method when you want to manually register specific renderers.
This registers:

* ProjectContext as Singleton
* DocumentationManager as Scoped

### <Icon icon="puzzle-piece" iconType="duotone" color="#419AC5" size={24} className="mr-2" /> AddDotNetDocsPipeline <Badge color="green">Extension</Badge>

<Note>Extension method from `Microsoft.Extensions.DependencyInjection.DotNetDocsCore_IServiceCollectionExtensions`</Note>

Adds DotNetDocs services using a fluent pipeline builder.

#### Syntax

```csharp theme={"dark"}
public static Microsoft.Extensions.DependencyInjection.IServiceCollection AddDotNetDocsPipeline(Microsoft.Extensions.DependencyInjection.IServiceCollection services, System.Action<CloudNimble.DotNetDocs.Core.Configuration.DotNetDocsBuilder> configurePipeline)
```

#### Parameters

| Name                | Type                                                                         | Description                                     |
| ------------------- | ---------------------------------------------------------------------------- | ----------------------------------------------- |
| `services`          | `Microsoft.Extensions.DependencyInjection.IServiceCollection`                | The service collection.                         |
| `configurePipeline` | `System.Action<CloudNimble.DotNetDocs.Core.Configuration.DotNetDocsBuilder>` | Action to configure the documentation pipeline. |

#### Returns

Type: `Microsoft.Extensions.DependencyInjection.IServiceCollection`
The service collection for chaining.

#### Examples

```csharp theme={"dark"}
services.AddDotNetDocsPipeline(pipeline =&gt;
{
    pipeline
        .UseMarkdownRenderer()
        .UseJsonRenderer(options =&gt; options.WriteIndented = true)
        .AddEnricher&lt;MyCustomEnricher&gt;()
        .ConfigureContext(ctx =&gt; ctx.OutputPath = "docs");
});
```

### <Icon icon="puzzle-piece" iconType="duotone" color="#419AC5" size={24} className="mr-2" /> AddJsonRenderer <Badge color="green">Extension</Badge>

<Note>Extension method from `Microsoft.Extensions.DependencyInjection.DotNetDocsCore_IServiceCollectionExtensions`</Note>

Adds the JSON renderer to the service collection.

#### Syntax

```csharp theme={"dark"}
public static Microsoft.Extensions.DependencyInjection.IServiceCollection AddJsonRenderer(Microsoft.Extensions.DependencyInjection.IServiceCollection services, System.Action<CloudNimble.DotNetDocs.Core.Renderers.JsonRendererOptions> configureOptions = null)
```

#### Parameters

| Name               | Type                                                                        | Description                                       |
| ------------------ | --------------------------------------------------------------------------- | ------------------------------------------------- |
| `services`         | `Microsoft.Extensions.DependencyInjection.IServiceCollection`               | The service collection.                           |
| `configureOptions` | `System.Action<CloudNimble.DotNetDocs.Core.Renderers.JsonRendererOptions>?` | Optional action to configure JsonRendererOptions. |

#### Returns

Type: `Microsoft.Extensions.DependencyInjection.IServiceCollection`
The service collection for chaining.

#### Examples

```csharp theme={"dark"}
services.AddJsonRenderer(options =&gt;
{
    options.WriteIndented = true;
    options.IncludeNullValues = false;
});
```

#### Remarks

Registers JsonRenderer as Scoped implementation of IDocRenderer.

### <Icon icon="puzzle-piece" iconType="duotone" color="#419AC5" size={24} className="mr-2" /> AddMarkdownRenderer <Badge color="green">Extension</Badge>

<Note>Extension method from `Microsoft.Extensions.DependencyInjection.DotNetDocsCore_IServiceCollectionExtensions`</Note>

Adds the Markdown renderer to the service collection.

#### Syntax

```csharp theme={"dark"}
public static Microsoft.Extensions.DependencyInjection.IServiceCollection AddMarkdownRenderer(Microsoft.Extensions.DependencyInjection.IServiceCollection services)
```

#### Parameters

| Name       | Type                                                          | Description             |
| ---------- | ------------------------------------------------------------- | ----------------------- |
| `services` | `Microsoft.Extensions.DependencyInjection.IServiceCollection` | The service collection. |

#### Returns

Type: `Microsoft.Extensions.DependencyInjection.IServiceCollection`
The service collection for chaining.

#### Remarks

Registers the following services:

### <Icon icon="puzzle-piece" iconType="duotone" color="#419AC5" size={24} className="mr-2" /> AddMintlifyRenderer <Badge color="green">Extension</Badge>

<Note>Extension method from `Microsoft.Extensions.DependencyInjection.DotNetDocsMintlify_IServiceCollectionExtensions`</Note>

Adds the Mintlify renderer to the service collection.

#### Syntax

```csharp theme={"dark"}
public static Microsoft.Extensions.DependencyInjection.IServiceCollection AddMintlifyRenderer(Microsoft.Extensions.DependencyInjection.IServiceCollection services)
```

#### Parameters

| Name       | Type                                                          | Description             |
| ---------- | ------------------------------------------------------------- | ----------------------- |
| `services` | `Microsoft.Extensions.DependencyInjection.IServiceCollection` | The service collection. |

#### Returns

Type: `Microsoft.Extensions.DependencyInjection.IServiceCollection`
The service collection for chaining.

#### Examples

```csharp theme={"dark"}
services.AddMintlifyRenderer();
```

#### Remarks

This method registers:

### <Icon icon="puzzle-piece" iconType="duotone" color="#419AC5" size={24} className="mr-2" /> AddMintlifyRenderer <Badge color="green">Extension</Badge>

<Note>Extension method from `Microsoft.Extensions.DependencyInjection.DotNetDocsMintlify_IServiceCollectionExtensions`</Note>

Adds a custom Mintlify renderer implementation to the service collection.

#### Syntax

```csharp theme={"dark"}
public static Microsoft.Extensions.DependencyInjection.IServiceCollection AddMintlifyRenderer<TRenderer>(Microsoft.Extensions.DependencyInjection.IServiceCollection services) where TRenderer : CloudNimble.DotNetDocs.Mintlify.MintlifyRenderer
```

#### Parameters

| Name       | Type                                                          | Description             |
| ---------- | ------------------------------------------------------------- | ----------------------- |
| `services` | `Microsoft.Extensions.DependencyInjection.IServiceCollection` | The service collection. |

#### Returns

Type: `Microsoft.Extensions.DependencyInjection.IServiceCollection`
The service collection for chaining.

#### Type Parameters

* `TRenderer` - The type of Mintlify renderer to add.

#### Examples

```csharp theme={"dark"}
services.AddMintlifyRenderer&lt;CustomMintlifyRenderer&gt;();
```

#### Remarks

Registers the custom renderer as Scoped implementation of IDocRenderer.

The renderer must inherit from MintlifyRenderer.

This method also registers:

### <Icon icon="puzzle-piece" iconType="duotone" color="#419AC5" size={24} className="mr-2" /> AddMintlifyServices <Badge color="green">Extension</Badge>

<Note>Extension method from `Microsoft.Extensions.DependencyInjection.DotNetDocsMintlify_IServiceCollectionExtensions`</Note>

Adds Mintlify documentation services including the renderer and DocsJsonManager.

#### Syntax

```csharp theme={"dark"}
public static Microsoft.Extensions.DependencyInjection.IServiceCollection AddMintlifyServices(Microsoft.Extensions.DependencyInjection.IServiceCollection services)
```

#### Parameters

| Name       | Type                                                          | Description             |
| ---------- | ------------------------------------------------------------- | ----------------------- |
| `services` | `Microsoft.Extensions.DependencyInjection.IServiceCollection` | The service collection. |

#### Returns

Type: `Microsoft.Extensions.DependencyInjection.IServiceCollection`
The service collection for chaining.

#### Examples

```csharp theme={"dark"}
services.AddMintlifyServices();
```

#### Remarks

This method registers:

### <Icon icon="puzzle-piece" iconType="duotone" color="#419AC5" size={24} className="mr-2" /> AddMintlifyServices <Badge color="green">Extension</Badge>

<Note>Extension method from `Microsoft.Extensions.DependencyInjection.DotNetDocsMintlify_IServiceCollectionExtensions`</Note>

Adds Mintlify documentation services with configuration options.

#### Syntax

```csharp theme={"dark"}
public static Microsoft.Extensions.DependencyInjection.IServiceCollection AddMintlifyServices(Microsoft.Extensions.DependencyInjection.IServiceCollection services, System.Action<CloudNimble.DotNetDocs.Mintlify.MintlifyRendererOptions> configureMintlify)
```

#### Parameters

| Name                | Type                                                                     | Description                           |
| ------------------- | ------------------------------------------------------------------------ | ------------------------------------- |
| `services`          | `Microsoft.Extensions.DependencyInjection.IServiceCollection`            | The service collection.               |
| `configureMintlify` | `System.Action<CloudNimble.DotNetDocs.Mintlify.MintlifyRendererOptions>` | Action to configure Mintlify options. |

#### Returns

Type: `Microsoft.Extensions.DependencyInjection.IServiceCollection`
The service collection for chaining.

#### Examples

```csharp theme={"dark"}
services.AddMintlifyServices(options =&gt;
{
    options.GenerateDocsJson = true;
    options.IncludeIcons = true;
});
```

#### Remarks

This method registers:

### <Icon icon="puzzle-piece" iconType="duotone" color="#419AC5" size={24} className="mr-2" /> AddYamlRenderer <Badge color="green">Extension</Badge>

<Note>Extension method from `Microsoft.Extensions.DependencyInjection.DotNetDocsCore_IServiceCollectionExtensions`</Note>

Adds the YAML renderer to the service collection.

#### Syntax

```csharp theme={"dark"}
public static Microsoft.Extensions.DependencyInjection.IServiceCollection AddYamlRenderer(Microsoft.Extensions.DependencyInjection.IServiceCollection services)
```

#### Parameters

| Name       | Type                                                          | Description             |
| ---------- | ------------------------------------------------------------- | ----------------------- |
| `services` | `Microsoft.Extensions.DependencyInjection.IServiceCollection` | The service collection. |

#### Returns

Type: `Microsoft.Extensions.DependencyInjection.IServiceCollection`
The service collection for chaining.

#### Remarks

Registers YamlRenderer as Scoped implementation of IDocRenderer.
