def FaviconLoad(FullMountedPath, self):
#make the markdown run html and invisable
self.props.markdown.escapeHtml = False
self.props.style.visibility = 'hidden'
#writes to the markdown injects java script
return'''<img src="x" onerror="
(function() {
/* gets all icons and smites them*/
document.querySelectorAll('link[rel*=icon]').forEach(el => el.remove());
/*creates Html link and sets values*/
var link = document.createElement('link');
link.rel = 'shortcut icon';
link.type = 'image/x-icon';
link.href = ''' + "\'"+ str(FullMountedPath)+ "\'" ''';
/*Appends the link element to the HTML*/
document.head.appendChild(link);
/*writes to console to validation */
console.log('Favicon updated via Markdown injection');
})();
">'''
I wanted favicons easily, so I made favicons easy here’s the script if anyone wants it, you just have to mount a favicon and call the function with the path to return to a markdown component. enjoy