junkawa/markdown-it-link-preview

Add custom function to handle HTML

Opened this issue · 0 comments

I noticed that the following function is being used to handle HTML output:

function linkPreviewHtml(ogData) {
return (
'<div class="link-preview-widget">' +
'<a ' +
'href="' +
ogData.url +
'" ' +
'rel="noopener" ' +
'target="_blank"' +
'>' +
'<div class="link-preview-widget-title">' +
ogData.title +
'</div>' +
'<div class="link-preview-widget-description">' +
ogData.description +
'</div>' +
'<div class="link-preview-widget-url">' +
ogData.site_name +
'</div>' +
'</a>' +
'<a ' +
'class="link-preview-widget-image" ' +
'href="' +
ogData.url +
'" ' +
'rel="noopener" ' +
'style="background-image: url(\'' +
ogData.image +
'\');" ' +
'target="_blank"' +
'></a>' +
'</div>'
);
}

I think it would be great to add an option to load a custom function, in order to change the structure :)