Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 | 2x 2x 55x 2x 27x | const MARKER = /<!--\s*(\/?)wp:([\w/-]+)(?:\s[^>]*?)?(\/?)-->/g;
/** The ordered `<!-- wp:… -->` sequence, attributes dropped, e.g. `paragraph`, `/paragraph`. */
export const blockMarkers = (html: string): string[] =>
[...html.matchAll(MARKER)].map(([, close, name, self]) => `${close}${name}${self}`);
export const markersDiffer = (base: string, proposed: string): boolean =>
blockMarkers(base).join("\n") !== blockMarkers(proposed).join("\n");
|