Skip to content

Latest commit

 

History

History
48 lines (31 loc) · 1.96 KB

File metadata and controls

48 lines (31 loc) · 1.96 KB

Demo: Processors

Open in CodeSandbox

This project is a demo to show the use of processors in Frontity

In frontity we can define custom Processors for the @frontity/html2react package to parse the HTML received, detect specific patterns and replace them by a custom content

In this demo there's a processor that, for every HTML displayed in React with <Html2React html={htmlRenderedFromPost} /> , replaces this...

<blockquote class="wp-block-quote">
    <p>A day without laughter is a day wasted</p>
    <cite>Nicolas Chamfort</cite>
</blockquote>

by this...

<div>
    <h3>A day without laughter is a day wasted</h3>
    <h5>Nicolas Chamfort</h5>
</div>

The custom processor is defined at /src/processors/quote.js and is added to the html2react package at /src/index.js

This demo was created as a result of this thread in the community forum: https://community.frontity.org/t/integrating-frontity-with-gutenberg/2403

Install

npm install

Run the app

npx frontity dev

Runs the app in development mode. Open http://localhost:3000 to view it in the browser.