ft-n-content-transform
v5.1.0
Published
[![Coverage Status](https://coveralls.io/repos/github/Financial-Times/n-content-transform/badge.svg?branch=main)](https://coveralls.io/github/Financial-Times/n-content-transform?branch=main)
Downloads
284
Keywords
Readme
n-content-transform
Further (opinionated) transformation of content html for Next
Purpose is to do 'on-the-fly' further transformation of content html (eg. article body, opening).
These transformations are opinionated / specific to next front end requirements and therefore not within the stylesheet transforms handled by the next-es-interface ingest process
Transforms handled include;
- Data tracking - adding to specific elements
- Images - determining presentational variant, adding placeholders, using [image service] (https://www.ft.com/__origami/service/image/v2/)
- External links - enabling non-FT links to be opened in a new tab / window
- Video - add placeholder for video and brightcove player
Usage
const contentTransform = require('ft-n-content-transform');
All transforms
let transformedContent = contentTransform.transformAll(contentHtml, *flags*);
Just image transforms
let transformedContent = contentTransform.transformImages(contentHtml, *flags*);