DocumentationContextExtensions.TryTransformText Method

Namespace
Kampute.DocToolkit
Assembly
  • Kampute.DocToolkit.dll

Definition

Attempts to transform the specified text using the appropriate text transformer based on the file extension.
public static bool TryTransformText(
	this IDocumentationContext context,
	string fileExtension,
	string text,
	[NotNullWhen(true)] out string transformedText)

Parameters

context IDocumentationContext
The documentation context that provides the text transformer.
fileExtension string
The file extension to identify the appropriate text transformer.
text string
The text to be transformed.
transformedText string
When this method returns, contains the transformed text if the transformation was successful; otherwise, null. This parameter is passed uninitialized.

Returns

bool
true if the transformation was successful; otherwise, false.

Exceptions

ArgumentNullException
Thrown when context, fileExtension, or text is null.

Remarks

This method attempts to transform the provided text using the appropriate text transformer based on the specified file extension as the source format. If the text is empty, the method returns an empty string as the transformed text even if the format is not supported.