-
Notifications
You must be signed in to change notification settings - Fork 0
Usage Guide
Trais McAllister edited this page Aug 15, 2024
·
1 revision
This guide will walk you through the basics of using the MtconnectTranspiler.CodeGenerators.ScribanTemplates library.
Templates can be loaded or embedded resources. The IncludeSharedTemplates class helps manage this.
Example:
var serviceProvider = services.BuildServiceProvider();
var templateGenerator = serviceProvider.GetRequiredService<IScribanTemplateGenerator>();
templateGenerator.ProcessTemplate(yourModel, "OutputDirectory");Markdown interpreters transform custom markdown syntax into different formats. You can add and configure interpreters during the service registration.
Example:
builder.AddMarkdownInterpreter("docs", new CustomMarkdownInterpreter());Code formatters ensure that code strings follow language-specific conventions.
Example:
builder.AddCodeFormatter("python", new PythonCodeFormatter());You can create custom interpreters and formatters by extending the MarkdownInterpreter and CodeFormatter classes.
Example:
public class CustomMarkdownInterpreter : MarkdownInterpreter
{
public override string Interpret(string input)
{
// Custom interpretation logic
return input.ToUpper();
}
}