Skip to content

Commit

Permalink
🎨 Improve HTML custom tag clipping siyuan-note/siyuan#11813
Browse files Browse the repository at this point in the history
  • Loading branch information
88250 committed Jun 30, 2024
1 parent 76a9dfb commit 37c5b6d
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 3 deletions.
2 changes: 1 addition & 1 deletion javascript/lute.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion javascript/lute.min.js.map

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions test/h2m_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import (

var html2MdTests = []parseTest{

{"166", "<div class=\"title\">\n <ucaptitle>中华人民共和国工业和信息化部 财政部 税务总局关于调整享受车船税优惠的节能 新能源汽车产品技术要求的公告</ucaptitle>\n </div>", "## 中华人民共和国工业和信息化部 财政部 税务总局关于调整享受车船税优惠的节能 新能源汽车产品技术要求的公告\n"},
{"165", "<figure data-size=\"normal\"><img src=\"https://pic4.zhimg.com/v2-5ccc82114197bd14865d212935a3fe8b_b.jpg\" data-size=\"normal\" data-rawwidth=\"1348\" data-rawheight=\"1026\" class=\"origin_image zh-lightbox-thumb\" width=\"1348\" data-original=\"https://pic4.zhimg.com/v2-5ccc82114197bd14865d212935a3fe8b_r.jpg\"><figcaption>图1 PS并行梯度下降过程</figcaption></figure>", "![](https://pic4.zhimg.com/v2-5ccc82114197bd14865d212935a3fe8b_r.jpg)\n图 1 PS 并行梯度下降过程\n"},
{"164", "<div class=\"content\" id=\"zoomcon\">\n<ucapcontent><p align=\"\" style=\"text-indent: 2em; text-align: justify; line-height: 2;\">为适应节能与新能源汽车产业发展和技术进步需要,促进节约能源,鼓励使用新能源,现就《财政部 税务总局 工业和信息化部 交通运输部关于节能 新能源车船享受车船税优惠政策的通知》(财税〔2018〕74号)中享受车船税优惠的节能、新能源汽车产品技术要求有关事项公告如下:</p>\n</ucapcontent>\n</div>", "为适应节能与新能源汽车产业发展和技术进步需要,促进节约能源,鼓励使用新能源,现就《财政部 税务总局 工业和信息化部 交通运输部关于节能 新能源车船享受车船税优惠政策的通知》(财税〔2018〕74 号)中享受车船税优惠的节能、新能源汽车产品技术要求有关事项公告如下:\n"},
{"163", "<mjx-container jax=\"SVG\" role=\"presentation\" tabindex=\"0\" ctxtmenu_counter=\"6\" data-formula=\"(x_0,y_0)\" style=\"visibility: visible;\"><svg xmlns:xlink=\"http://www.w3.org/1999/xlink\" width=\"7.421ex\" height=\"2.671ex\" viewBox=\"0 -835.3 3195 1149.8\" role=\"img\" focusable=\"false\" style=\"vertical-align: -0.73ex; font-size: 14px; visibility: visible;\" xmlns=\"http://www.w3.org/2000/svg\"><g stroke=\"currentColor\" fill=\"currentColor\" stroke-width=\"0\" transform=\"matrix(1 0 0 -1 0 0)\" style=\"visibility: visible;\"><path stroke-width=\"1\" d=\"M94 250Q94 319 104 381T127 488T164 576T202 643T244 695T277 729T302 750H315H319Q333 750 333 741Q333 738 316 720T275 667T226 581T184 443T167 250T184 58T225 -81T274 -167T316 -220T333 -241Q333 -250 318 -250H315H302L274 -226Q180 -141 137 -14T94 250Z\" style=\"visibility: visible;\"></path><g transform=\"translate(389,0)\" style=\"visibility: visible;\"><path stroke-width=\"1\" d=\"M52 289Q59 331 106 386T222 442Q257 442 286 424T329 379Q371 442 430 442Q467 442 494 420T522 361Q522 332 508 314T481 292T458 288Q439 288 427 299T415 328Q415 374 465 391Q454 404 425 404Q412 404 406 402Q368 386 350 336Q290 115 290 78Q290 50 306 38T341 26Q378 26 414 59T463 140Q466 150 469 151T485 153H489Q504 153 504 145Q504 144 502 134Q486 77 440 33T333 -11Q263 -11 227 52Q186 -10 133 -10H127Q78 -10 57 16T35 71Q35 103 54 123T99 143Q142 143 142 101Q142 81 130 66T107 46T94 41L91 40Q91 39 97 36T113 29T132 26Q168 26 194 71Q203 87 217 139T245 247T261 313Q266 340 266 352Q266 380 251 392T217 404Q177 404 142 372T93 290Q91 281 88 280T72 278H58Q52 284 52 289Z\" style=\"visibility: visible;\"></path><g transform=\"translate(572,-150)\" style=\"visibility: visible;\"><path stroke-width=\"1\" transform=\"scale(0.707)\" d=\"M96 585Q152 666 249 666Q297 666 345 640T423 548Q460 465 460 320Q460 165 417 83Q397 41 362 16T301 -15T250 -22Q224 -22 198 -16T137 16T82 83Q39 165 39 320Q39 494 96 585ZM321 597Q291 629 250 629Q208 629 178 597Q153 571 145 525T137 333Q137 175 145 125T181 46Q209 16 250 16Q290 16 318 46Q347 76 354 130T362 333Q362 478 354 524T321 597Z\" style=\"visibility: visible;\"></path></g></g><g transform=\"translate(1415,0)\" style=\"visibility: visible;\"><path stroke-width=\"1\" d=\"M78 35T78 60T94 103T137 121Q165 121 187 96T210 8Q210 -27 201 -60T180 -117T154 -158T130 -185T117 -194Q113 -194 104 -185T95 -172Q95 -168 106 -156T131 -126T157 -76T173 -3V9L172 8Q170 7 167 6T161 3T152 1T140 0Q113 0 96 17Z\" style=\"visibility: visible;\"></path></g><g transform=\"translate(1861,0)\" style=\"visibility: visible;\"><path stroke-width=\"1\" d=\"M21 287Q21 301 36 335T84 406T158 442Q199 442 224 419T250 355Q248 336 247 334Q247 331 231 288T198 191T182 105Q182 62 196 45T238 27Q261 27 281 38T312 61T339 94Q339 95 344 114T358 173T377 247Q415 397 419 404Q432 431 462 431Q475 431 483 424T494 412T496 403Q496 390 447 193T391 -23Q363 -106 294 -155T156 -205Q111 -205 77 -183T43 -117Q43 -95 50 -80T69 -58T89 -48T106 -45Q150 -45 150 -87Q150 -107 138 -122T115 -142T102 -147L99 -148Q101 -153 118 -160T152 -167H160Q177 -167 186 -165Q219 -156 247 -127T290 -65T313 -9T321 21L315 17Q309 13 296 6T270 -6Q250 -11 231 -11Q185 -11 150 11T104 82Q103 89 103 113Q103 170 138 262T173 379Q173 380 173 381Q173 390 173 393T169 400T158 404H154Q131 404 112 385T82 344T65 302T57 280Q55 278 41 278H27Q21 284 21 287Z\" style=\"visibility: visible;\"></path><g transform=\"translate(490,-150)\" style=\"visibility: visible;\"><path stroke-width=\"1\" transform=\"scale(0.707)\" d=\"M96 585Q152 666 249 666Q297 666 345 640T423 548Q460 465 460 320Q460 165 417 83Q397 41 362 16T301 -15T250 -22Q224 -22 198 -16T137 16T82 83Q39 165 39 320Q39 494 96 585ZM321 597Q291 629 250 629Q208 629 178 597Q153 571 145 525T137 333Q137 175 145 125T181 46Q209 16 250 16Q290 16 318 46Q347 76 354 130T362 333Q362 478 354 524T321 597Z\" style=\"visibility: visible;\"></path></g></g><g transform=\"translate(2805,0)\" style=\"visibility: visible;\"><path stroke-width=\"1\" d=\"M60 749L64 750Q69 750 74 750H86L114 726Q208 641 251 514T294 250Q294 182 284 119T261 12T224 -76T186 -143T145 -194T113 -227T90 -246Q87 -249 86 -250H74Q66 -250 63 -250T58 -247T55 -238Q56 -237 66 -225Q221 -64 221 250T66 725Q56 737 55 738Q55 746 60 749Z\" style=\"visibility: visible;\"></path></g></g></svg>&nbsp;</mjx-container>", "$(x_0,y_0)$\n"},
Expand Down
4 changes: 3 additions & 1 deletion vditor_wysiwyg.go
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,9 @@ func (lute *Lute) adjustCustomTag(n *html.Node) {
if html.ElementNode == n.Type && 0 == n.DataAtom {
if "ucapcontent" == n.Data {
n.DataAtom = atom.Div
n.Data = "div"
} else if "ucaptitle" == n.Data {
n.DataAtom = atom.H2
n.Data = "h2"
}
}

Expand Down

0 comments on commit 37c5b6d

Please sign in to comment.