@@ -42,20 +42,21 @@ public static function walk(object $item, Closure $callback): void
42
42
]);
43
43
}
44
44
45
- public static function node (string $ type , array $ attrs = null , array $ content = null ): object
45
+ public static function node (string $ type , ? array $ attrs = null , ? array $ content = null , ? array $ marks = null ): object
46
46
{
47
47
$ item = (object ) [
48
48
'type ' => $ type ,
49
49
'attrs ' => (object ) ($ attrs ?? []),
50
50
'content ' => ($ content ?? []),
51
+ 'marks ' => ($ marks ?? []),
51
52
];
52
53
53
54
Mutator::setProcessed ($ item );
54
55
55
56
return $ item ;
56
57
}
57
58
58
- public static function mark (string $ type , array $ attrs = null ): object
59
+ public static function mark (string $ type , ? array $ attrs = null ): object
59
60
{
60
61
$ item = (object ) [
61
62
'type ' => $ type ,
@@ -67,28 +68,31 @@ public static function mark(string $type, array $attrs = null): object
67
68
return $ item ;
68
69
}
69
70
70
- public static function text (string $ text ): object
71
+ public static function text (string $ text, ? array $ marks = null ): object
71
72
{
72
73
$ item = (object ) [
73
74
'type ' => 'text ' ,
74
75
'text ' => $ text ,
76
+ 'marks ' => ($ marks ?? []),
75
77
];
76
78
77
79
Mutator::setProcessed ($ item );
78
80
79
81
return $ item ;
80
82
}
81
83
82
- public static function html (string $ html , array $ attrs = null , array $ content = null ): object
84
+ public static function html (string $ html , ? array $ attrs = null , ? array $ content = null , ? array $ marks = null ): object
83
85
{
84
86
$ item = preg_match ('/^[a-z][a-z0-9-]*$/i ' , $ html )
85
87
? (object ) [
86
88
'type ' => 'bmuHtml ' ,
87
89
'render ' => [$ html , ($ attrs ?? []), 0 ],
88
90
'content ' => ($ content ?? []),
91
+ 'marks ' => ($ marks ?? []),
89
92
] : (object ) [
90
93
'type ' => 'bmuHtml ' ,
91
94
'render ' => ['content ' => $ html ],
95
+ 'marks ' => ($ attrs ?? []),
92
96
];
93
97
94
98
Mutator::setProcessed ($ item );
0 commit comments