This documentation is also published as Markdown for efficient machine reading: the whole site is indexed at /llms.txt, and every page has a clean Markdown copy under /_llms/. These are generated from the same source and cost far fewer tokens to read than this rendered HTML.

Skip to main content Skip to navigation

ContentFormatRegistry Pennington.Pipeline

Maps content-format keys (e.g. "markdown", "cook") to the factories that build the format's IContentParser and IContentRenderer. Populated once while AddPennington wires services, then read by DispatchingContentParser and DispatchingContentRenderer at request time. Format keys are matched case-insensitively.

Methods

Register

#
public void Register(string format, Func<IServiceProvider, IContentParser> parser, Func<IServiceProvider, IContentRenderer> renderer)

Registers (overwriting) the parser and renderer factories for a format key.

Parameters

format string
Format key the dispatchers route on.
parser Func<IServiceProvider, IContentParser>
Resolves the format's parser from the request scope.
renderer Func<IServiceProvider, IContentRenderer>
Resolves the format's renderer from the request scope.

TryGetParser

#
public bool TryGetParser(string format, out Func<IServiceProvider, IContentParser> factory)

Gets the parser factory registered for format, if any.

Parameters

format string
factory ref Func<IServiceProvider, IContentParser>

Returns

bool

TryGetRenderer

#
public bool TryGetRenderer(string format, out Func<IServiceProvider, IContentRenderer> factory)

Gets the renderer factory registered for format, if any.

Parameters

format string
factory ref Func<IServiceProvider, IContentRenderer>

Returns

bool

Pennington.Pipeline.ContentFormatRegistry

namespace Pennington.Pipeline;

/// Maps content-format keys (e.g. "markdown", "cook") to the factories that build the format's IContentParser and IContentRenderer. Populated once while AddPennington wires services, then read by DispatchingContentParser and DispatchingContentRenderer at request time. Format keys are matched case-insensitively.
public class ContentFormatRegistry
{
    /// Registers (overwriting) the parser and renderer factories for a format key.
    
public void Register(string format, Func<IServiceProvider, IContentParser> parser, Func<IServiceProvider, IContentRenderer> renderer)
; /// Gets the parser factory registered for format, if any.
public bool TryGetParser(string format, out Func<IServiceProvider, IContentParser> factory)
; /// Gets the renderer factory registered for format, if any.
public bool TryGetRenderer(string format, out Func<IServiceProvider, IContentRenderer> factory)
; }