Implement utils tests

This commit is contained in:
2025-05-26 20:35:02 +02:00
parent e5569fc4a5
commit 49cac03db8
5 changed files with 526 additions and 0 deletions

View File

@@ -1,3 +1,5 @@
import type { Parent } from 'unist';
/**
* User model from the API
*/
@@ -285,3 +287,66 @@ export interface SettingsAction<T> {
type: SettingsActionType;
payload?: T;
}
// WikiLinks
/**
* Represents a wiki link match from the regex
*/
export interface WikiLinkMatch {
fullMatch: string;
isImage: boolean; // Changed from string to boolean
fileName: string;
displayText: string;
heading?: string | undefined;
index: number;
}
/**
* Node replacement information for processing
*/
export interface ReplacementInfo {
matches: WikiLinkMatch[];
parent: Parent;
index: number;
}
/**
* Properties for link nodes
*/
export interface LinkNodeProps {
style?: {
color?: string;
textDecoration?: string;
};
}
/**
* Link node with data properties
*/
export interface LinkNode extends Node {
type: 'link';
url: string;
children: Node[];
data?: {
hProperties?: LinkNodeProps;
};
}
/**
* Image node
*/
export interface ImageNode extends Node {
type: 'image';
url: string;
alt?: string;
title?: string;
}
/**
* Text node
*/
export interface TextNode extends Node {
type: 'text';
value: string;
}