Skip to main content
Using Deno in production at your company? Earn free Deno merch.
Give us feedback
Module

x/xml_renderer/mod.ts>Component

An npm/browser module for easy matching XML and XPath to React Components and other stuff
Go to Latest
type alias Component
import { type Component } from "https://deno.land/x/xml_renderer@5.0.7/mod.ts";

When creating an element rendering rule, an XPath test is matched to a Component. The rule component is expected to return null or a AstComponent -- which represents a node in the DOCX AST.

In the following example, the arrow function declaration is a rule component that returns the Bold docx component:

app.match('self::bold', ({ traverse }) => (
  <Text bold>{traverse()}</Text>
));

Type Parameters

OutputGeneric
PropsGeneric extends { [key: string]: unknown; } | undefined
definition: (props: Props<OutputGeneric, PropsGeneric>) => OutputGeneric