a component which takes an HTML ast and renders the platform specific markup
npm install @times-components/markupThis package is for core rendering of components such as paragraph, text orlink. Consumers provide an Abstract Syntax Tree (AST) to the traversal
functions from markup-forest, which iterates over and renders with the givenrenderer functions. This packages provides those core renderers.
- bold
- block
- break
- emphasis
- inline
- italic
- paragraph
- strong
- text
- link
This package should only have core renderers with no dependencies beyond
React. If a consumer would like to support more complex elements
they'll need to provide renderers for them.
Please read CONTRIBUTING.md before contributing to this
package
Please see our main README.md to get the project running locally
The code can be formatted and linted in accordance with the agreed standards.
```
yarn fmt
yarn lint
Testing can be done by running:
``
yarn test:web
Visit the official
storybook
to see our available markup templates.
`js
import { renderTrees } from "@times-components/markup-forest";
import coreRenderers from "@times-components/markup";
const data = [
{
name: "inline",
attributes: {},
children: [
{
name: "text",
attributes: {
value: "Some text value here"
},
children: []
}
]
}
];
renderTrees(data, coreRenderers);
/*
web
Some text value here
*/
``