Closed hypothermic closed 3 years ago
Sure. You have to use the create...
methods of HtmlGenerator
. createVerbatim
inserts a plain text node without style or hyphenation. (maybe that name isn't ideal... I'm not good at finding names ;-p)
In your case, I would suggest using create("img")
. Then add your attributes.
I got it working, thanks for your help.
I tried this but was not successful. Could you please show me a working sample? @hypothermic @michael-brade
This is my attempt. Will not add anything to the dom.
const generator = new HtmlGenerator({
CustomMacros: (function() {
const args = CustomMacros.args = {},
prototype = CustomMacros.prototype;
function CustomMacros(generator) {
this.generator = generator;
}
args['img'] = ['HV', 'u', 'o?']
prototype['img'] = function(url, alt) {
this.generator.create(`img`);
};
return CustomMacros;
}()),
})
Is it possible to insert HTML directly from a custom marco?
I've tried using createVerbatim() but it doesn't seem to insert the element into the document:
Any help would be appreciated @michael-brade .