summaryrefslogtreecommitdiffhomepage
path: root/services/blog/nuldoc-src/render.ts
blob: fbad25ab9a4c76362b6652f2478cfcc8cfbbef8d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
import { Node } from "./dom.ts";
import { renderHtml } from "./renderers/html.ts";
import { renderXml } from "./renderers/xml.ts";

export type RendererType = "html" | "xml";

export function render(root: Node, renderer: RendererType): string {
  if (renderer === "html") {
    return renderHtml(root);
  } else {
    return renderXml(root);
  }
}