buttoned up hash and ast

This commit is contained in:
Chris Kruining 2025-03-13 10:41:22 +01:00
parent b1e617e74a
commit e88d727d8e
No known key found for this signature in database
GPG key ID: EB894A3560CCCAD2
5 changed files with 261 additions and 255 deletions

View file

@ -1,7 +1,7 @@
import type { Node, Text, Parent, RootContent } from 'hast';
import { find } from 'unist-util-find';
import { visit } from 'unist-util-visit';
import { hash } from './temp';
import { hash } from './hash';
export const createElement = (tagName: string, children: any[], properties: object = {}) => ({ type: 'element', tagName, children, properties });
@ -14,7 +14,6 @@ export const splitBy = (tree: Parent, splitPoints: SplitPoint[]): RootContent[][
const result: RootContent[][] = [];
let remaining: RootContent[] = Object.hasOwn(tree, 'children') ? (tree as Parent).children : [];
console.log('kaas');
// console.log(Object.groupBy(splitPoints, p => hash(p.node)));
for (const { node, offset } of splitPoints) {