I’m trying to convert HTML string to Markdown string in a FoO, but I’m getting stuck. I found that turndown
library can be used for that, so I installed it together with @types/turndown
to get TypeScript definitions for this lib. Then I run this simple code:
import { Function } from "@foundry/functions-api";
import TurndownService = require('turndown');
export class MyFunctions {
@Function()
public myFunction(html: string): string {
const turndownService = new TurndownService();
return turndownService.turndown(html);
}
}
And I get an error:
o is not a constructor.
Error Parameters: {}
TypeError: o is not a constructor
at u.myFunction (UserCode:1:1435)
at ie.executeFunctionInternal (FunctionsIsolateRuntimePackage:2:933189)
at Ie (FunctionsIsolateRuntimePackage:2:932217)
at async ie.executeFunction (FunctionsIsolateRuntimePackage:2:932560)
at async userFunction (FunctionsInitialization:8:43)
The code is more or less in line with the usage example on the libs github page. I adjusted it a bit to TypeScript, am I making a mistake there? The error itself is really vague.