@@ -42,20 +42,21 @@ public static function walk(object $item, Closure $callback): void
4242 ]);
4343 }
4444
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
4646 {
4747 $ item = (object ) [
4848 'type ' => $ type ,
4949 'attrs ' => (object ) ($ attrs ?? []),
5050 'content ' => ($ content ?? []),
51+ 'marks ' => ($ marks ?? []),
5152 ];
5253
5354 Mutator::setProcessed ($ item );
5455
5556 return $ item ;
5657 }
5758
58- public static function mark (string $ type , array $ attrs = null ): object
59+ public static function mark (string $ type , ? array $ attrs = null ): object
5960 {
6061 $ item = (object ) [
6162 'type ' => $ type ,
@@ -67,28 +68,31 @@ public static function mark(string $type, array $attrs = null): object
6768 return $ item ;
6869 }
6970
70- public static function text (string $ text ): object
71+ public static function text (string $ text, ? array $ marks = null ): object
7172 {
7273 $ item = (object ) [
7374 'type ' => 'text ' ,
7475 'text ' => $ text ,
76+ 'marks ' => ($ marks ?? []),
7577 ];
7678
7779 Mutator::setProcessed ($ item );
7880
7981 return $ item ;
8082 }
8183
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
8385 {
8486 $ item = preg_match ('/^[a-z][a-z0-9-]*$/i ' , $ html )
8587 ? (object ) [
8688 'type ' => 'bmuHtml ' ,
8789 'render ' => [$ html , ($ attrs ?? []), 0 ],
8890 'content ' => ($ content ?? []),
91+ 'marks ' => ($ marks ?? []),
8992 ] : (object ) [
9093 'type ' => 'bmuHtml ' ,
9194 'render ' => ['content ' => $ html ],
95+ 'marks ' => ($ attrs ?? []),
9296 ];
9397
9498 Mutator::setProcessed ($ item );
0 commit comments