Last change
on this file since 571e0df was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago |
initial commit
|
-
Property mode
set to
100644
|
File size:
634 bytes
|
Rev | Line | |
---|
[6a3a178] | 1 | 'use strict';
|
---|
| 2 |
|
---|
| 3 | const { detachNodeFromParent } = require('../lib/xast.js');
|
---|
| 4 |
|
---|
| 5 | exports.name = 'removeComments';
|
---|
| 6 | exports.type = 'visitor';
|
---|
| 7 | exports.active = true;
|
---|
| 8 | exports.description = 'removes comments';
|
---|
| 9 |
|
---|
| 10 | /**
|
---|
| 11 | * Remove comments.
|
---|
| 12 | *
|
---|
| 13 | * @example
|
---|
| 14 | * <!-- Generator: Adobe Illustrator 15.0.0, SVG Export
|
---|
| 15 | * Plug-In . SVG Version: 6.00 Build 0) -->
|
---|
| 16 | *
|
---|
| 17 | * @author Kir Belevich
|
---|
| 18 | *
|
---|
| 19 | * @type {import('../lib/types').Plugin<void>}
|
---|
| 20 | */
|
---|
| 21 | exports.fn = () => {
|
---|
| 22 | return {
|
---|
| 23 | comment: {
|
---|
| 24 | enter: (node, parentNode) => {
|
---|
| 25 | if (node.value.charAt(0) !== '!') {
|
---|
| 26 | detachNodeFromParent(node, parentNode);
|
---|
| 27 | }
|
---|
| 28 | },
|
---|
| 29 | },
|
---|
| 30 | };
|
---|
| 31 | };
|
---|
Note:
See
TracBrowser
for help on using the repository browser.