document-ir 0.5.1 → 0.5.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { IdentityTransformer } from './IdentityTransformer.ts';
|
|
2
|
-
import { CodeNode, DocumentNode, Node, TextNode } from './types.ts';
|
|
2
|
+
import { BadgeNode, CodeNode, DocumentNode, EmojiNode, Node, TextNode } from './types.ts';
|
|
3
3
|
interface BlockInfo {
|
|
4
4
|
type: "_block";
|
|
5
5
|
content: WhiteSpaceContainer[];
|
|
@@ -20,6 +20,8 @@ export declare class WhitespaceStretchingTransformer extends IdentityTransformer
|
|
|
20
20
|
protected beforeInline(): Promise<void>;
|
|
21
21
|
protected afterInline(): Promise<void>;
|
|
22
22
|
protected reviewBlock(block: BlockInfo): void;
|
|
23
|
+
protected emoji(node: EmojiNode): Promise<Node | null>;
|
|
24
|
+
protected badge(node: BadgeNode): Promise<Node | null>;
|
|
23
25
|
protected code(node: CodeNode): Promise<Node | null>;
|
|
24
26
|
protected text(node: TextNode): Promise<Node | null>;
|
|
25
27
|
transform(node: DocumentNode): Promise<DocumentNode>;
|
package/dist/index.js
CHANGED
|
@@ -994,6 +994,16 @@ class N extends u {
|
|
|
994
994
|
!n.node || !a.node || n.level != a.level && (n.level < a.level ? a.node.text.startsWith(" ") && (a.node.text = a.node.text.slice(1), n.node.text += " ") : n.level > a.level && n.node.text.endsWith(" ") && (n.node.text = n.node.text.slice(0, -1), a.node.text = ` ${a.node.text}`));
|
|
995
995
|
}
|
|
996
996
|
}
|
|
997
|
+
// Void inline elements (emoji, badge) don't call beforeInline/afterInline so they
|
|
998
|
+
// are invisible to the cursor by default. Push a _block sentinel so reviewBlock
|
|
999
|
+
// sees an opaque boundary at their position, preventing trailing spaces on
|
|
1000
|
+
// adjacent text nodes from migrating across them.
|
|
1001
|
+
async emoji(e) {
|
|
1002
|
+
return this.cursor.content.push({ type: "_block", content: [], parent: this.cursor }), super.emoji(e);
|
|
1003
|
+
}
|
|
1004
|
+
async badge(e) {
|
|
1005
|
+
return this.cursor.content.push({ type: "_block", content: [], parent: this.cursor }), super.badge(e);
|
|
1006
|
+
}
|
|
997
1007
|
async code(e) {
|
|
998
1008
|
const i = {
|
|
999
1009
|
type: "code",
|
|
@@ -1583,7 +1593,7 @@ function y(c) {
|
|
|
1583
1593
|
}
|
|
1584
1594
|
return t;
|
|
1585
1595
|
}
|
|
1586
|
-
class
|
|
1596
|
+
class _ extends u {
|
|
1587
1597
|
constructor() {
|
|
1588
1598
|
super();
|
|
1589
1599
|
}
|
|
@@ -1630,6 +1640,6 @@ export {
|
|
|
1630
1640
|
B as TextVisitor,
|
|
1631
1641
|
N as WhitespaceStretchingTransformer,
|
|
1632
1642
|
v as WhitespaceTransformer,
|
|
1633
|
-
|
|
1643
|
+
_ as WordCounterTransformer,
|
|
1634
1644
|
x as WordCounterVisitor
|
|
1635
1645
|
};
|