Skip to content
This repository has been archived by the owner on Mar 7, 2023. It is now read-only.

Latest commit

 

History

History
59 lines (40 loc) · 1.78 KB

render-engines.md

File metadata and controls

59 lines (40 loc) · 1.78 KB

renderEngines

Overview

The renderEngines property is required and contains an array of render engines specified for the component.

A render engine is a pure React component. Its purpose is to render the content of a specific type of document to the HTML format.

Usage

Read how to use the renderEngines property in the Documentation component.

Types

For types of render engines, see this file.

Pass global options

The renderEngines property allows also you to define options for a single render engine. Instead of passing a single one, pass an object with the renderEngine field with the appropriate render engine as a value, and add the options field.

See this example:

const RENDER_ENGINES: RenderEngines = [
  {
    renderEngine: markdownRenderEngine,
    options: {
      headerPrefix: "documentation-component",
    }
  },
];

NOTE: For information on how to pass options per group of sources or per a single source, read this section.

Pass render engines to the component

The renderEngines property is an array of render engines. To pass render engines to the component, define an array of render engines and pass it to the global provider of the Documentation component.

See this example:

const RENDER_ENGINES: RenderEngines = [
  markdownRenderEngine,
];

const App: React.FunctionComponent<> = () => (
  <DC.Provider
    {...otherProps}
    renderEngines={RENDER_ENGINES}
  >
    <Content />
  </DC.Provider>
);

Custom render engine

For information on how to write a custom render engine for specific types, read this document.