• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

marekdedic / prosemirror-remark / 14286065237

05 Apr 2025 09:44PM UTC coverage: 86.92% (+5.3%) from 81.604%
14286065237

push

github

web-flow
Merge pull request #509 from marekdedic/vitest

Switched to vitest

197 of 211 branches covered (93.36%)

1442 of 1659 relevant lines covered (86.92%)

9.65 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

92.86
/src/syntax-extensions/DefinitionExtension.ts
1
import type { Definition } from "mdast";
2
import type { Node as ProseMirrorNode, Schema } from "prosemirror-model";
3

4
import { NodeExtension } from "prosemirror-unified";
1✔
5

6
/**
7
 * @public
8
 */
9
export interface DefinitionExtensionContext {
10
  definitions: Record<
11
    string,
12
    { title: string | null | undefined; url: string }
13
  >;
14
}
15

16
/**
17
 * @public
18
 */
19
export class DefinitionExtension extends NodeExtension<Definition> {
1✔
20
  public override proseMirrorNodeName(): null {
1✔
21
    return null;
89✔
22
  }
89✔
23

24
  public override proseMirrorNodeSpec(): null {
1✔
25
    return null;
6✔
26
  }
6✔
27

28
  public override proseMirrorNodeToUnistNodes(): Array<Definition> {
1✔
29
    return [];
×
30
  }
×
31

32
  public override unistNodeName(): "definition" {
1✔
33
    return "definition";
53✔
34
  }
53✔
35

36
  public override unistNodeToProseMirrorNodes(
1✔
37
    node: Definition,
12✔
38
    _proseMirrorSchema: Schema<string, string>,
12✔
39
    _convertedChildren: Array<ProseMirrorNode>,
12✔
40
    context: Partial<{
12✔
41
      DefinitionExtension: DefinitionExtensionContext;
42
    }>,
43
  ): Array<ProseMirrorNode> {
12✔
44
    context.DefinitionExtension ??= { definitions: {} };
12✔
45
    context.DefinitionExtension.definitions[node.identifier] = {
12✔
46
      title: node.title,
12✔
47
      url: node.url,
12✔
48
    };
12✔
49
    return [];
12✔
50
  }
12✔
51
}
1✔
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc