Files
coopgo/node_modules/decap-cms-widget-markdown/dist/esm/serializers/rehypePaperEmoji.js
sgauthier 6e64e138e2
All checks were successful
Publish To Prod / deploy_and_publish (push) Successful in 35s
planning
2024-10-14 09:15:30 +02:00

24 lines
668 B
JavaScript

"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = rehypePaperEmoji;
/**
* Dropbox Paper outputs emoji characters as images, and stores the actual
* emoji character in a `data-emoji-ch` attribute on the image. This plugin
* replaces the images with the emoji characters.
*/
function rehypePaperEmoji() {
function transform(node) {
if (node.tagName === 'img' && node.properties.dataEmojiCh) {
return {
type: 'text',
value: node.properties.dataEmojiCh
};
}
node.children = node.children ? node.children.map(transform) : node.children;
return node;
}
return transform;
}