Urara-Blog/node_modules/.pnpm-store/v3/files/1a/f86676c2ce93f8711006096a41fde8414d84510858f11cdff19c765006b17c83b9545d1fc03c2ed04b05f0b255a7875f4480a01bb77b1f8cddea8dd840c57b
2022-08-14 01:14:53 +08:00

31 lines
634 B
Text

'use strict';
const { detachNodeFromParent } = require('../lib/xast.js');
exports.name = 'removeComments';
exports.type = 'visitor';
exports.active = true;
exports.description = 'removes comments';
/**
* Remove comments.
*
* @example
* <!-- Generator: Adobe Illustrator 15.0.0, SVG Export
* Plug-In . SVG Version: 6.00 Build 0) -->
*
* @author Kir Belevich
*
* @type {import('../lib/types').Plugin<void>}
*/
exports.fn = () => {
return {
comment: {
enter: (node, parentNode) => {
if (node.value.charAt(0) !== '!') {
detachNodeFromParent(node, parentNode);
}
},
},
};
};