@@ -1043,7 +1043,7 @@ hoge`;
10431043 const input = '[official instance](https://misskey.io/@ai).' ;
10441044 const output = [
10451045 LINK (
1046- false ,
1046+ 'plain' ,
10471047 N_URL ( 'https://misskey.io/@ai' ) ,
10481048 [ TEXT ( 'official instance' ) ]
10491049 ) ,
@@ -1056,7 +1056,7 @@ hoge`;
10561056 const input = '?[official instance](https://misskey.io/@ai).' ;
10571057 const output = [
10581058 LINK (
1059- true ,
1059+ 'silent' ,
10601060 N_URL ( 'https://misskey.io/@ai' ) ,
10611061 [ TEXT ( 'official instance' ) ]
10621062 ) ,
@@ -1069,7 +1069,7 @@ hoge`;
10691069 const input = '[#藍ちゃファンクラブ](<https://misskey.io/explore/tags/藍ちゃファンクラブ>).' ;
10701070 const output = [
10711071 LINK (
1072- false ,
1072+ 'plain' ,
10731073 N_URL ( 'https://misskey.io/explore/tags/藍ちゃファンクラブ' , true ) ,
10741074 [ TEXT ( '#藍ちゃファンクラブ' ) ]
10751075 ) ,
@@ -1086,26 +1086,66 @@ hoge`;
10861086 assert . deepStrictEqual ( mfm . parse ( input ) , output ) ;
10871087 } ) ;
10881088
1089+ test ( 'embed flag' , ( ) => {
1090+ const input = '.' ;
1091+ const output = [
1092+ LINK (
1093+ 'embed' ,
1094+ N_URL ( 'https://raw.githubusercontent.com/syuilo/ai/master/ai.svg' ) ,
1095+ [ TEXT ( 'image' ) ]
1096+ ) ,
1097+ TEXT ( '.' )
1098+ ] ;
1099+ assert . deepStrictEqual ( mfm . parse ( input ) , output ) ;
1100+ } ) ;
1101+
1102+ test ( 'with angle brackets silent url' , ( ) => {
1103+ const input = '?[image](<https://raw.githubusercontent.com/syuilo/ai/master/ai.svg>).' ;
1104+ const output = [
1105+ LINK (
1106+ 'silent' ,
1107+ N_URL ( 'https://raw.githubusercontent.com/syuilo/ai/master/ai.svg' , true ) ,
1108+ [ TEXT ( 'image' ) ]
1109+ ) ,
1110+ TEXT ( '.' )
1111+ ] ;
1112+ assert . deepStrictEqual ( mfm . parse ( input ) , output ) ;
1113+ } ) ;
1114+
1115+ test ( 'with angle brackets embed url' , ( ) => {
1116+ const input = '.' ;
1117+ const output = [
1118+ LINK (
1119+ 'embed' ,
1120+ N_URL ( 'https://raw.githubusercontent.com/syuilo/ai/master/ai.svg' , true ) ,
1121+ [ TEXT ( 'image' ) ]
1122+ ) ,
1123+ TEXT ( '.' )
1124+ ] ;
1125+ assert . deepStrictEqual ( mfm . parse ( input ) , output ) ;
1126+ } ) ;
1127+
10891128 describe ( 'cannot nest a url in a link label' , ( ) => {
10901129 test ( 'basic' , ( ) => {
10911130 const input = 'official instance: [https://misskey.io/@ai](https://misskey.io/@ai).' ;
10921131 const output = [
10931132 TEXT ( 'official instance: ' ) ,
10941133 LINK (
1095- false ,
1134+ 'plain' ,
10961135 N_URL ( 'https://misskey.io/@ai' ) ,
10971136 [ TEXT ( 'https://misskey.io/@ai' ) ]
10981137 ) ,
10991138 TEXT ( '.' ) ,
11001139 ] ;
11011140 assert . deepStrictEqual ( mfm . parse ( input ) , output ) ;
11021141 } ) ;
1142+
11031143 test ( 'nested' , ( ) => {
11041144 const input = 'official instance: [https://misskey.io/@ai**https://misskey.io/@ai**](https://misskey.io/@ai).' ;
11051145 const output = [
11061146 TEXT ( 'official instance: ' ) ,
11071147 LINK (
1108- false ,
1148+ 'plain' ,
11091149 N_URL ( 'https://misskey.io/@ai' ) ,
11101150 [
11111151 TEXT ( 'https://misskey.io/@ai' ) ,
@@ -1126,7 +1166,7 @@ hoge`;
11261166 const output = [
11271167 TEXT ( 'official instance: ' ) ,
11281168 LINK (
1129- false ,
1169+ 'plain' ,
11301170 N_URL ( 'https://misskey.io/@ai' ) ,
11311171 [ TEXT ( '[https://misskey.io/@ai' ) ]
11321172 ) ,
@@ -1136,12 +1176,13 @@ hoge`;
11361176 ] ;
11371177 assert . deepStrictEqual ( mfm . parse ( input ) , output ) ;
11381178 } ) ;
1179+
11391180 test ( 'nested' , ( ) => {
11401181 const input = 'official instance: [**[https://misskey.io/@ai](https://misskey.io/@ai)**](https://misskey.io/@ai).' ;
11411182 const output = [
11421183 TEXT ( 'official instance: ' ) ,
11431184 LINK (
1144- false ,
1185+ 'plain' ,
11451186 N_URL ( 'https://misskey.io/@ai' ) ,
11461187 [
11471188 BOLD ( [
@@ -1159,18 +1200,19 @@ hoge`;
11591200 const input = '[@example](https://example.com)' ;
11601201 const output = [
11611202 LINK (
1162- false ,
1203+ 'plain' ,
11631204 N_URL ( 'https://example.com' ) ,
11641205 [ TEXT ( '@example' ) ]
11651206 ) ,
11661207 ] ;
11671208 assert . deepStrictEqual ( mfm . parse ( input ) , output ) ;
11681209 } ) ;
1210+
11691211 test ( 'nested' , ( ) => {
11701212 const input = '[@example**@example**](https://example.com)' ;
11711213 const output = [
11721214 LINK (
1173- false ,
1215+ 'plain' ,
11741216 N_URL ( 'https://example.com' ) ,
11751217 [
11761218 TEXT ( '@example' ) ,
@@ -1188,7 +1230,7 @@ hoge`;
11881230 const input = '[foo](https://example.com/foo(bar))' ;
11891231 const output = [
11901232 LINK (
1191- false ,
1233+ 'plain' ,
11921234 N_URL ( 'https://example.com/foo(bar)' ) ,
11931235 [ TEXT ( 'foo' ) ]
11941236 ) ,
@@ -1201,7 +1243,7 @@ hoge`;
12011243 const output = [
12021244 TEXT ( '(' ) ,
12031245 LINK (
1204- false ,
1246+ 'plain' ,
12051247 N_URL ( 'https://example.com/foo(bar)' ) ,
12061248 [ TEXT ( 'foo' ) ]
12071249 ) ,
@@ -1215,7 +1257,7 @@ hoge`;
12151257 const output = [
12161258 TEXT ( '[test] foo ' ) ,
12171259 LINK (
1218- false ,
1260+ 'plain' ,
12191261 N_URL ( 'https://example.com' ) ,
12201262 [ TEXT ( 'bar' ) ]
12211263 ) ,
0 commit comments