So I have an RSS feed that includes full HTML in the body, I want to process it and convert it to plain text before sending to my future steps…
I’ve added a code block and imported an module html-to-text via NPM (html-to-text - npm).
In my index.ts I have:
export const code = async (inputs) => {
const { convert } = require('html-to-text');
const { OutputText } = convert(inputs.InputHTML);
return OutputText ;
};
And things were working okay, but now “require” is giving a red underline saying that ‘require’ cannot be found and it has stopped working (“Cannot find name ‘require’. Do you need to install type definitions for node?”). I had been messing on trying to shorten the OutputText down to say 2048 chars in length and seem to have messed up what I had working!
Any pointers about how to get back up and running appreciated please (and bonus for showing me how to then trim / parse / substring the output! Thank you