removeMetadata.js 566 B

1234567891011121314151617181920212223242526272829
  1. 'use strict';
  2. const { detachNodeFromParent } = require('../lib/xast.js');
  3. exports.name = 'removeMetadata';
  4. exports.type = 'visitor';
  5. exports.active = true;
  6. exports.description = 'removes <metadata>';
  7. /**
  8. * Remove <metadata>.
  9. *
  10. * https://www.w3.org/TR/SVG11/metadata.html
  11. *
  12. * @author Kir Belevich
  13. *
  14. * @type {import('../lib/types').Plugin<void>}
  15. */
  16. exports.fn = () => {
  17. return {
  18. element: {
  19. enter: (node, parentNode) => {
  20. if (node.name === 'metadata') {
  21. detachNodeFromParent(node, parentNode);
  22. }
  23. },
  24. },
  25. };
  26. };