I have a utility function which takes some text, and inserts hyperlinks via pug templating. For example:
function toPugLink(text, url) { ... }
toPugLink('test', 'stackoverflow.com') -> #[a(href='stackoverflow.com) test]
However, when I want to consume this, Pug does not seem to recognise it.
mixin body(data, utils)
p #{utils.toPugLink(data.text, data.urlTokens)}
Instead, what is output is the literal value, rather than the tokenised template.
How can I tell pug to render my output as a pug template rather than a literal string?
This is a simplified version of my code. The full version contains large amounts of text, the function replaces multiple tokens, etc, so quick workarounds sadly can't be used here.