# Converters

Converters are utilities that take the whole document as input and outputs after converting it.

Filter functions should be preferred if doing a conversion is possible with filters. However, sometimes it is not easy to operate on individual strings.

See available converters.

Example:

import { PgGenerator, Context, converters } from "pg-generator";

export default class App extends PgGenerator {
  protected async render(templatePath: string, context: Context): Promise<string> {
    const content = nunjucks.render(templatePath, context);
    return converters.mermaidToSVG(content);
  }
}