Custom Emoji Support for recent cards
-
Are normal emojis from emoji-plugins displayed because the browser interprets the unicode? I think
{topics.teaser.content}
is plain html right? So custom emojis would need to have an output like<img src=".."/>
. Still asking myself if this is technical possible and which part of the code to look at. -
Hey if you're planning on working on this, first open an issue on the emoji plugin GitHub page.
I believe you need to change how tags are stripped for topic teasers with the
filter:teasers.configureStripTags
hookhttps://github.com/NodeBB/NodeBB/blob/master/src/topics/teaser.js#L73
-
Thanks @PitaJ
I've created a plugin using @baris and your intended solution found here.
Unfortunately there is no impact to the recent cards plugin or any other teasers. No regarding error or warning found in the nodebb log. This is part of the log when I run ./nodebb dev:
verbose: [plugins] Loaded plugin: nodebb-plugin-teaser-image verbose: [plugins/fireHook] filter:teasers.configureStripTags
Plugin is as basic as it can be:
index.js:
'use strict'; var plugin = {}; plugin.filterTeasersConfigureStripTags = async function (hookData) { // Check if the "img" tag is present in the tags array if (hookData.tags.includes('img')) { // Remove the "img" tag from the tags array hookData.tags = hookData.tags.filter(tag => tag !== 'img'); } return hookData; }; module.exports = plugin;
package.json:
{ "name": "nodebb-plugin-teaser-image", "version": "1.0.0", "description": "NodeBB Plugin to show images in teasers", "main": "index.js", "dependencies": {}, "nbbpm": { "compatibility": "^1.0.0 || ^2.0.0 || ^3.0.0" } }
plugin.json:
{ "id": "nodebb-plugin-teaser-image", "name": "Show images in Teasers", "description": "A NodeBB plugin to show images in teasers", "version": "1.0.0", "hooks": [ { "hook": "filter:teasers.configureStripTags", "method": "filterTeasersConfigureStripTags" } ] }
Anything I have overlooked?