Skip to content

armgit / memos

Public Imported from GitHub
0

Memos is an open-source, self-hosted note-taking app that brings your everyday thoughts together in a personal timeline. Your data stays yours, and you choose what to keep private or share.

feat(web): upgrade @usememos/editor to 26.10.29 (#6508)

ABird08acc22f3f44
diff --git a/web/package.json b/web/package.json
index 5727f656b..321966578 100644
--- a/web/package.json
+++ b/web/package.json
@@ -26,11 +26,12 @@
"@tailwindcss/vite": "^4.2.4",
"@tanstack/react-query": "^5.100.9",
"@tanstack/react-query-devtools": "^5.100.9",
- "@usememos/editor": "26.10.27",
+ "@usememos/editor": "26.10.29",
"class-variance-authority": "^0.7.1",
"clsx": "^2.1.1",
"copy-to-clipboard": "^4.0.2",
"dayjs": "^1.11.20",
+ "dompurify": "^3.4.17",
"exifr": "^7.1.3",
"html-to-image": "^1.11.13",
"i18next": "^26.3.6",
@@ -40,10 +41,6 @@
"lodash-es": "^4.18.1",
"lucide-react": "^1.34.0",
"maplibre-gl": "^6.8.0",
- "mdast-util-from-markdown": "^2.0.3",
- "mdast-util-gfm": "^3.1.0",
- "micromark-extension-gfm": "^3.0.0",
- "micromark-util-normalize-identifier": "^2.0.1",
"pele": "1.6.0",
"react": "^19.2.6",
"react-dom": "^19.2.6",
@@ -52,16 +49,8 @@
"react-leaflet": "^5.0.0",
"react-leaflet-cluster": "^4.1.3",
"react-router-dom": "^7.15.0",
- "rehype-raw": "^7.0.0",
- "rehype-sanitize": "^6.0.0",
- "remark-breaks": "^4.0.0",
- "remark-gfm": "^4.0.1",
- "remark-parse": "^11.0.0",
- "remark-rehype": "^11.1.2",
"tailwind-merge": "^3.5.0",
"tailwindcss": "^4.2.4",
- "unified": "^11.0.5",
- "unist-util-visit": "^5.1.0",
"uuid": "^11.1.0"
},
"devDependencies": {
@@ -72,14 +61,11 @@
"@testing-library/jest-dom": "^6.9.1",
"@testing-library/react": "^16.3.2",
"@types/babel__core": "7.20.5",
- "@types/hast": "^3.0.4",
"@types/leaflet": "^1.9.21",
"@types/lodash-es": "^4.17.12",
- "@types/mdast": "^4.0.4",
"@types/node": "^24.12.2",
"@types/react": "^19.2.14",
"@types/react-dom": "^19.2.3",
- "@types/unist": "^3.0.3",
"@vitejs/plugin-react": "^6.0.1",
"babel-plugin-react-compiler": "1.0.0",
"jsdom": "^29.1.1",
diff --git a/web/pnpm-lock.yaml b/web/pnpm-lock.yaml
index fa4a9ae74..323e69729 100644
--- a/web/pnpm-lock.yaml
+++ b/web/pnpm-lock.yaml
@@ -39,8 +39,8 @@ importers:
specifier: ^5.100.9
'@usememos/editor':
- specifier: 26.10.27
+ specifier: 26.10.29
class-variance-authority:
specifier: ^0.7.1
version: 0.7.1
@@ -53,6 +53,9 @@ importers:
dayjs:
specifier: ^1.11.20
version: 1.11.20
+ dompurify:
+ specifier: ^3.4.17
+ version: 3.4.17
exifr:
specifier: ^7.1.3
version: 7.1.3
@@ -80,18 +83,6 @@ importers:
maplibre-gl:
specifier: ^6.8.0
version: 6.8.0
- mdast-util-from-markdown:
- specifier: ^2.0.3
- version: 2.0.3
- mdast-util-gfm:
- specifier: ^3.1.0
- version: 3.1.0
- micromark-extension-gfm:
- specifier: ^3.0.0
- version: 3.0.0
- micromark-util-normalize-identifier:
- specifier: ^2.0.1
- version: 2.0.1
pele:
specifier: 1.6.0
version: 1.6.0
@@ -116,36 +107,12 @@ importers:
react-router-dom:
specifier: ^7.15.0
- rehype-raw:
- specifier: ^7.0.0
- version: 7.0.0
- rehype-sanitize:
- specifier: ^6.0.0
- version: 6.0.0
- remark-breaks:
- specifier: ^4.0.0
- version: 4.0.0
- remark-gfm:
- specifier: ^4.0.1
- version: 4.0.1
- remark-parse:
- specifier: ^11.0.0
- version: 11.0.0
- remark-rehype:
- specifier: ^11.1.2
- version: 11.1.2
tailwind-merge:
specifier: ^3.5.0
version: 3.5.0
tailwindcss:
specifier: ^4.2.4
version: 4.2.4
- unified:
- specifier: ^11.0.5
- version: 11.0.5
- unist-util-visit:
- specifier: ^5.1.0
- version: 5.1.0
uuid:
specifier: ^11.1.0
version: 11.1.0
@@ -171,18 +138,12 @@ importers:
'@types/babel__core':
specifier: 7.20.5
version: 7.20.5
- '@types/hast':
- specifier: ^3.0.4
- version: 3.0.4
'@types/leaflet':
specifier: ^1.9.21
version: 1.9.21
'@types/lodash-es':
specifier: ^4.17.12
version: 4.17.12
- '@types/mdast':
- specifier: ^4.0.4
- version: 4.0.4
'@types/node':
specifier: ^24.12.2
version: 24.12.2
@@ -192,9 +153,6 @@ importers:
'@types/react-dom':
specifier: ^19.2.3
version: 19.2.3(@types/[email protected])
- '@types/unist':
- specifier: ^3.0.3
- version: 3.0.3
'@vitejs/plugin-react':
specifier: ^6.0.1
@@ -841,9 +799,6 @@ packages:
resolution: {integrity: sha512-Mw558oeA9fFbv65/y4mHtXDs9bPnFMZAL/jxdPFUpOHHIXX91mcgEHbS5Lahr+pwZFR8A7GQleRWeI6cGFC2UA==}
- '@types/[email protected]':
- resolution: {integrity: sha512-KSVgmQmzMwPlmtljOomayoR89W4FynCAi3E8PPs7vmDVPe84hT+vGPKkJfThkmXs0x0jAaa9U8uW8bbfyS2fWw==}
-
resolution: {integrity: sha512-c9h9dVVMigMPc4bwTvC5dxqtqJZwQPePsWjPlpSOnojbor6pGqdk541lfA7AqFQr5pB1BRdq0juY9db81BwyFw==}
@@ -853,9 +808,6 @@ packages:
resolution: {integrity: sha512-6C8nqWur3j98U6+lXDfTUWIfgvZU+EumvpHKcYjujKH7woYyLj2sUmff0tRhrqM7BohUw7Pz3ZB1jj2gW9Fvmg==}
- '@types/[email protected]':
- resolution: {integrity: sha512-WPs+bbQw5aCj+x6laNGWLH3wviHtoCv/P3+otBhbOhJgG8qtpdAMlTCxLtsTWA7LH1Oh/bFCHsBn0TPS5m30EQ==}
-
resolution: {integrity: sha512-TbAd9DaPGSnzp6QvtYngntMZgcRk+igFELwR2N99XZn7RXUdKgsXMR+28bUO0rPsWp8MIu/f47luLIQuSLYv/w==}
@@ -865,12 +817,6 @@ packages:
resolution: {integrity: sha512-gIW7lQLZbue7lRSWEFql49QJJWThrTFFeIMJdp3eH4tKoxm1OvEPg02rm4wCCSHS0cL3/Fizimb35b7k8atwsQ==}
- '@types/[email protected]':
- resolution: {integrity: sha512-kGaNbPh1k7AFzgpud/gMdvIm5xuECykRR+JnWKQno9TAXVa6WIVCGTPvYGekIDL4uwCZQSYbUxNBSb1aUo79oA==}
-
- '@types/[email protected]':
- resolution: {integrity: sha512-GsCCIZDE/p3i96vtEqx+7dBUGXrc7zeSK3wwPHIaRThS+9OhWIXRqzs4d6k1SVU8g91DrNRWxWUGhp5KXQb2VA==}
-
resolution: {integrity: sha512-A1sre26ke7HDIuY/M23nd9gfB+nrmhtYyMINbjI1zHJxYteKR6qSMX56FsmjMcDb3SMcjJg5BiRRgOCC/yBD0g==}
@@ -882,8 +828,8 @@ packages:
resolution: {integrity: sha512-ilcTH/UniCkMdtexkoCN0bI7pMcJDvmQFPvuPvmEaYA/NSfFTAgdUSLAoVjaRJm7+6PvcM+q1zYOwS4wTYMF9w==}
- '@types/[email protected]':
- resolution: {integrity: sha512-ko/gIFJRv177XgZsZcBwnqJN5x/Gien8qNOn0D5bQU/zAzVf9Zt3BlcUiLqhV9y4ARk0GbT3tnUiPNgnTXzc/Q==}
+ '@types/[email protected]':
+ resolution: {integrity: sha512-ScaPdn1dQczgbl0QFTeTOmVHFULt394XJgOQNoyVhZ6r2vLnMLJfBPd53SB52T/3G36VI1/g2MZaX0cwDuXsfw==}
'@typescript/[email protected]':
resolution: {integrity: sha512-MTKKkWB7p/0E9xi1d1tHtZ5PiLkGEMIq88pK2CubZjOsLtYTLqhgIgi6zepFa+9GHZ6h05NMCkQxGKiPXMxXtQ==}
@@ -1005,12 +951,8 @@ packages:
cpu: [x64]
os: [win32]
- '@ungap/[email protected]':
- resolution: {integrity: sha512-WmoN8qaIAo7WTYWbAZuG8PYEhn5fkz7dZrqTBZ7dtt//lL2Gwms1IcnQ5yHqjDfX8Ft5j4YzDM23f87zBfDe9g==}
- deprecated: Potential CWE-502 - Update to 1.3.1 or higher
-
- '@usememos/[email protected]':
- resolution: {integrity: sha512-3CJliu0uFnRG9eDv5sDJjkjefbgBUKrugPd0K3h5wehiHVl0XxYnGjNfO6C+Kt0gHTRLhIwv+mEnYJKlh0uW0Q==}
+ '@usememos/[email protected]':
+ resolution: {integrity: sha512-nsseJXXwQV47duQ5lBnSIXwiDMIb4ta3o+7qJYjCBWxdafiiNbMu/Mjq9suXfDD1dtSSxSpl5GnDaw0znwlLAw==}
peerDependencies:
react: '>=18'
react-dom: '>=18'
@@ -1084,9 +1026,6 @@ packages:
resolution: {integrity: sha512-Ixm8tFfoKKIPYdCCKYTsqv+Fd4IJ0DQqMyEimo+pxUOMUR9cVPlwTrFt9Avu+3cb6Zp3mAzl+t1MrG2fxxKsxw==}
- resolution: {integrity: sha512-0xO6mYd7JB2YesxDKplafRpsiOzPt9V02ddPCLbY1xYGPOX24NTyN50qnUxgCPcSoYMhKpAuBTjQoRZCAkUDRw==}
-
resolution: {integrity: sha512-xwVXGqevyKPsiuQdLj+dZMVjidjJV508TBqexND5HrF89cGdCYCJFB3qhcxRHSeMctdCfbR1jrxBajhDy7o29g==}
engines: {node: '>=6.0.0'}
@@ -1103,16 +1042,10 @@ packages:
resolution: {integrity: sha512-hVLMUZFgR4JJ6ACt1uEESvQN1/dBVqPAKY0hgrV70eN3391K6juAfTjKZLKvOMsx8PxA7gsY1/tLMMTcfFLLpw==}
- resolution: {integrity: sha512-eyrF0jiFpY+3drT6383f1qhkbGsLSifNAjA61IUjZjmLCWjItY6LB9ft9YhoDgwfmclB2zhu51Lc7+95b8NRAg==}
-
resolution: {integrity: sha512-NUPRluOfOiTKBKvWPtSD4PhFvWCqOi0BGStNWs57X9js7XGTprSmFoz5F0tWhR4WPjNeR9jXqdC7/UpSJTnlRg==}
engines: {node: '>=18'}
- resolution: {integrity: sha512-shx7oQ0Awen/BRIdkjkvz54PnEEI/EjwXDSIZp86/KKdbafHh1Df/RYGBhn4hbe2+uKC9FnT5UCEdyPz3ai9hQ==}
-
resolution: {integrity: sha512-Ka+9Trutv7G8M6WT6SeiRWz792K5qEqIGEGzXKhAE6xOWAY6pPH8U+9IY3oCMv6kqTmLsv7Xh/2w2RigkePMsg==}
@@ -1120,9 +1053,6 @@ packages:
resolution: {integrity: sha512-eYm0QWBtUrBWZWG0d386OGAw16Z995PiOVo2B7bjWSbHedGl5e0ZWaq65kOGgUSNesEIDkB9ISbTg/JK9dhCZA==}
engines: {node: '>=6'}
- resolution: {integrity: sha512-Fu4hJdvzeylCfQPp9SGWidpzrMs7tTrlu6Vb8XGaRGck8QSNZJJp538Wrb60Lax4fPwR64ViY468OIUTbRlGZg==}
-
resolution: {integrity: sha512-OkTL9umf+He2DZkUq8f8J9of7yL6RJKI24dVITBmNfZBmri9zYZQrKkuXiKhyfPSu8tUhnVBB1iKXevvnlR4Ww==}
engines: {node: '>= 12'}
@@ -1166,9 +1096,6 @@ packages:
resolution: {integrity: sha512-YpgQiITW3JXGntzdUmyUR1V812Hn8T1YVXhCu+wO3OpS4eU9l4YdD3qjyiKdV6mvV29zapkMeD390UVEf2lkUg==}
- resolution: {integrity: sha512-GtpQYB283KrPp6nRw50q3U9/VfOutZOe103qlN7BPP6Ad27xYnOIWv4lPzo8HCAL+mMZofJ9KEy30fq6MfaK6Q==}
-
resolution: {integrity: sha512-0je+qPKHEMohvfRTCEo3CrPG6cAzAYgmzKyxRiYSSDkS6eGJdyVJm7WaYA5ECaAD9wLB2T4EEeymA5aFVcYXCA==}
engines: {node: '>=6'}
@@ -1177,15 +1104,15 @@ packages:
resolution: {integrity: sha512-Btj2BOOO83o3WyH59e8MgXsxEQVcarkUOpEYrubB0urwnN10yQ364rsiByU11nZlqWYZm05i/of7io4mzihBtQ==}
engines: {node: '>=8'}
- resolution: {integrity: sha512-RWmIqhcFf1lRYBvNmr7qTNuyCt/7/ns2jbpp1+PalgE/rDQcBT0fioSMUpJ93irlUhC5hrg4cYqe6U+0ImW0rA==}
-
resolution: {integrity: sha512-X7BJ2yElsnOJ30pZF4uIIDfBEVgF4XEBxL9Bxhy6dnrm5hkzqmsWHGTiHqRiITNhMyFLyAiWndIJP7Z1NTteDg==}
resolution: {integrity: sha512-7ZgogeTnjuHbo+ct10G9Ffp0mif17idi0IyWNVA/wcwcm7NPOD/WEHVP3n7n3MhXqxoIYm8d6MuZohYWIZ4T3w==}
+ resolution: {integrity: sha512-B/pSlYVHQ58kqISD/yDjuJ1yfzI34m1gF4lAod2bwSRhiN4K5Cl3H8Af7hqB2PmTL911tdEudnnXn5FnhRoz0w==}
+
resolution: {integrity: sha512-vnS4AVwp1KHAF13i1vp1/2D5evWy3k5u/iW/B81QVsUZtV8cv2tU0b2VNFlqvh4kYwrFMDdjPCfAmfyJW9y14Q==}
@@ -1196,10 +1123,6 @@ packages:
resolution: {integrity: sha512-otxSQPw4lkOZWkHpB3zaEQs6gWYEsmX4xQF68ElXC/TWvGxGMSGOvoNbaLXm6/cS/fSfHtsEdw90y20PCd+sCA==}
engines: {node: '>=10.13.0'}
- resolution: {integrity: sha512-aN97NXWF6AWBTahfVOIrB/NShkzi5H7F9r1s9mD3cDj4Ko5f2qhhVoYMibXF7GlLveb/D2ioWay8lxI97Ven3g==}
- engines: {node: '>=0.12'}
-
resolution: {integrity: sha512-zwfzJecQ/Uej6tusMqwAqU/6KL2XaB2VZ2Jg54Je6ahNBGNH6Ek6g3jjNCF0fG9EWQKGZNddNjU5F1ZQn/sBnA==}
engines: {node: '>=20.19.0'}
@@ -1211,10 +1134,6 @@ packages:
resolution: {integrity: sha512-WUj2qlxaQtO4g6Pq5c29GTcWGDyd8itL8zTlipgECz3JesAiiOKotd8JU6otB3PACgG6xkJUyVhboMS+bje/jA==}
engines: {node: '>=6'}
- resolution: {integrity: sha512-/veY75JbMK4j1yjvuUxuVsiS/hr/4iHs9FTT6cgTexxdE0Ly/glccBAkloH/DofkjRbZU3bnoj38mOmhkZ0lHw==}
- engines: {node: '>=12'}
-
resolution: {integrity: sha512-7RUKfXgSMMkzt6ZuXmqapOurLGPPfgj6l9uRZ7lRGolvk0y2yocc35LdcxKC5PQZdn2DMqioAQ2NoWcrTKmm6g==}
@@ -1225,9 +1144,6 @@ packages:
resolution: {integrity: sha512-knvyeauYhqjOYvQ66MznSMs83wmHrCycNEN6Ao+2AeYEfxUIkuiVxdEa1qlGEPK+We3n0THiDciYSsCcgW/DoA==}
engines: {node: '>=12.0.0'}
- resolution: {integrity: sha512-fjquC59cD7CyW6urNXK0FBufkZcoiGG80wTuPujX590cB5Ttln20E2UB4S/WARVqhXffZl2LNgS+gQdPIIim/g==}
-
resolution: {integrity: sha512-tIbYtZbucOs0BRGqPJkshJUYdL+SDH7dVM8gjy+ERp3WAUjLEFJE+02kanyHtwjWOnwrKYBiwAmM0p4kLJAnXg==}
engines: {node: '>=12.0.0'}
@@ -1257,24 +1173,6 @@ packages:
resolution: {integrity: sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ==}
- resolution: {integrity: sha512-3kxEVkEKt0zvcZ3hCRYI8rqrgwtlIOFMWkbclACvjlDw8Li9S2hk/d51OI0nr/gIpdMHNepwgOKqZ/sy0Clpyg==}
-
- resolution: {integrity: sha512-wkQCkSYoOGCRKERFWcxMVMOcYE2K1AaNLU8DXS9arxnLOUEWbOXKXiJUNzEpqZ3JOKpnha3jkFrumEjVliDe7A==}
-
- resolution: {integrity: sha512-Y8/SBAHkZGoNkpzqqfCldijcuUKh7/su31kEBp67cFY09Wy0mTRgtsLYsiIxMJxlu0f6AA5SUTbDR8K0rxnbUw==}
-
- resolution: {integrity: sha512-3yTWghByc50aGS7JlGhk61SPenfE/p1oaFeNwkOOyrscaOkMGrcW9+Cy/QAIOBpZxP1yqDIzFMR0+Np0i0+usg==}
-
- resolution: {integrity: sha512-MlWT6Pjt4CG9lFCjiz4BH7l9wmrMkfkJYCxFwKQic8+RTZgWPuWxwAfjJElsXkex7DJjfSJsQIt931ilUgmwdA==}
-
- resolution: {integrity: sha512-g7df9rMFX/SPi34tyGCyUBREQoKkapwdY/T04Qn9TDWfHhAYt4/I0gMVirzK5wEzeUqIjEB+LXC/ypb7Aqno5w==}
-
resolution: {integrity: sha512-CV9TW3Y3f8/wT0BRFc1/KAVQ3TUHiXmaAb6VW9vtiMFf7SLoMd1PdAc4W3KFOFETBJUb90KatHqlsZMWV+R9Gg==}
engines: {node: ^20.19.0 || ^22.12.0 || >=24.0.0}
@@ -1285,9 +1183,6 @@ packages:
resolution: {integrity: sha512-cuOPoI7WApyhBElTTb9oqsawRvZ0rHhaHwghRLlTuffoD1B2aDemlCruLeZrUIIdvG7gs9xeELEPm6PhuASqrg==}
- resolution: {integrity: sha512-bEqo66MRXsUGxWHV5IP0PUiAWwoEjba4VCzg0LjFJBpchPaTfyfCKTG6bc5F8ucKec3q5y6qOdGyYTSBEvhCrg==}
-
resolution: {integrity: sha512-Bu5Z2nAXgfVyM8xvW3jk9EKRIuX37PudsrBViThNFx7CR7aaYTpP01cxNB/E4c4UUzTDiAZRstEhsRfPOL/8xA==}
peerDependencies:
@@ -1300,10 +1195,6 @@ packages:
resolution: {integrity: sha512-EdDDZu4A2OyIK7Lr/2zG+w5jmbuk1DVBnEwREQvBzspBJkCEbRa8GxU1lghYcaGJCnRWibjDXlq779X1/y5xwg==}
engines: {node: '>=8'}
- resolution: {integrity: sha512-+Pgi+vMuUNkJyExiMBt5IlFoMyKnr5zhJ4Uspz58WOhBF5QoIZkFyNHIbBAtHwzVAgk5RtndVNsDRN61/mmDqg==}
- engines: {node: '>=12'}
-
resolution: {integrity: sha512-bCYeRA2rVibKZd+s2625gGnGF/t7DSqDs4dP7CrLA1m7jKWz6pps0LpYLJN8Q64HtmPKJ1hrN3nzPNKFEKOUiQ==}
@@ -1428,9 +1319,6 @@ packages:
resolution: {integrity: sha512-J8xewKD/Gk22OZbhpOVSwcs60zhd95ESDwezOFuA3/099925PdHJ7OFHNTGtajL3AlZkykD32HykiMo+BIBI8A==}
- resolution: {integrity: sha512-9Ri+o0JYgehTaVBBDoMqIl8GXtbWg711O3srftcHhZ0dqnETqLaoIK0x17fUw9rFSlK/0NlsKe0Ahhyl5pXE2g==}
-
resolution: {integrity: sha512-NxVFwLAnrd9i7KUBxC4DrUhmgjzOs+1Qm50D3oF1/oL+r1NpZ4gA7xvG0/zJ8evR7zIKn4vLf7qTNduWFtCrRw==}
engines: {node: 20 || >=22}
@@ -1454,135 +1342,9 @@ packages:
resolution: {integrity: sha512-+ZkjKTodsVLY0ewQThvXRxXQsclcsSgOm5LlnrBM3G8AloMJKt6Haw8mY4xrOl8T0WMqH6DTYjktZ9zGQXZd4w==}
engines: {node: '>=16.14.0', npm: '>=8.1.0'}
- resolution: {integrity: sha512-wiYz4+JrLyb/DqW2hkFJxP7Vd7JuTDm77fvbM8VfEQdmSMqcImWeeRbHwZjBjIFki/VaMK2BhFi7oUUZeM5bqw==}
-
- resolution: {integrity: sha512-Tmd1Vg/m3Xz43afeNxDIhWRtFZgM2VLyaf4vSTYwudTyeuTneoL3qtWMA5jeLyz/O1vDJmmV4QuScFCA2tBPwg==}
-
- resolution: {integrity: sha512-W4mAWTvSlKvf8L6J+VN9yLSqQ9AOAAvHuoDAmPkz4dHf553m5gVj2ejadHJhoJmcmxEnOv6Pa8XJhpxE93kb8Q==}
-
- resolution: {integrity: sha512-5HVP2MKaP6L+G6YaxPNjuL0BPrq9orG3TsrZ9YXbA3vDw/ACI4MEsnoDpn6ZNm7GnZgtAcONJyPhOP8tNJQavQ==}
-
- resolution: {integrity: sha512-sqpDWlsHn7Ac9GNZQMeUzPQSMzR6Wv0WKRNvQRg0KqHh02fpTz69Qc1QSseNX29bhz1ROIyNyxExfawVKTm1GQ==}
-
- resolution: {integrity: sha512-mKKb915TF+OC5ptj5bJ7WFRPdYtuHv0yTRxK2tJvi+BDqbkiG7h7u/9SI89nRAYcmap2xHQL9D+QG/6wSrTtXg==}
-
- resolution: {integrity: sha512-78UEvebzz/rJIxLvE7ZtDd/vIQ0RHv+3Mh5DR96p7cS7HsBhYIICDBCu8csTNWNO6tBWfqXPWekRuj2FNOGOZg==}
-
- resolution: {integrity: sha512-IrtvNvjxC1o06taBAVJznEnkiHxLFTzgonUdy8hzFVeDun0uTjxxrRGVaNFqkU1wJR3RBPEfsxmU6jDWPofrTQ==}
-
- resolution: {integrity: sha512-0ulfdQOM3ysHhCJ1p06l0b0VKlhU0wuQs3thxZQagjcjPrlFRqY215uZGHHJan9GEAXd9MbfPjFJz+qMkVR6zQ==}
-
- resolution: {integrity: sha512-MbgeFca0hLYIEx/2zGsszCSEJJ1JSCdiY5xQxRcLDDGa8EPvlLPupJ4DSajbMPAnC0je8jfb9TiUATnxxrHUog==}
-
- resolution: {integrity: sha512-TqICwyvJJpBwvGAMZjj4J2n0X8QWp21b9l0o7eXyVJ25YNWYbJDVIyD1bZXE6WtV6RmKJVYmQAKWa0zWOABz2w==}
-
- resolution: {integrity: sha512-cctsq2wp5vTsLIcaymblUriiTcZd0CwWtCbLvrOzYCDZoWyMNV8sZ7krj09FSnsiJi3WVsHLM4k6Dq/yaPyCXA==}
-
- resolution: {integrity: sha512-xj68wMTvGXVOKonmog6LwyJKrYXZPvlwabaryTjLh9LuvovB/KAH+kvi8Gjj+7rJjsFi23nkUxRQv1KqSroMqA==}
-
- resolution: {integrity: sha512-0H44vDimn51F0YwvxSJSm0eCDOJTRlmN0R1yBh4HLj9wiV1Dn0QoXGbvFAWj2hSItVTlCmBF1hqKlIyUBVFLPg==}
-
resolution: {integrity: sha512-9Yubnt3e8A0OKwxYSXyhLymGW4sCufcLG6VdiDdUGVkPhpqLxlvP5vl1983gQjJl3tqbrM731mjaZaP68AgosQ==}
- resolution: {integrity: sha512-RDBrHEMSxVFLg6xvnXmb1Ayr2WzLAWjeSATAoxwKYJV94TeNavgoIdA0a9ytzDSVzBy2YKFK+emCPOEibLeCrg==}
-
- resolution: {integrity: sha512-oOg7knzhicgQ3t4QCjCWgTmfNhvQbDDnJeVu9v81r7NltNCVmhPy1fJRX27pISafdjL+SVc4d3l48Gb6pbRypw==}
-
- resolution: {integrity: sha512-/yPhxI1ntnDNsiHtzLKYnE3vf9JZ6cAisqVDauhp4CEHxlb4uoOTxOCJ+9s51bIB8U1N1FJ1RXOKTIlD5B/gqw==}
-
- resolution: {integrity: sha512-ADVjpOOkjz1hhkZLlBiYA9cR2Anf8F4HqZUO6e5eDcPQd0Txw5fxLzzxnEkSkfnD0wziSGiv7sYhk/ktvbf1uw==}
-
- resolution: {integrity: sha512-t2OU/dXXioARrC6yWfJ4hqB7rct14e8f7m0cbI5hUmDyyIlwv5vEtooptH8INkbLzOatzKuVbQmAYcbWoyz6Dg==}
-
- resolution: {integrity: sha512-xHlTOmuCSotIA8TW1mDIM6X2O1SiX5P9IuDtqGonFhEK0qgRI4yeC6vMxEV2dgyr2TiD+2PQ10o+cOhdVAcwfg==}
-
- resolution: {integrity: sha512-qIBZhqxqI6fjLDYFTBIa4eivDMnP+OZqsNwmQ3xNLE4Cxwc+zfQEfbs6tzAo2Hjq+bh6q5F+Z8/cksrLFYWQQw==}
-
- resolution: {integrity: sha512-vsKArQsicm7t0z2GugkCKtZehqUm31oeGBV/KVSorWSy8ZlNAv7ytjFhvaryUiCUJYqs+NoE6AFhpQvBTM6Q4w==}
-
- resolution: {integrity: sha512-Xe6rDdJlkmbFRExpTOmRj9N3MaWmbAgdpSrBQvCFqhezUn4AHqJHbaEnfbVYYiexVSs//tqOdY/DxhjdCiJnIA==}
-
- resolution: {integrity: sha512-VFMekyQExqIW7xIChcXn4ok29YE3rnuyveW3wZQWWqF4Nv9Wk5rgJ99KzPvHjkmPXF93FXIbBp6YdW3t71/7Vg==}
-
- resolution: {integrity: sha512-zRkxjtBxxLd2Sc0d+fbnEunsTj46SWXgXciZmHq0kDYGnck/ZSGj9/wULTV95uoeYiK5hRXP2mJ98Uo4cq/LQg==}
-
- resolution: {integrity: sha512-5bZ+3CjhAd9eChYTHsjy6TGxpOFSKgKKJPJxr293jTbfry2KDoWkhBb6TcPVB4NmzaPhMs1Frm9AZH7OD4Cjzw==}
-
- resolution: {integrity: sha512-Ob0nuZ3PKt/n0hORHyvoD9uZhr+Za8sFoP+OnMcnWK5lngSzALgQYKMr9RJVOWLqQYuyn6ulqGWSXdwf6F80lQ==}
-
- resolution: {integrity: sha512-wv8tdUTJ3thSFFFJKtpYKOYiGP2+v96Hvk4Tu8KpCAsTMs6yi+nVmGh1syvSCsaxz45J6Jbw+9DD6g97+NV67Q==}
-
- resolution: {integrity: sha512-QUNFEOPELfmvv+4xiNg2sRYeS/P84pTW0TCgP5zc9FpXetHY0ab7SxKyAQCNCc1eK0459uoLI1y5oO5Vc1dbhA==}
-
- resolution: {integrity: sha512-K0kHzM6afW/MbeWYWLjoHQv1sgg2Q9EccHEDzSkxiP/EaagNzCm7T/WMKZ3rjMbvIpvBiZgwR3dKMygtA4mG1Q==}
-
- resolution: {integrity: sha512-OnAnH8Ujmy59JcyZw8JSbK9cGpdVY44NKgSM7E9Eh7DiLS2E9RNQf0dONaGDzEG9yjEl5hcqeIsj4hfRkLH/Bg==}
-
- resolution: {integrity: sha512-ccUbYk6CwVdkmCQMyr64dXz42EfHGkPQlBj5p7YVGzq8I7CtjXZJrubAYezf7Rp+bjPseiROqe7G6foFd+lEuw==}
-
- resolution: {integrity: sha512-nDV/77Fj6eH1ynwscYTOsbK7rR//Uj0bZXBwJZRfaLEJ1iGBR6kIfNmlNqaqJf649EP0F3NWNdeJi03elllNUQ==}
-
- resolution: {integrity: sha512-c3cVx2y4KqUnwopcO9b/SCdo2O67LwJJ/UyqGfbigahfegL9myoEFoDYZgkT7f36T0bLrM9hZTAaAyH+PCAXjw==}
-
- resolution: {integrity: sha512-2cNEiYDhCWKI+Gs9T0Tiysk136SnR13hhO8yW6BGNyhOC4qYFnwF1nKfD3HFAIXA5c45RrIG1ub11GiXeYd1xA==}
-
- resolution: {integrity: sha512-sxPqmo70LyARJs0w2UclACPUUEqltCkJ6PhKdMIDuJ3gSf/Q+/GIe3WKl0Ijb/GyH9lOpUkRAO2wp0GVkLvS9Q==}
-
- resolution: {integrity: sha512-VdQyxFWFT2/FGJgwQnJYbe1jjQoNTS4RjglmSjTUlpUMa95Htx9NHeYW4rGDJzbjvCsl9eLjMQwGeElsqmzcHg==}
-
- resolution: {integrity: sha512-9N9IomZ/YuGGZZmQec1MbgxtlgougxTodVwDzzEouPKo3qFWvymFHWcnDi2vzV1ff6kas9ucW+o3yzJK9YB1AQ==}
-
- resolution: {integrity: sha512-XQLu552iSctvnEcgXw6+Sx75GflAPNED1qx7eBJ+wydBb2KCbRZe+NwvIEEMM83uml1+2WSXpBAcp9IUCgCYWA==}
-
- resolution: {integrity: sha512-vs5t8Apaud9N28kgCrRUdEed4UJ+wWNvicHLPxCa9ENlYuAY31M0ETy5y1vA33YoNPDFTghEbnh6efaE8h4x0Q==}
-
- resolution: {integrity: sha512-Yw0ECSpJoViF1qTU4DC6NwtC4aWGt1EkzaQB8KPPyCRR8z9TWeV0HbEFGTO+ZY1wB22zmxnJqhPyTpOVCpeHTA==}
-
- resolution: {integrity: sha512-zpe98Q6kvavpCr1NPVSCMebCKfD7CA2NqZ+rykeNhONIJBpc1tFKt9hucLGwha3jNTNI8lHpctWJWoimVF4PfA==}
-
resolution: {integrity: sha512-I9jwMn07Sy/IwOj3zVkVik2JTvgpaykDZEigL6Rx6N9LbMywwUSMtxET+7lVoDLLd3O3IXwJwvuuns8UB/HeAg==}
engines: {node: '>=4'}
@@ -1607,9 +1369,6 @@ packages:
resolution: {integrity: sha512-uTqF9MuPraAQ+IsnPf366RG4cP9RtUi7MLO1N3KEc+wb0a6yKpeL0lmk2IB1jY5KHPAlTc6T/JRdC/YqxHNwkQ==}
- resolution: {integrity: sha512-IInvU7fabl34qmi9gY8XOVxhYyMyuH2xUNpb2q8/Y+7552KlejkRvqvD19nMoUW/uQGGbqNpA6Tufu5FL5BZgw==}
-
resolution: {integrity: sha512-z1e/HMG90obSGeidlli3hj7cbocou0/wa5HacvI3ASx34PecNjNQeaHNo5WIZpWofN9kgkqV1q5YvXe3F0FoPw==}
@@ -1642,9 +1401,6 @@ packages:
resolution: {integrity: sha512-Qb1gy5OrP5+zDf2Bvnzdl3jsTf1qXVMazbvCoKhtKqVs4/YK4ozX4gKQJJVyNe+cajNPn0KoC0MC3FUmaHWEmQ==}
engines: {node: ^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0}
- resolution: {integrity: sha512-TwEZ+X+yCJmYfL7TPUOcvBZ4QfoT5YenQiJuX//0th53DE6w0xxLEtfK3iyryQFddXuvkIk51EEgrJQ0WJkOmQ==}
-
resolution: {integrity: sha512-VG2K63Igkiv9p76tk1lilczEK1cT+kCjKtkdhw1dQZV3k3IXJbd3o6Ho8b9zJZaHSnT2hKe4I+ObmX9w6m5SmQ==}
@@ -1727,27 +1483,6 @@ packages:
resolution: {integrity: sha512-6tDA8g98We0zd0GvVeMT9arEOnTw9qM03L9cJXaCjrip1OO764RDBLBfrB4cwzNGDj5OA5ioymC9GkizgWJDUg==}
engines: {node: '>=8'}
- resolution: {integrity: sha512-/aE8hCfKlQeA8LmyeyQvQF3eBiLRGNlfBJEvWH7ivp9sBqs7TNqBL5X3v157rM4IFETqDnIOO+z5M/biZbo9Ww==}
-
- resolution: {integrity: sha512-CsnhKNsyI8Tub6L4sm5ZFsme4puGfc6pYylvXo1AeqaGbjOYyzNv3qZPwvs0oMJ39eryyeOdmxwUIo94IpEhqg==}
-
- resolution: {integrity: sha512-IjEjJOkH4FuJvHZVIW0QCDWxcG96kCq7An/KVH2NfJe6rKZU2AsHeB3OEjPNRxi4QC34Xdx7I2KGYn6IpT7gxQ==}
-
- resolution: {integrity: sha512-1quofZ2RQ9EWdeN34S79+KExV1764+wCUGop5CPL1WGdD0ocPpu91lzPGbwWMECpEpd42kJGQwzRfyov9j4yNg==}
-
- resolution: {integrity: sha512-FCxlKLNGknS5ba/1lmpYijMUzX2esxW5xQqjWxw2eHFfS2MSdaHVINFmhjo+qN1WhZhNimq0dZATN9pH0IDrpA==}
-
- resolution: {integrity: sha512-Dh7l57ianaEoIpzbp0PC9UKAdCSVklD8E5Rpw7ETfbTl3FqcOOgq5q2LVDhgGCkaBv7p24JXikPdvhhmHvKMsw==}
-
- resolution: {integrity: sha512-1OSmLd3awB/t8qdoEOMazZkNsfVTeY4fTsgzcQFdXNq8ToTN4ZGwrMnlda4K6smTFKD+GRV6O48i6Z4iKgPPpw==}
-
resolution: {integrity: sha512-Xf0nWe6RseziFMu+Ap9biiUbmplq6S9/p+7w7YXP/JBHhrUDDUhwa+vANyubuqfZWTveU//DYVGsDG7RKL/vEw==}
engines: {node: '>=0.10.0'}
@@ -1784,9 +1519,6 @@ packages:
resolution: {integrity: sha512-UXWMKhLOwVKb728IUtQPXxfYU+usdybtUrK/8uGE8CQMvrhOpwvzDBwj0QhSL7MQc7vIsISBG8VQ8+IDQxpfQA==}
engines: {node: '>=0.10.0'}
- resolution: {integrity: sha512-PEGlAwrG8yXGXRjW32fGbg66JAlOAwbObuqVoJpv/mRgoWDQfgH1wDPvtzWyUSNAXBGSk8h755YDbbcEy3SH2Q==}
-
resolution: {integrity: sha512-1XMJE5fQo1jGH6Y/7ebnwPOBEkIEnT4QF32d5R1+VXdXveM0IBMJt8zfaxX1P3QhVwrYe+576+jkANtSS2mBbw==}
@@ -1843,12 +1575,6 @@ packages:
resolution: {integrity: sha512-bLVMLPtstlZ4iMQHpFHTR7GAGj2jxi8Dg0s2h2MafAE4uSWF98FC/3MomU51iQAMf8/qDUbKWf5GxuvvVcXEhw==}
engines: {node: '>=20'}
- resolution: {integrity: sha512-kRj8B+YHZCc9kQYdWfJB2/oUl9rA99qbowYYBtr4ui4mZyAQ2JpvVBd/6U2YloATfqBhBTSMhTpgBHtU0Mf3Rg==}
-
- resolution: {integrity: sha512-tmMpK00BjZiUyVyvrBK7knerNgmgvcV/KLVyuma/SC+TQN167GrMRciANTz09+k3zW8L8t60jWO1GpfkZdjTaw==}
-
resolution: {integrity: sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w==}
@@ -1867,24 +1593,6 @@ packages:
resolution: {integrity: sha512-xXnp4kTyor2Zq+J1FfPI6Eq3ew5h6Vl0F/8d9XU5zZQf1tX9s2Su1/3PiMmUANFULpmksxkClamIZcaUqryHsQ==}
engines: {node: '>=20.18.1'}
- resolution: {integrity: sha512-xKvGhPWw3k84Qjh8bI3ZeJjqnyadK+GEFtazSfZv/rKeTkTjOJho6mFqh2SM96iIcZokxiOpg78GazTSg8+KHA==}
-
- resolution: {integrity: sha512-LsiILbtBETkDz8I9p1dQ0uyRUWuaQzd/cuEeS1hoRSyW5E5XGmTzlwY1OrNzzakGowI9Dr/I8HVaw4hTtnxy8g==}
-
- resolution: {integrity: sha512-fucsC7HjXvkB5R3kTCO7kUjRdrS0BJt3M/FPxmHMBOm8JQi2BsHAHFsy27E0EolP8rp0NzXsJ+jNPyDWvOJZPA==}
-
- resolution: {integrity: sha512-0ASV06AAoKCDkS2+xw5RXJywruurpbC4JZSm7nr7MOt1ojAzvyyaO+UxZf18j8FCF6kmzCZKcAgN/yu2gm2XgQ==}
-
- resolution: {integrity: sha512-goh1s1TBrqSqukSc8wrjwWhL0hiJxgA8m4kFxGlQ+8FYQ3C/m11FcTs4YYem7V664AhHVvgoQLk890Ssdsr2IQ==}
-
- resolution: {integrity: sha512-m+vIdyeCOpdr/QeQCu2EzxX/ohgS8KbnPDgFni4dQsfSCtpz8UqDyY5GjRru8PDKuYn7Fq19j1CQ+nJSsGKOzg==}
-
resolution: {integrity: sha512-Js0m9cx+qOgDxo0eMiFGEueWztz+d4+M3rGlmKPT+T4IS/jP4ylw3Nwpu6cpTTP8R1MAC1kF4VbdLt3ARf209w==}
hasBin: true
@@ -1900,15 +1608,6 @@ packages:
resolution: {integrity: sha512-0/A9rDy9P7cJ+8w1c9WD9V//9Wj15Ce2MPz8Ri6032usz+NfePxx5AcN3bN+r6ZL6jEo066/yNYB3tn4pQEx+A==}
hasBin: true
- resolution: {integrity: sha512-5yXvWDEgqeiYiBe1lbxYF7UMAIm/IcopxMHrMQDq3nvKcjPKIhZklUKL+AE7J7uApI4kwe2snsK+eI6UTj9EHg==}
-
- resolution: {integrity: sha512-QTHzsGd1EhbZs4AsQ20JX1rC3cOlt/IWJruk893DfLRr57lcnOeMaWG4K0JrRta4mIJZKth2Au3mM3u03/JWKw==}
-
- resolution: {integrity: sha512-KzIbH/9tXat2u30jf+smMwFCsno4wHVdNmzFyL+T/L3UGqqk6JKfVqOFOZEpZSHADH1k40ab6NUIXZq422ov3Q==}
-
resolution: {integrity: sha512-Jz1mxtUBR5xTT65VOdJZUUeoyLtqljmFkiUXhPTLZka3RDc9vpi/xXkyrnsdRcm2lIi3l3GPMnAidTsEGIj3Ow==}
engines: {node: ^20.19.0 || >=22.12.0}
@@ -1997,9 +1696,6 @@ packages:
resolution: {integrity: sha512-o8qghlI8NZHU1lLPrpi2+Uq7abh4GGPpYANlalzWxyWteJOCsr/P+oPBA49TOLu5FTZO4d3F9MnWJfiMo4BkmA==}
engines: {node: '>=18'}
- resolution: {integrity: sha512-bKr1DkiNa2krS7qxNtdrtHAmzuYGFQLiQ13TsorsdT6ULTkPLKuu5+GsFpDlg6JFjUTwX2DyhMPG2be8uPrqsQ==}
-
resolution: {integrity: sha512-BMhLD/Sw+GbJC21C/UgyaZX41nPt8bUTg+jWyDeg7e7YN4xOM05YPSIXceACnXVtqyEw/LMClUQMtMZ+PGGpqQ==}
engines: {node: '>=20'}
@@ -2027,9 +1723,6 @@ packages:
resolution: {integrity: sha512-a4UGQaWPH59mOXUYnAG2ewncQS4i4F43Tv3JoAM+s2VDAmS9NsK8GpDMLrCHPksFT7h3K6TOoUNn2pb7RoXx4g==}
- resolution: {integrity: sha512-bXE4cR/kVZhKZX/RjPEflHaKVhUVl85noU3v6b8apfQEc1x4A+zBxjZ4lN8LqGd6WZ3dl98pY4o717VFmoPp+A==}
-
snapshots:
'@adobe/[email protected]': {}
@@ -2589,20 +2282,12 @@ snapshots:
'@types/deep-eql': 4.0.2
assertion-error: 2.0.1
- '@types/[email protected]':
- dependencies:
- '@types/ms': 2.1.0
-
'@types/[email protected]': {}
'@types/[email protected]': {}
'@types/[email protected]': {}
- '@types/[email protected]':
- dependencies:
- '@types/unist': 3.0.3
-
dependencies:
'@types/geojson': 7946.0.16
@@ -2613,12 +2298,6 @@ snapshots:
'@types/[email protected]': {}
- '@types/[email protected]':
- dependencies:
- '@types/unist': 3.0.3
-
- '@types/[email protected]': {}
-
dependencies:
undici-types: 7.16.0
@@ -2631,7 +2310,8 @@ snapshots:
dependencies:
csstype: 3.2.3
- '@types/[email protected]': {}
+ '@types/[email protected]':
+ optional: true
'@typescript/[email protected]':
optional: true
@@ -2693,9 +2373,7 @@ snapshots:
'@typescript/[email protected]':
optional: true
- '@ungap/[email protected]': {}
-
optionalDependencies:
react: 19.2.6
react-dom: 19.2.6([email protected])
@@ -2765,8 +2443,6 @@ snapshots:
dependencies:
'@babel/types': 7.29.0
-
@@ -2783,20 +2459,14 @@ snapshots:
-
-
dependencies:
clsx: 2.1.1
-
@@ -2829,22 +2499,18 @@ snapshots:
- dependencies:
- character-entities: 2.0.2
-
- dependencies:
- dequal: 2.0.3
-
+ optionalDependencies:
+ '@types/trusted-types': 2.0.7
+
@@ -2854,16 +2520,12 @@ snapshots:
graceful-fs: 4.2.11
tapable: 2.3.3
-
-
dependencies:
'@types/estree': 1.0.8
@@ -2872,8 +2534,6 @@ snapshots:
-
optionalDependencies:
picomatch: 4.0.4
@@ -2891,61 +2551,6 @@ snapshots:
- dependencies:
- '@types/hast': 3.0.4
- '@types/unist': 3.0.3
- devlop: 1.1.0
- hastscript: 9.0.1
- property-information: 7.1.0
- vfile: 6.0.3
- vfile-location: 5.0.3
- web-namespaces: 2.0.1
-
- dependencies:
- '@types/hast': 3.0.4
-
- dependencies:
- '@types/hast': 3.0.4
- '@types/unist': 3.0.3
- '@ungap/structured-clone': 1.3.0
- hast-util-from-parse5: 8.0.3
- hast-util-to-parse5: 8.0.1
- html-void-elements: 3.0.0
- mdast-util-to-hast: 13.2.1
- parse5: 7.3.0
- unist-util-position: 5.0.0
- unist-util-visit: 5.1.0
- vfile: 6.0.3
- web-namespaces: 2.0.1
- zwitch: 2.0.4
-
- dependencies:
- '@types/hast': 3.0.4
- '@ungap/structured-clone': 1.3.0
- unist-util-position: 5.0.0
-
- dependencies:
- '@types/hast': 3.0.4
- comma-separated-tokens: 2.0.3
- devlop: 1.1.0
- property-information: 7.1.0
- space-separated-tokens: 2.0.2
- web-namespaces: 2.0.1
- zwitch: 2.0.4
-
- dependencies:
- '@types/hast': 3.0.4
- comma-separated-tokens: 2.0.3
- hast-util-parse-selector: 4.0.0
- property-information: 7.1.0
- space-separated-tokens: 2.0.2
-
dependencies:
'@exodus/bytes': 1.15.0
@@ -2956,16 +2561,12 @@ snapshots:
-
optionalDependencies:
typescript: 7.0.2
-
@@ -3067,8 +2668,6 @@ snapshots:
-
@@ -3105,320 +2704,8 @@ snapshots:
quickselect: 3.0.0
tinyqueue: 3.0.0
-
- dependencies:
- '@types/mdast': 4.0.4
- escape-string-regexp: 5.0.0
- unist-util-is: 6.0.1
- unist-util-visit-parents: 6.0.2
-
- dependencies:
- '@types/mdast': 4.0.4
- '@types/unist': 3.0.3
- decode-named-character-reference: 1.3.0
- devlop: 1.1.0
- mdast-util-to-string: 4.0.0
- micromark: 4.0.2
- micromark-util-decode-numeric-character-reference: 2.0.2
- micromark-util-decode-string: 2.0.1
- micromark-util-normalize-identifier: 2.0.1
- micromark-util-symbol: 2.0.1
- micromark-util-types: 2.0.2
- unist-util-stringify-position: 4.0.0
- transitivePeerDependencies:
- - supports-color
-
- dependencies:
- '@types/mdast': 4.0.4
- ccount: 2.0.1
- devlop: 1.1.0
- mdast-util-find-and-replace: 3.0.2
- micromark-util-character: 2.1.1
-
- dependencies:
- '@types/mdast': 4.0.4
- devlop: 1.1.0
- mdast-util-from-markdown: 2.0.3
- mdast-util-to-markdown: 2.1.2
- micromark-util-normalize-identifier: 2.0.1
- transitivePeerDependencies:
- - supports-color
-
- dependencies:
- '@types/mdast': 4.0.4
- mdast-util-from-markdown: 2.0.3
- mdast-util-to-markdown: 2.1.2
- transitivePeerDependencies:
- - supports-color
-
- dependencies:
- '@types/mdast': 4.0.4
- devlop: 1.1.0
- markdown-table: 3.0.4
- mdast-util-from-markdown: 2.0.3
- mdast-util-to-markdown: 2.1.2
- transitivePeerDependencies:
- - supports-color
-
- dependencies:
- '@types/mdast': 4.0.4
- devlop: 1.1.0
- mdast-util-from-markdown: 2.0.3
- mdast-util-to-markdown: 2.1.2
- transitivePeerDependencies:
- - supports-color
-
- dependencies:
- mdast-util-from-markdown: 2.0.3
- mdast-util-gfm-autolink-literal: 2.0.1
- mdast-util-gfm-footnote: 2.1.0
- mdast-util-gfm-strikethrough: 2.0.0
- mdast-util-gfm-table: 2.0.0
- mdast-util-gfm-task-list-item: 2.0.0
- mdast-util-to-markdown: 2.1.2
- transitivePeerDependencies:
- - supports-color
-
- dependencies:
- '@types/mdast': 4.0.4
- mdast-util-find-and-replace: 3.0.2
-
- dependencies:
- '@types/mdast': 4.0.4
- unist-util-is: 6.0.1
-
- dependencies:
- '@types/hast': 3.0.4
- '@types/mdast': 4.0.4
- '@ungap/structured-clone': 1.3.0
- devlop: 1.1.0
- micromark-util-sanitize-uri: 2.0.1
- trim-lines: 3.0.1
- unist-util-position: 5.0.0
- unist-util-visit: 5.1.0
- vfile: 6.0.3
-
- dependencies:
- '@types/mdast': 4.0.4
- '@types/unist': 3.0.3
- longest-streak: 3.1.0
- mdast-util-phrasing: 4.1.0
- mdast-util-to-string: 4.0.0
- micromark-util-classify-character: 2.0.1
- micromark-util-decode-string: 2.0.1
- unist-util-visit: 5.1.0
- zwitch: 2.0.4
-
- dependencies:
- '@types/mdast': 4.0.4
-
- dependencies:
- decode-named-character-reference: 1.3.0
- devlop: 1.1.0
- micromark-factory-destination: 2.0.1
- micromark-factory-label: 2.0.1
- micromark-factory-space: 2.0.1
- micromark-factory-title: 2.0.1
- micromark-factory-whitespace: 2.0.1
- micromark-util-character: 2.1.1
- micromark-util-chunked: 2.0.1
- micromark-util-classify-character: 2.0.1
- micromark-util-html-tag-name: 2.0.1
- micromark-util-normalize-identifier: 2.0.1
- micromark-util-resolve-all: 2.0.1
- micromark-util-subtokenize: 2.1.0
- micromark-util-symbol: 2.0.1
- micromark-util-types: 2.0.2
-
- dependencies:
- micromark-util-character: 2.1.1
- micromark-util-sanitize-uri: 2.0.1
- micromark-util-symbol: 2.0.1
- micromark-util-types: 2.0.2
-
- dependencies:
- devlop: 1.1.0
- micromark-core-commonmark: 2.0.3
- micromark-factory-space: 2.0.1
- micromark-util-character: 2.1.1
- micromark-util-normalize-identifier: 2.0.1
- micromark-util-sanitize-uri: 2.0.1
- micromark-util-symbol: 2.0.1
- micromark-util-types: 2.0.2
-
- dependencies:
- devlop: 1.1.0
- micromark-util-chunked: 2.0.1
- micromark-util-classify-character: 2.0.1
- micromark-util-resolve-all: 2.0.1
- micromark-util-symbol: 2.0.1
- micromark-util-types: 2.0.2
-
- dependencies:
- devlop: 1.1.0
- micromark-factory-space: 2.0.1
- micromark-util-character: 2.1.1
- micromark-util-symbol: 2.0.1
- micromark-util-types: 2.0.2
-
- dependencies:
- micromark-util-types: 2.0.2
-
- dependencies:
- devlop: 1.1.0
- micromark-factory-space: 2.0.1
- micromark-util-character: 2.1.1
- micromark-util-symbol: 2.0.1
- micromark-util-types: 2.0.2
-
- dependencies:
- micromark-extension-gfm-autolink-literal: 2.1.0
- micromark-extension-gfm-footnote: 2.1.0
- micromark-extension-gfm-strikethrough: 2.1.0
- micromark-extension-gfm-table: 2.1.1
- micromark-extension-gfm-tagfilter: 2.0.0
- micromark-extension-gfm-task-list-item: 2.1.0
- micromark-util-combine-extensions: 2.0.1
- micromark-util-types: 2.0.2
-
- dependencies:
- micromark-util-character: 2.1.1
- micromark-util-symbol: 2.0.1
- micromark-util-types: 2.0.2
-
- dependencies:
- devlop: 1.1.0
- micromark-util-character: 2.1.1
- micromark-util-symbol: 2.0.1
- micromark-util-types: 2.0.2
-
- dependencies:
- micromark-util-character: 2.1.1
- micromark-util-types: 2.0.2
-
- dependencies:
- micromark-factory-space: 2.0.1
- micromark-util-character: 2.1.1
- micromark-util-symbol: 2.0.1
- micromark-util-types: 2.0.2
-
- dependencies:
- micromark-factory-space: 2.0.1
- micromark-util-character: 2.1.1
- micromark-util-symbol: 2.0.1
- micromark-util-types: 2.0.2
-
- dependencies:
- micromark-util-symbol: 2.0.1
- micromark-util-types: 2.0.2
-
- dependencies:
- micromark-util-symbol: 2.0.1
-
- dependencies:
- micromark-util-character: 2.1.1
- micromark-util-symbol: 2.0.1
- micromark-util-types: 2.0.2
-
- dependencies:
- micromark-util-chunked: 2.0.1
- micromark-util-types: 2.0.2
-
- dependencies:
- micromark-util-symbol: 2.0.1
-
- dependencies:
- decode-named-character-reference: 1.3.0
- micromark-util-character: 2.1.1
- micromark-util-decode-numeric-character-reference: 2.0.2
- micromark-util-symbol: 2.0.1
-
-
-
- dependencies:
- micromark-util-symbol: 2.0.1
-
- dependencies:
- micromark-util-types: 2.0.2
-
- dependencies:
- micromark-util-character: 2.1.1
- micromark-util-encode: 2.0.1
- micromark-util-symbol: 2.0.1
-
- dependencies:
- devlop: 1.1.0
- micromark-util-chunked: 2.0.1
- micromark-util-symbol: 2.0.1
- micromark-util-types: 2.0.2
-
-
-
- dependencies:
- '@types/debug': 4.1.13
- debug: 4.4.3
- decode-named-character-reference: 1.3.0
- devlop: 1.1.0
- micromark-core-commonmark: 2.0.3
- micromark-factory-space: 2.0.1
- micromark-util-character: 2.1.1
- micromark-util-chunked: 2.0.1
- micromark-util-combine-extensions: 2.0.1
- micromark-util-decode-numeric-character-reference: 2.0.2
- micromark-util-encode: 2.0.1
- micromark-util-normalize-identifier: 2.0.1
- micromark-util-resolve-all: 2.0.1
- micromark-util-sanitize-uri: 2.0.1
- micromark-util-subtokenize: 2.1.0
- micromark-util-symbol: 2.0.1
- micromark-util-types: 2.0.2
- transitivePeerDependencies:
- - supports-color
-
@@ -3433,10 +2720,6 @@ snapshots:
- dependencies:
- entities: 6.0.1
-
dependencies:
entities: 8.0.0
@@ -3467,8 +2750,6 @@ snapshots:
ansi-styles: 5.2.0
react-is: 17.0.2
-
@@ -3537,57 +2818,6 @@ snapshots:
indent-string: 4.0.0
strip-indent: 3.0.0
- dependencies:
- '@types/hast': 3.0.4
- hast-util-raw: 9.1.0
- vfile: 6.0.3
-
- dependencies:
- '@types/hast': 3.0.4
- hast-util-sanitize: 5.0.2
-
- dependencies:
- '@types/mdast': 4.0.4
- mdast-util-newline-to-break: 2.0.0
- unified: 11.0.5
-
- dependencies:
- '@types/mdast': 4.0.4
- mdast-util-gfm: 3.1.0
- micromark-extension-gfm: 3.0.0
- remark-parse: 11.0.0
- remark-stringify: 11.0.0
- unified: 11.0.5
- transitivePeerDependencies:
- - supports-color
-
- dependencies:
- '@types/mdast': 4.0.4
- mdast-util-from-markdown: 2.0.3
- micromark-util-types: 2.0.2
- unified: 11.0.5
- transitivePeerDependencies:
- - supports-color
-
- dependencies:
- '@types/hast': 3.0.4
- '@types/mdast': 4.0.4
- mdast-util-to-hast: 13.2.1
- unified: 11.0.5
- vfile: 6.0.3
-
- dependencies:
- '@types/mdast': 4.0.4
- mdast-util-to-markdown: 2.1.2
- unified: 11.0.5
-
@@ -3631,8 +2861,6 @@ snapshots:
-
@@ -3676,10 +2904,6 @@ snapshots:
dependencies:
punycode: 2.3.1
-
-
optional: true
@@ -3712,39 +2936,6 @@ snapshots:
- dependencies:
- '@types/unist': 3.0.3
- bail: 2.0.2
- devlop: 1.1.0
- extend: 3.0.2
- is-plain-obj: 4.1.0
- trough: 2.2.0
- vfile: 6.0.3
-
- dependencies:
- '@types/unist': 3.0.3
-
- dependencies:
- '@types/unist': 3.0.3
-
- dependencies:
- '@types/unist': 3.0.3
-
- dependencies:
- '@types/unist': 3.0.3
- unist-util-is: 6.0.1
-
- dependencies:
- '@types/unist': 3.0.3
- unist-util-is: 6.0.1
- unist-util-visit-parents: 6.0.2
-
dependencies:
browserslist: 4.28.2
@@ -3757,21 +2948,6 @@ snapshots:
- dependencies:
- '@types/unist': 3.0.3
- vfile: 6.0.3
-
- dependencies:
- '@types/unist': 3.0.3
- unist-util-stringify-position: 4.0.0
-
- dependencies:
- '@types/unist': 3.0.3
- vfile-message: 4.0.3
-
dependencies:
lightningcss: 1.32.0
@@ -3816,8 +2992,6 @@ snapshots:
dependencies:
xml-name-validator: 5.0.0
-
@@ -3840,5 +3014,3 @@ snapshots:
-
diff --git a/web/src/components/CalendarView/dayModel.ts b/web/src/components/CalendarView/dayModel.ts
index fad66053d..7c375fa92 100644
--- a/web/src/components/CalendarView/dayModel.ts
+++ b/web/src/components/CalendarView/dayModel.ts
@@ -1,17 +1,19 @@
+import {
+ type BlockNode,
+ type BlockQuoteNode,
+ type InlineNode,
+ inlineNodesText,
+ type ListItemNode,
+ type RawNode,
+ type Root,
+ visit,
+} from "@usememos/editor";
import dayjs from "dayjs";
-import type { Element, Root as HtmlRoot } from "hast";
-import type { Root, RootContent } from "mdast";
-import { fromMarkdown } from "mdast-util-from-markdown";
-import { gfmFromMarkdown } from "mdast-util-gfm";
-import { gfm } from "micromark-extension-gfm";
-import rehypeSanitize from "rehype-sanitize";
-import remarkRehype from "remark-rehype";
-import { unified } from "unified";
-import { visit } from "unist-util-visit";
import type { MemoTimeBasis } from "@/contexts/ViewContext";
import { getMemoSortTime } from "@/hooks/useMemoSorting";
import { ISO_DATE_FORMAT } from "@/lib/calendar-utils";
-import { SANITIZE_SCHEMA } from "@/lib/html-sanitize-schema";
+import { allowedAttributeValue } from "@/lib/html-sanitize-schema";
+import { parseMemoAst } from "@/lib/memo-ast";
import type { Memo } from "@/types/proto/api/memo_service_pb";
import { getAttachmentThumbnailUrl, getAttachmentUrl, isImage } from "@/utils/attachment";
import { classifyManagedAttachmentImageURL, extractAttachmentUIDFromName } from "@/utils/managed-attachment";
@@ -50,25 +52,71 @@ export interface BuildCalendarMonthModelOptions {
const ALERT_MARKER = /^\[!(?:note|tip|important|warning|caution)\][ \t]*(?:\n|$)/i;
/** Whether a blockquote is a GitHub alert: its text, not code or a link, starts with the marker line. */
-const isAlert = (node: RootContent): boolean => {
- const first = node.type === "blockquote" ? node.children[0] : undefined;
+const isAlert = (node: BlockQuoteNode): boolean => {
+ const first = node.children[0];
const lead = first?.type === "paragraph" ? first.children[0] : undefined;
return lead?.type === "text" && ALERT_MARKER.test(lead.value);
};
-const plainText = (node: RootContent): string => {
- if (node.type === "text" || node.type === "inlineCode" || node.type === "code") return node.value;
- if (node.type === "break") return "\n";
- // Image alt text and link definitions are not a written excerpt. Never render raw HTML.
- if (!("children" in node)) return "";
- const separator = ["list", "listItem", "blockquote", "table", "tableRow"].includes(node.type) ? "\n" : "";
- const text = node.children.map((child) => plainText(child as RootContent)).join(separator);
- return isAlert(node) ? text.replace(ALERT_MARKER, "") : text;
+const FOOTNOTE_LABEL = /^\[\^(?:[^\]\s\\]|\\.)+\]:[ \t]?/;
+
+/**
+ * A footnote definition's text as a tree of its own. The editor keeps a definition as a raw
+ * block, so a walk over the memo does not see the Markdown in it. Its lines go on indented
+ * by up to four spaces; the memo's link reference definitions still resolve in it.
+ */
+const footnoteTree = (node: RawNode, memo: Root): Root => {
+ const lines = node.value.replace(FOOTNOTE_LABEL, "").split("\n");
+ const text = lines.map((line, index) => (index === 0 ? line : line.replace(/^(?: {1,4}|\t)/, ""))).join("\n");
+ return parseMemoAst([text, ...memo.definitions].join("\n\n"));
+};
+
+/**
+ * Inline nodes without image alt text, which is not a written excerpt, without raw HTML, which
+ * is never rendered, and without footnote references, which are labels.
+ */
+const prose = (nodes: readonly InlineNode[]): InlineNode[] =>
+ nodes.flatMap<InlineNode>((node) => {
+ if (node.type === "image" || node.type === "html" || (node.type === "token" && node.name === "footnote")) return [];
+ return "children" in node ? [{ ...node, children: prose(node.children) }] : [node];
+ });
+
+// A soft break is a line break in a memo (`breaks: true`).
+const inlineText = (nodes: readonly InlineNode[]): string => inlineNodesText(prose(nodes), "\n");
+
+const plainText = (node: BlockNode | ListItemNode, memo: Root): string => {
+ const children = (nodes: readonly (BlockNode | ListItemNode)[]) => nodes.map((child) => plainText(child, memo)).join("\n");
+ switch (node.type) {
+ case "paragraph":
+ case "heading":
+ return inlineText(node.children);
+ case "codeBlock":
+ return node.value;
+ case "blockQuote": {
+ const text = children(node.children);
+ return isAlert(node) ? text.replace(ALERT_MARKER, "") : text;
+ }
+ case "list":
+ return children(node.items);
+ case "listItem":
+ return children(node.children);
+ case "table":
+ return node.rows.map((row) => row.map(inlineText).join("\n")).join("\n");
+ case "raw":
+ // A formula reads as its TeX and a footnote as its text; other extension blocks are not the memo's text.
+ if (node.name === "footnote") return children(footnoteTree(node, memo).children);
+ return node.name === "math" ? node.value : "";
+ default:
+ // Dividers, and raw HTML, which is never rendered.
+ return "";
+ }
};
const getExcerpt = (memo: Memo, tree: Root): CalendarDayExcerpt | undefined => {
const blocks = tree.children;
- const readable = blocks.map((block) => ({ text: plainText(block).trim(), isCode: block.type === "code" })).filter(({ text }) => text);
+ const readable = blocks
+ .map((block) => ({ text: plainText(block, tree).trim(), isCode: block.type === "codeBlock" }))
+ .filter(({ text }) => text);
const text =
readable
.map((block) => block.text)
@@ -83,11 +131,21 @@ const getExcerpt = (memo: Memo, tree: Root): CalendarDayExcerpt | undefined => {
};
};
-// Resolve reference-style images and apply the same src sanitization as the body renderer.
-// Raw HTML is deliberately excluded: only Markdown images contribute to this preview.
-const imageProcessor = unified()
- .use(remarkRehype)
- .use([[rehypeSanitize, SANITIZE_SCHEMA]]);
+/**
+ * Markdown image sources in reading order, footnotes included, with references resolved in the
+ * tree, under the memo view's source policy: relative or https only. Raw HTML is deliberately
+ * excluded: only Markdown images contribute to this preview.
+ */
+const contentImageSources = (tree: Root, memo: Root = tree): string[] => {
+ const sources: string[] = [];
+ visit(tree, (node) => {
+ if (node.type === "raw" && node.name === "footnote") sources.push(...contentImageSources(footnoteTree(node, memo), memo));
+ if (node.type !== "image") return;
+ const source = allowedAttributeValue("img", "src", node.destination);
+ if (source) sources.push(source);
+ });
+ return sources;
+};
const imageKey = (source: string): string => {
try {
@@ -100,14 +158,9 @@ const imageKey = (source: string): string => {
const getImageCandidates = (memo: Memo, tree: Root): string[] => {
const candidates: string[] = [];
const attachments = memo.attachments.filter((attachment) => isImage(attachment.type));
- const html = imageProcessor.runSync(tree) as HtmlRoot;
- visit(html, "element", (node: Element) => {
- if (node.tagName !== "img" || typeof node.properties.src !== "string") return;
- // The sanitizer above already dropped any src that is not relative or https.
- const source = node.properties.src;
- if (!source) return;
+ for (const source of contentImageSources(tree)) {
const classified = classifyManagedAttachmentImageURL(source);
- if (classified.kind === "invalid") return;
+ if (classified.kind === "invalid") continue;
const attachment = attachments.find((candidate) =>
classified.kind === "managed"
? extractAttachmentUIDFromName(candidate.name) === classified.uid
@@ -115,22 +168,20 @@ const getImageCandidates = (memo: Memo, tree: Root): string[] => {
);
// A managed image uses the attachment's thumbnail URL, just like an attached image.
// Missing managed attachments must not be treated as external image URLs.
- if (classified.kind === "managed" && !attachment) return;
+ if (classified.kind === "managed" && !attachment) continue;
candidates.push(attachment ? getAttachmentThumbnailUrl(attachment) : source);
- });
+ }
candidates.push(...attachments.map(getAttachmentThumbnailUrl));
return candidates;
};
-const parseMarkdown = (content: string): Root => fromMarkdown(content, { extensions: [gfm()], mdastExtensions: [gfmFromMarkdown()] });
-
/**
* The thumbnail of a memo's first photo, chosen the way a calendar day chooses its photos:
* Markdown images in reading order, then image attachments. Content with neither is not parsed.
*/
export const getMemoThumbnail = (memo: Memo): string | undefined => {
if (!memo.content.includes("![") && !memo.attachments.some((attachment) => isImage(attachment.type))) return undefined;
- return getImageCandidates(memo, parseMarkdown(memo.content))[0];
+ return getImageCandidates(memo, parseMemoAst(memo.content))[0];
};
/** Fold the month into stable day snapshots, independent of API pagination/order. */
@@ -152,7 +203,7 @@ export const buildCalendarMonthModel = (
summary.memos.push(memo);
if (!summary.creators.includes(memo.creator)) summary.creators.push(memo.creator);
if (isRedacted?.(memo)) continue;
- const tree = !summary.excerpt || summary.images.length < 2 ? parseMarkdown(memo.content) : undefined;
+ const tree = !summary.excerpt || summary.images.length < 2 ? parseMemoAst(memo.content) : undefined;
if (!summary.excerpt && tree) summary.excerpt = getExcerpt(memo, tree);
if (!fileFallbacks.has(date)) {
const file = memo.attachments.find((attachment) => !isImage(attachment.type) && !attachment.motionMedia?.groupId);
diff --git a/web/src/components/MemoEditor/MemoMarkdown.tsx b/web/src/components/MemoEditor/MemoMarkdown.tsx
index 86b7776ee..9f36ccd13 100644
--- a/web/src/components/MemoEditor/MemoMarkdown.tsx
+++ b/web/src/components/MemoEditor/MemoMarkdown.tsx
@@ -2,7 +2,8 @@ import type { Editor, EditorMode, Extension, Theme } from "@usememos/editor";
import { MarkdownEditor, type MarkdownEditorProps } from "@usememos/editor/react";
import "@usememos/editor/style.css";
import { type Ref, useCallback, useMemo, useState } from "react";
-import { MEMO_EDITOR_THEME, MEMO_MARKDOWN, memoEditorLabels, memoExtensions, memoResolveUrl } from "@/lib/memo-markdown";
+import { MEMO_MARKDOWN } from "@/lib/memo-ast";
+import { MEMO_EDITOR_THEME, memoEditorLabels, memoExtensions, memoResolveUrl, memoSanitizeHtml } from "@/lib/memo-markdown";
import type { Attachment } from "@/types/proto/api/attachment_service_pb";
import { useTranslate } from "@/utils/i18n";
import { useMemoDecorations } from "./useMemoDecorations";
@@ -51,7 +52,7 @@ const assignRef = <T,>(ref: Ref<T> | undefined, value: T) => {
/**
* A memo's Markdown in memos' dialect, look and policy, shown by the same editor whether
* read-only or editing: the memo syntax extensions (math, footnotes, tags, mentions,
- * highlighted code, Mermaid, sanitized HTML), the theme in the app's CSS variables, the
+ * highlighted code, Mermaid), raw HTML through memos' sanitizer, the theme in the app's CSS variables, the
* translated labels, the image and link URL policy, and tags and mentions decorated from
* the viewer's data. Everything a memo surface adds sits around this component.
*/
@@ -113,6 +114,7 @@ export const MemoMarkdown = (props: MemoMarkdownProps) => {
attributes={attributes}
resolveUrl={resolveUrl}
referrerPolicy="no-referrer"
+ sanitizeHtml={memoSanitizeHtml}
headingIds={headingIds}
onLinkClick={onLinkClick}
toolbar={toolbar}
diff --git a/web/src/components/MemoEditor/README.md b/web/src/components/MemoEditor/README.md
index 9c8a6b55e..f39e7115d 100644
--- a/web/src/components/MemoEditor/README.md
+++ b/web/src/components/MemoEditor/README.md
@@ -23,7 +23,7 @@ MemoEditor memo level: name | draft seed, mode, data, draft stor
└── Editor MemoMarkdown editable, with the composer's extensions, behind EditorController
```
-- **`MemoMarkdown.tsx`** binds the editor to memos once: the memo Markdown dialect, the theme in the app's CSS variables, translated labels, the image and link URL policy, the memo syntax extensions (math, footnotes, tags, mentions, highlighted code, Mermaid diagrams drawn by Pele, sanitized HTML) and the stylesheet. `useMemoDecorations` is the one flow for tag colors and resolved mentions, with one redecorate effect. Everything a surface adds sits around this component; nothing in memos styles the editor's own classes. The tag and mention classes memos hands the editor apply in source mode too, so the parts that draw a pill take the `rich:` variant (index.css), which is everything outside the editor's `.mbe-source-mode` root; source mode shows a tag as text in its color.
+- **`MemoMarkdown.tsx`** binds the editor to memos once: the memo Markdown dialect, the theme in the app's CSS variables, translated labels, the image and link URL policy, the memo syntax extensions (math, footnotes, tags, mentions, highlighted code, Mermaid diagrams drawn by Pele), raw HTML through the editor's `sanitizeHtml` option (`memoSanitizeHtml`: DOMPurify with memos' allowlist in `lib/html-sanitize-schema.ts`, trusted iframe hosts, and link and image defaults; loaded on first use) and the stylesheet. `useMemoDecorations` is the one flow for tag colors and resolved mentions, with one redecorate effect. Everything a surface adds sits around this component; nothing in memos styles the editor's own classes. The tag and mention classes memos hands the editor apply in source mode too, so the parts that draw a pill take the `rich:` variant (index.css), which is everything outside the editor's `.mbe-source-mode` root; source mode shows a tag as text in its color.
- **`view/`** is the read-only surface over `MemoMarkdown`: tags and mentions navigate, in-memo anchors scroll, a paragraph that is one bare link becomes a preview card through the editor's block view (`linkCards.ts`), the page's search matches are painted, and heading ids match the outline. Tag and mention clicks arrive through the editor's `onClick` callbacks, so nothing in memos matches the editor's class names or mutates its DOM. Previews that have Markdown but no memo query (the link-memo search, the share image) use `MemoContentView` directly.
- **`edit/`** is the editing surface: `EditSession` renders the chrome (timestamp, attachments, suggestions, toolbar, focus mode, audio recording) over the draft store `MemoEditor` provides, persists the draft while open, and saves through the memo mutations. `Editor.tsx` is the composer's editor: `MemoMarkdown` editable with the composer's own extensions (`#tag` and `:emoji` autocomplete, file paste and drop), behind the `EditorController` contract in `controller.ts`.
diff --git a/web/src/lib/html-sanitize-schema.ts b/web/src/lib/html-sanitize-schema.ts
index 6061b7618..f8e0f05cc 100644
--- a/web/src/lib/html-sanitize-schema.ts
+++ b/web/src/lib/html-sanitize-schema.ts
@@ -1,5 +1,3 @@
-import { defaultSchema } from "rehype-sanitize";
-
const TRUSTED_IFRAME_SRC_PATTERNS = [
/^https:\/\/www\.youtube\.com\/embed\/[^?#]+(?:\?.*)?$/i,
/^https:\/\/www\.youtube-nocookie\.com\/embed\/[^?#]+(?:\?.*)?$/i,
@@ -13,59 +11,218 @@ const TRUSTED_IFRAME_SRC_PATTERNS = [
/^https:\/\/(?:www\.)?draw\.io\/(?:[^?#]+)?(?:\?.*)?$/i,
];
-const KATEX_INLINE_CLASS_NAMES = ["language-math", "math-inline"] as const;
-const KATEX_BLOCK_CLASS_NAMES = ["language-math", "math-display"] as const;
-const SPAN_CLASS_NAMES = ["mention", "tag"] as const;
-const INPUT_ATTRIBUTES = [...(defaultSchema.attributes?.input || []), ["checked", true]] as const;
+export const isTrustedIframeSrc = (src: string): boolean => TRUSTED_IFRAME_SRC_PATTERNS.some((pattern) => pattern.test(src));
/**
- * Link schemes the browser hands off to another app (dialer, messaging) instead of navigating.
- * They cannot run script, so they are as safe as the `mailto:` the default schema already allows.
+ * The elements raw HTML in a memo may hold: GitHub's allowlist, less `picture` and
+ * `source`, whose `srcset` the https-only `src` rule below does not cover, so every
+ * remote image goes through `img`; plus `iframe`, for trusted embeds only.
*/
-const HANDOFF_LINK_PROTOCOLS = ["tel", "sms"];
+export const ALLOWED_TAGS = [
+ "a",
+ "b",
+ "blockquote",
+ "br",
+ "code",
+ "dd",
+ "del",
+ "details",
+ "div",
+ "dl",
+ "dt",
+ "em",
+ "h1",
+ "h2",
+ "h3",
+ "h4",
+ "h5",
+ "h6",
+ "hr",
+ "i",
+ "iframe",
+ "img",
+ "input",
+ "ins",
+ "kbd",
+ "li",
+ "ol",
+ "p",
+ "pre",
+ "q",
+ "rp",
+ "rt",
+ "ruby",
+ "s",
+ "samp",
+ "section",
+ "span",
+ "strike",
+ "strong",
+ "sub",
+ "summary",
+ "sup",
+ "table",
+ "tbody",
+ "td",
+ "tfoot",
+ "th",
+ "thead",
+ "tr",
+ "tt",
+ "ul",
+ "var",
+];
-export const isTrustedIframeSrc = (src: string): boolean => TRUSTED_IFRAME_SRC_PATTERNS.some((pattern) => pattern.test(src));
+/** Attributes every allowed element may carry, as on GitHub. */
+const GLOBAL_ATTRIBUTES = [
+ "abbr",
+ "accept",
+ "accept-charset",
+ "accesskey",
+ "action",
+ "align",
+ "alt",
+ "axis",
+ "border",
+ "cellpadding",
+ "cellspacing",
+ "char",
+ "charoff",
+ "charset",
+ "checked",
+ "clear",
+ "colspan",
+ "color",
+ "cols",
+ "compact",
+ "coords",
+ "datetime",
+ "dir",
+ "enctype",
+ "frame",
+ "hspace",
+ "headers",
+ "height",
+ "hreflang",
+ "for",
+ "id",
+ "ismap",
+ "itemprop",
+ "label",
+ "lang",
+ "maxlength",
+ "media",
+ "method",
+ "multiple",
+ "name",
+ "nohref",
+ "noshade",
+ "nowrap",
+ "open",
+ "prompt",
+ "readonly",
+ "rev",
+ "rowspan",
+ "rows",
+ "rules",
+ "scope",
+ "selected",
+ "shape",
+ "size",
+ "span",
+ "start",
+ "summary",
+ "tabindex",
+ "title",
+ "usemap",
+ "valign",
+ "value",
+ "width",
+];
+
+const ARIA_LABELS = ["aria-describedby", "aria-label", "aria-labelledby"];
+
+/** Attributes allowed on one element beyond the global ones. */
+const ELEMENT_ATTRIBUTES: Record<string, readonly string[]> = {
+ a: [...ARIA_LABELS, "data-footnote-backref", "data-footnote-ref", "class", "href"],
+ blockquote: ["cite"],
+ code: ["class"],
+ del: ["cite"],
+ div: ["itemscope", "itemtype"],
+ dl: ARIA_LABELS,
+ h2: ["class"],
+ iframe: ["src", "width", "height", "frameborder", "allowfullscreen", "allow", "title", "referrerpolicy", "loading"],
+ img: [...ARIA_LABELS, "longdesc", "src"],
+ input: ["disabled", "type", "checked"],
+ ins: ["cite"],
+ li: ["class"],
+ ol: [...ARIA_LABELS, "class"],
+ q: ["cite"],
+ section: ["data-footnotes", "class"],
+ span: ["class"],
+ summary: ARIA_LABELS,
+ table: ARIA_LABELS,
+ ul: [...ARIA_LABELS, "class"],
+};
+
+/** Attribute prefixes allowed on one element: tag and mention spans carry their data. */
+const ELEMENT_ATTRIBUTE_PREFIXES: Record<string, readonly string[]> = {
+ span: ["aria-", "data-"],
+};
+
+/** The class names an element may carry; others are dropped from its `class`. Includes the math and tag/mention classes the previous renderer emitted. */
+const CLASS_NAMES: Record<string, readonly (string | RegExp)[]> = {
+ a: ["data-footnote-backref"],
+ code: [/^language-./, "math-inline", "math-display"],
+ h2: ["sr-only"],
+ li: ["task-list-item"],
+ ol: ["contains-task-list"],
+ section: ["footnotes"],
+ span: ["mention", "tag"],
+ ul: ["contains-task-list"],
+};
+
+/**
+ * The URL schemes an attribute may use; a relative URL is always allowed. Links also allow
+ * `tel:` and `sms:`, which hand off to another app (dialer, messaging) instead of navigating;
+ * they cannot run script, so they are as safe as `mailto:`. Sources load over https only.
+ */
+const URL_PROTOCOLS: Record<string, readonly string[]> = {
+ cite: ["http", "https"],
+ href: ["http", "https", "irc", "ircs", "mailto", "xmpp", "tel", "sms"],
+ longdesc: ["http", "https"],
+ src: ["https"],
+};
+
+/** Every attribute name some element may carry, for the sanitizer's own first pass. */
+export const ALLOWED_ATTRIBUTES = [...new Set([...GLOBAL_ATTRIBUTES, ...Object.values(ELEMENT_ATTRIBUTES).flat()])];
+
+/** Whether a URL is relative, or uses one of `protocols`: a colon after the first `/`, `?` or `#` is not a scheme. */
+const hasAllowedProtocol = (url: string, protocols: readonly string[]): boolean => {
+ const colon = url.indexOf(":");
+ const end = [url.indexOf("/"), url.indexOf("?"), url.indexOf("#")].filter((index) => index !== -1);
+ if (colon === -1 || end.some((index) => colon > index)) return true;
+ return protocols.includes(url.slice(0, colon).toLowerCase());
+};
/**
- * Sanitization schema for raw HTML in memos (lib/sanitized-html.ts) and for images the
- * calendar reads from memo content. Extends the default schema to allow:
- * - the math and tag/mention class names the previous renderer emitted
- * - iframe embeds only from trusted providers
- * - `tel:` and `sms:` links
- *
- * This prevents XSS attacks from user-written HTML.
+ * What of an attribute raw HTML in a memo may keep on element `tag`: its value, the class
+ * names allowed there, or null to drop it. Event handlers and styles are never allowed.
*/
-export const SANITIZE_SCHEMA = {
- ...defaultSchema,
- // Don't re-prefix `id`/`name` attributes. remark-rehype already namespaces footnote ids with
- // `user-content-` and emits matching `#user-content-…` hrefs; the default schema's clobbering
- // would prepend a *second* `user-content-` to the ids only (not the hrefs), breaking in-page
- // navigation. Leaving ids untouched keeps footnote (and heading) anchors pointing at real targets.
- clobber: [],
- attributes: {
- ...defaultSchema.attributes,
- img: [...(defaultSchema.attributes?.img || []), "height", "width"],
- input: INPUT_ATTRIBUTES,
- code: [...(defaultSchema.attributes?.code || []), ["className", ...KATEX_INLINE_CLASS_NAMES, ...KATEX_BLOCK_CLASS_NAMES]],
- span: [...(defaultSchema.attributes?.span || []), ["className", ...SPAN_CLASS_NAMES], ["aria*"], ["data*"]],
- iframe: [
- ["src", ...TRUSTED_IFRAME_SRC_PATTERNS],
- "width",
- "height",
- "frameborder",
- "allowfullscreen",
- "allow",
- "title",
- "referrerpolicy",
- "loading",
- ],
- },
- // `picture`/`source` carry `srcSet`, which the https-only `src` rule below does not cover;
- // drop them so every remote image goes through the `img` `src` rule.
- tagNames: [...(defaultSchema.tagNames || []).filter((tag) => tag !== "picture" && tag !== "source"), "iframe"],
- protocols: {
- ...defaultSchema.protocols,
- href: [...(defaultSchema.protocols?.href || []), ...HANDOFF_LINK_PROTOCOLS],
- src: ["https"],
- },
+export const allowedAttributeValue = (tag: string, name: string, value: string): string | null => {
+ const allowed =
+ GLOBAL_ATTRIBUTES.includes(name) ||
+ ELEMENT_ATTRIBUTES[tag]?.includes(name) ||
+ ELEMENT_ATTRIBUTE_PREFIXES[tag]?.some((prefix) => name.startsWith(prefix));
+ if (!allowed) return null;
+ if (name === "class") {
+ const patterns = CLASS_NAMES[tag] ?? [];
+ const names = value
+ .split(/\s+/)
+ .filter((token) => patterns.some((pattern) => (typeof pattern === "string" ? pattern === token : pattern.test(token))));
+ return names.length ? names.join(" ") : null;
+ }
+ if (tag === "iframe" && name === "src") return isTrustedIframeSrc(value) ? value : null;
+ const protocols = URL_PROTOCOLS[name];
+ return protocols && !hasAllowedProtocol(value.trim(), protocols) ? null : value;
};
diff --git a/web/src/lib/memo-ast.ts b/web/src/lib/memo-ast.ts
new file mode 100644
index 000000000..c09d8cfea
--- /dev/null
+++ b/web/src/lib/memo-ast.ts
@@ -0,0 +1,55 @@
+import {
+ type ContentSource,
+ footnotes,
+ type InlineNode,
+ type MarkdownOptions,
+ type MarkdownSyntax,
+ math,
+ mentions,
+ parseAst,
+ type Root,
+ type TreeNode,
+ tags,
+ visit,
+} from "@usememos/editor";
+
+/**
+ * The memo Markdown dialect, shared by the composer and the read-only memo view
+ * so a memo reads the same while editing and after saving: a single newline is
+ * a line break, and setext headings are off, so a line
+ * followed by `---` stays a paragraph and a divider.
+ */
+export const MEMO_MARKDOWN: MarkdownOptions = { breaks: true, setext: false };
+
+/**
+ * The syntax the memo extensions add (math, footnotes, and the escapes of tags and
+ * mentions), for parsing outside an editor. `memoExtensions` in memo-markdown renders it.
+ */
+export const MEMO_SYNTAX: readonly MarkdownSyntax[] = [math(), footnotes(), tags(), mentions()].flatMap((extension) =>
+ extension.markdown ? [extension.markdown] : [],
+);
+
+/** A memo's syntax tree, as the composer and the memo view read it. */
+export const parseMemoAst = (markdown: string): Root => parseAst(markdown, { ...MEMO_MARKDOWN, syntax: MEMO_SYNTAX });
+
+/**
+ * Calls `visitor` for every node in document order, as `visit` does, and gives an inline
+ * node the content source its `pos` counts from (its paragraph's or heading's, or its
+ * table cell's), for `sourceRange`.
+ */
+export const visitWithSource = (root: Root, visitor: (node: TreeNode, source?: ContentSource) => void): void => {
+ const walk = (nodes: readonly InlineNode[], source: ContentSource | undefined) => {
+ for (const inline of nodes) visit(inline, (node) => visitor(node, source));
+ };
+ visit(root, (node) => {
+ visitor(node);
+ if (node.type === "paragraph" || node.type === "heading") {
+ walk(node.children, node.source);
+ return false;
+ }
+ if (node.type === "table") {
+ node.rows.forEach((row, r) => row.forEach((cell, c) => walk(cell, node.sources?.[r]?.[c])));
+ return false;
+ }
+ });
+};
diff --git a/web/src/lib/memo-markdown.ts b/web/src/lib/memo-markdown.ts
index f323234ad..ae26acfda 100644
--- a/web/src/lib/memo-markdown.ts
+++ b/web/src/lib/memo-markdown.ts
@@ -7,11 +7,11 @@ import {
isPlainTextBlock,
isTextBlock,
type Labels,
- type MarkdownOptions,
math,
mentions,
parseMarkdown,
type ResolveUrl,
+ type SanitizeHtml,
type Span,
type SyntaxView,
scanMentions,
@@ -24,6 +24,7 @@ import {
import { highlightLoadedCode, loadHighlighter } from "@/lib/code-highlight";
import { colorToHex } from "@/lib/color";
import { headingClasses, markdownStyles, mentionStyles, tagStyles } from "@/lib/markdownStyles";
+import { MEMO_MARKDOWN, MEMO_SYNTAX } from "@/lib/memo-ast";
import { findTagMetadata } from "@/lib/tag";
import { cn } from "@/lib/utils";
import type { Attachment } from "@/types/proto/api/attachment_service_pb";
@@ -31,14 +32,6 @@ import type { UserSetting_TagsSetting } from "@/types/proto/api/user_service_pb"
import type { useTranslate } from "@/utils/i18n";
import { resolveManagedAttachmentImageSource } from "@/utils/managed-attachment";
-/**
- * The memo Markdown dialect, shared by the composer and the read-only memo view
- * so a memo reads the same while editing and after saving: a single newline is
- * a line break, and setext headings are off, so a line
- * followed by `---` stays a paragraph and a divider.
- */
-export const MEMO_MARKDOWN: MarkdownOptions = { breaks: true, setext: false };
-
type KatexModule = typeof import("katex").default;
let katexModule: KatexModule | null = null;
@@ -126,18 +119,18 @@ const renderDiagram: SyntaxView = (source, element) => {
})();
};
-type HtmlRenderer = typeof import("@/lib/sanitized-html").renderSanitizedHtml;
-let htmlRenderer: HtmlRenderer | null = null;
-let htmlRendererPromise: Promise<HtmlRenderer> | null = null;
+type HtmlSanitizer = typeof import("@/lib/sanitized-html").sanitizeMemoHtml;
+let htmlSanitizer: HtmlSanitizer | null = null;
+let htmlSanitizerPromise: Promise<HtmlSanitizer> | null = null;
/** Raw HTML (`<details>`, `<kbd>`, trusted embeds) through memos' sanitizer, loaded the first time it is needed. */
-const renderHtml: SyntaxView = (source, element, kind) => {
- if (htmlRenderer) return htmlRenderer(source, element, kind);
- htmlRendererPromise ??= import("@/lib/sanitized-html").then((module) => {
- htmlRenderer = module.renderSanitizedHtml;
- return htmlRenderer;
+export const memoSanitizeHtml: SanitizeHtml = (tree) => {
+ if (htmlSanitizer) return htmlSanitizer(tree);
+ htmlSanitizerPromise ??= import("@/lib/sanitized-html").then((module) => {
+ htmlSanitizer = module.sanitizeMemoHtml;
+ return htmlSanitizer;
});
- return htmlRendererPromise.then((render) => render(source, element, kind));
+ return htmlSanitizerPromise.then((sanitize) => sanitize(tree));
};
/** A tag's custom color from the user's tag settings, as a hex value, or undefined for the theme color. */
@@ -193,8 +186,9 @@ interface MemoExtensionOptions {
/**
* The extensions every memo surface reads with, the composer and the memo view
* alike: math (KaTeX, loaded on demand), footnotes, #tags and @mentions,
- * highlighted code, Mermaid diagrams (drawn by Pele) and sanitized raw HTML.
- * Everything the editor renders shows its source at the caret while editing.
+ * highlighted code and Mermaid diagrams (drawn by Pele). Raw HTML is the
+ * editor's `sanitizeHtml` option, memoSanitizeHtml. Everything the editor
+ * renders shows its source at the caret while editing.
*/
export const memoExtensions = (options: MemoExtensionOptions = {}): Extension[] => [
math({ render: renderMath }),
@@ -202,7 +196,7 @@ export const memoExtensions = (options: MemoExtensionOptions = {}): Extension[]
tags(options.tags),
mentions(options.mentions),
codeHighlight(),
- { name: "memoViews", views: { "code:mermaid": renderDiagram, html: renderHtml } },
+ { name: "memoViews", views: { "code:mermaid": renderDiagram } },
];
/** Images load from relative URLs and https only, as memos' sanitizer allowed; anything else is dropped. */
@@ -381,9 +375,6 @@ const collectMatches = (blocks: readonly Block[], scan: TagScanner): string[] =>
/** Tags written in a document, as highlighted: `#work/project` gives `work/project`. */
export const collectTags = (blocks: readonly Block[]): string[] => collectMatches(blocks, scanTags);
-// The syntax the memo extensions add (math, footnotes, and the escapes of tags and mentions), for parsing outside an editor.
-const MEMO_SYNTAX = memoExtensions().flatMap((extension) => (extension.markdown ? [extension.markdown] : []));
-
/** Parses a memo the way the composer and the memo view read it. */
export const parseMemoMarkdown = (markdown: string): Doc => parseMarkdown(markdown, { ...MEMO_MARKDOWN, syntax: MEMO_SYNTAX });
diff --git a/web/src/lib/sanitized-html.ts b/web/src/lib/sanitized-html.ts
index ef44f0788..122022b84 100644
--- a/web/src/lib/sanitized-html.ts
+++ b/web/src/lib/sanitized-html.ts
@@ -1,82 +1,33 @@
-import type { Element, Properties, Root, RootContent } from "hast";
-import rehypeRaw from "rehype-raw";
-import rehypeSanitize from "rehype-sanitize";
-import remarkBreaks from "remark-breaks";
-import remarkGfm from "remark-gfm";
-import remarkParse from "remark-parse";
-import remarkRehype from "remark-rehype";
-import { unified } from "unified";
-import { visit } from "unist-util-visit";
-import { isTrustedIframeSrc, SANITIZE_SCHEMA } from "@/lib/html-sanitize-schema";
+import DOMPurify from "dompurify";
+import { ALLOWED_ATTRIBUTES, ALLOWED_TAGS, allowedAttributeValue, isTrustedIframeSrc } from "@/lib/html-sanitize-schema";
import { markdownStyles } from "@/lib/markdownStyles";
import { cn } from "@/lib/utils";
const BILIBILI_PLAYER_SRC = /^https:\/\/player\.bilibili\.com\/player\.html(?:\?|$)/i;
/**
- * Normalizes every `src` to a lowercase `https:` URL before sanitization. The sanitizer's
- * protocol allowlist is case-sensitive, so `HTTPS://…` would be dropped, and it treats a
- * scheme-relative `//host/…` as a relative URL, which an HTTP deployment would load over
- * plain HTTP. Bilibili's share dialog emits a scheme-relative iframe, and its player starts
- * playing on load unless the URL says `autoplay=0`.
+ * Normalizes every `src` to a lowercase `https:` URL before sanitization, so the trusted
+ * iframe hosts match it. A scheme-relative `//host/…` would otherwise count as a relative
+ * URL, which an HTTP deployment would load over plain HTTP. Bilibili's share dialog emits a
+ * scheme-relative iframe, and its player starts playing on load unless the URL says
+ * `autoplay=0`. The tree is not in the page yet, so nothing loads before the sanitizer runs.
*/
-const normalizeSources = (tree: Root): void => {
- visit(tree, "element", (node) => {
- const src = node.properties.src;
- if (typeof src !== "string") return;
- const trimmed = src.trim();
+const normalizeSources = (root: ParentNode): void => {
+ for (const element of Array.from(root.querySelectorAll("[src]"))) {
+ const trimmed = element.getAttribute("src")!.trim();
let normalized = trimmed.startsWith("//") ? `https:${trimmed}` : trimmed.replace(/^https:/i, "https:");
- if (node.tagName === "iframe" && BILIBILI_PLAYER_SRC.test(normalized)) {
+ if (element.localName === "iframe" && BILIBILI_PLAYER_SRC.test(normalized)) {
const url = new URL(normalized);
if (!url.searchParams.has("autoplay")) url.searchParams.set("autoplay", "0");
normalized = url.href;
}
- node.properties.src = normalized;
- });
-};
-
-/**
- * Raw HTML in a memo, such as a `<details>` section or a trusted video embed,
- * as the memo view shows it. Loaded on demand: the editor keeps an HTML block
- * as source, and this turns that source into sanitized DOM. Markdown between
- * the tags is rendered too, as GitHub does.
- */
-const processor = unified()
- .use(remarkParse)
- .use(remarkGfm)
- .use(remarkBreaks)
- .use(remarkRehype, { allowDangerousHtml: true })
- .use(rehypeRaw)
- .use(() => normalizeSources)
- .use([[rehypeSanitize, SANITIZE_SCHEMA]]);
-
-const ATTRIBUTE_NAMES: Record<string, string> = {
- className: "class",
- htmlFor: "for",
- acceptCharset: "accept-charset",
- httpEquiv: "http-equiv",
-};
-
-/** The HTML attribute for a hast property name: `className` → `class`, `dataFooBar` → `data-foo-bar`, `ariaLabel` → `aria-label`. */
-const attributeName = (property: string): string => {
- if (ATTRIBUTE_NAMES[property]) return ATTRIBUTE_NAMES[property];
- if (/^data[A-Z]/.test(property)) return property.replace(/[A-Z]/g, (letter) => `-${letter.toLowerCase()}`);
- if (/^aria[A-Z]/.test(property)) return `aria-${property.slice(4).toLowerCase()}`;
- return property.toLowerCase();
-};
-
-const setAttributes = (element: HTMLElement, properties: Properties | undefined) => {
- for (const [property, value] of Object.entries(properties ?? {})) {
- if (value === false || value === null || value === undefined) continue;
- const attribute = attributeName(property);
- if (value === true) element.setAttribute(attribute, "");
- else element.setAttribute(attribute, Array.isArray(value) ? value.join(" ") : String(value));
+ element.setAttribute("src", normalized);
}
};
-/** Memo-view styling and safe defaults for the few elements that need them. */
-const finishElement = (element: HTMLElement, node: Element): HTMLElement | null => {
- switch (node.tagName) {
+/** Memo-view styling and safe defaults for the few elements that need them; false drops the element. */
+const finishElement = (element: Element): boolean => {
+ switch (element.localName) {
case "a":
if (!element.getAttribute("href")?.startsWith("#")) {
element.setAttribute("target", "_blank");
@@ -91,11 +42,11 @@ const finishElement = (element: HTMLElement, node: Element): HTMLElement | null
element.className = cn(markdownStyles.image, element.className);
break;
case "iframe":
- if (!isTrustedIframeSrc(element.getAttribute("src") ?? "")) return null;
+ if (!isTrustedIframeSrc(element.getAttribute("src") ?? "")) return false;
// Share snippets without a size (Bilibili's) would otherwise render at the browser's 300×150.
element.className = cn(
"max-w-full rounded-lg border border-border",
- !node.properties.width && !node.properties.height && "w-full aspect-video",
+ !element.hasAttribute("width") && !element.hasAttribute("height") && "w-full aspect-video",
element.className,
);
break;
@@ -106,36 +57,35 @@ const finishElement = (element: HTMLElement, node: Element): HTMLElement | null
element.className = cn("cursor-pointer", element.className);
break;
case "input":
+ element.setAttribute("type", "checkbox");
element.setAttribute("disabled", "");
break;
}
- return element;
+ return true;
};
-const toDom = (node: RootContent): Node | null => {
- if (node.type === "text") return document.createTextNode(node.value);
- if (node.type !== "element") return null;
- const element = document.createElement(node.tagName);
- setAttributes(element, node.properties);
- for (const child of node.children) {
- const childNode = toDom(child);
- if (childNode) element.appendChild(childNode);
- }
- return finishElement(element, node);
-};
+const purify = DOMPurify(window);
+purify.addHook("uponSanitizeAttribute", (node, data) => {
+ const value = allowedAttributeValue(node.localName, data.attrName, data.attrValue);
+ if (value === null) data.keepAttr = false;
+ else data.attrValue = value;
+});
/**
- * Renders raw HTML source into `target` as sanitized DOM, replacing what it held. A
- * block is rendered as written; an inline run (`<kbd>Ctrl</kbd>`) without the
- * paragraph Markdown would wrap it in.
+ * Raw HTML in a memo, such as a `<details>` section or a trusted video embed, as the memo
+ * view shows it: the editor's `sanitizeHtml`. Gets the HTML parsed into a fragment that is
+ * not in the page and removes, in place, what memos does not allow; text stays, so the
+ * Markdown between the tags, which the editor renders itself, keeps its place.
*/
-export function renderSanitizedHtml(source: string, target: HTMLElement, kind: "inline" | "block" = "block"): void {
- const tree = processor.runSync(processor.parse(source)) as Root;
- const nodes = tree.children.flatMap((child) => {
- const node = toDom(child);
- return node ? [node] : [];
- });
- const only = nodes.filter((node) => !(node.nodeType === Node.TEXT_NODE && !node.textContent?.trim()));
- const unwrap = kind === "inline" && only.length === 1 && only[0] instanceof HTMLParagraphElement;
- target.replaceChildren(...(unwrap ? Array.from(only[0].childNodes) : nodes));
+export function sanitizeMemoHtml(tree: DocumentFragment): DocumentFragment {
+ normalizeSources(tree);
+ // DOMPurify sanitizes an element in place, not a fragment, so the tree goes into one for the pass.
+ const root = (tree.ownerDocument ?? document).createElement("div");
+ root.append(tree);
+ purify.sanitize(root, { ALLOWED_TAGS, ALLOWED_ATTR: ALLOWED_ATTRIBUTES, IN_PLACE: true });
+ for (const element of Array.from(root.querySelectorAll("*"))) {
+ if (!finishElement(element)) element.remove();
+ }
+ tree.append(...root.childNodes);
+ return tree;
}
diff --git a/web/src/utils/managed-attachment.ts b/web/src/utils/managed-attachment.ts
index c9e4b465e..640f15b9f 100644
--- a/web/src/utils/managed-attachment.ts
+++ b/web/src/utils/managed-attachment.ts
@@ -1,9 +1,5 @@
-import type { Definition, Html, Image, ImageReference, Root } from "mdast";
-import { fromMarkdown } from "mdast-util-from-markdown";
-import { gfmFromMarkdown } from "mdast-util-gfm";
-import { gfm } from "micromark-extension-gfm";
-import { normalizeIdentifier } from "micromark-util-normalize-identifier";
-import { visit } from "unist-util-visit";
+import { lineTable, sourceRange } from "@usememos/editor";
+import { parseMemoAst, visitWithSource } from "@/lib/memo-ast";
import type { Attachment } from "@/types/proto/api/attachment_service_pb";
import { getAttachmentMotionGroupId, getAttachmentUrl, isImage } from "@/utils/attachment";
@@ -35,12 +31,6 @@ type ManagedImageURL = { kind: "unmanaged" } | { kind: "invalid" } | { kind: "ma
const UNMANAGED: ManagedImageURL = { kind: "unmanaged" };
const INVALID: ManagedImageURL = { kind: "invalid" };
-const parseMarkdown = (source: string): Root =>
- fromMarkdown(source, {
- extensions: [gfm()],
- mdastExtensions: [gfmFromMarkdown()],
- });
-
export const extractAttachmentUIDFromName = (name: string): string | undefined => {
if (!name.startsWith(ATTACHMENT_NAME_PREFIX)) return undefined;
const uid = name.slice(ATTACHMENT_NAME_PREFIX.length);
@@ -120,7 +110,7 @@ export const parseManagedAttachmentImageURL = (raw: string): string | undefined
const EMPTY_INDEX: ManagedImageIndex = { nodes: [], uids: new Set(), invalidReferences: [] };
/**
* Memo bodies are re-scanned on hot paths (every editor keystroke, every card
- * relayout, every render of a memo view), so the mdast parse is cached by source
+ * relayout, every render of a memo view), so the parse is cached by source
* text. The cache is bounded and also keeps the derived `uids` set referentially
* stable, which is what lets callers memoize on it.
*/
@@ -128,41 +118,30 @@ const INDEX_CACHE_LIMIT = 128;
const indexCache = new Map<string, ManagedImageIndex>();
const buildManagedImageIndex = (source: string): ManagedImageIndex => {
- const tree = parseMarkdown(source);
- const definitions = new Map<string, string>();
- visit(tree, "definition", (node: Definition) => {
- const identifier = normalizeIdentifier(node.identifier);
- // CommonMark and the API's Goldmark parser resolve duplicate definitions
- // to the first occurrence, so the client must not overwrite it here.
- if (!definitions.has(identifier)) definitions.set(identifier, node.url);
- });
-
+ // Image references are resolved in the tree, to the first of duplicate definitions as
+ // CommonMark and the API's Goldmark parser do, so an image's destination is final.
+ const tree = parseMemoAst(source);
+ const lines = lineTable(source);
const nodes: ManagedImageNode[] = [];
const invalidReferences: string[] = [];
- visit(tree, (node) => {
+
+ visitWithSource(tree, (node, content) => {
// The API accepts managed URLs only through Markdown image nodes and rejects
// any raw HTML mentioning the route, rather than running a second HTML parser.
- if (node.type === "html") {
- const raw = (node as Html).value;
- if (raw.includes(MANAGED_ATTACHMENT_PATH_PREFIX)) invalidReferences.push(raw);
+ if (node.type === "html" || node.type === "htmlBlock") {
+ if (node.value.includes(MANAGED_ATTACHMENT_PATH_PREFIX)) invalidReferences.push(node.value);
return;
}
+ if (node.type !== "image" || !node.destination) return;
- let destination: string | undefined;
- if (node.type === "image") {
- destination = (node as Image).url;
- } else if (node.type === "imageReference") {
- destination = definitions.get(normalizeIdentifier((node as ImageReference).identifier));
- }
- if (!destination) return;
-
- const classified = classifyManagedAttachmentImageURL(destination);
+ const classified = classifyManagedAttachmentImageURL(node.destination);
if (classified.kind === "invalid") {
- invalidReferences.push(destination);
+ invalidReferences.push(node.destination);
return;
}
if (classified.kind !== "managed") return;
- nodes.push({ uid: classified.uid, start: node.position?.start.offset, end: node.position?.end.offset });
+ const range = content && node.pos ? sourceRange(lines, content, node.pos) : undefined;
+ nodes.push({ uid: classified.uid, start: range?.from, end: range?.to });
});
return { nodes, uids: new Set(nodes.map((node) => node.uid)), invalidReferences };
};
diff --git a/web/src/utils/markdown-manipulation.ts b/web/src/utils/markdown-manipulation.ts
index afb81e665..cadeda020 100644
--- a/web/src/utils/markdown-manipulation.ts
+++ b/web/src/utils/markdown-manipulation.ts
@@ -1,11 +1,8 @@
// Utilities for manipulating markdown strings using AST parsing
-// Uses mdast for accurate task detection that properly handles code blocks
+// Uses the editor's syntax tree for accurate task detection that properly handles code blocks
-import type { ListItem } from "mdast";
-import { fromMarkdown } from "mdast-util-from-markdown";
-import { gfmFromMarkdown } from "mdast-util-gfm";
-import { gfm } from "micromark-extension-gfm";
-import { visit } from "unist-util-visit";
+import { visit } from "@usememos/editor";
+import { parseMemoAst } from "@/lib/memo-ast";
interface TaskInfo {
lineNumber: number;
@@ -15,18 +12,13 @@ interface TaskInfo {
// Extract all task list items from markdown using AST parsing
// This correctly ignores task-like patterns inside code blocks
function extractTasksFromAst(markdown: string): TaskInfo[] {
- const tree = fromMarkdown(markdown, {
- extensions: [gfm()],
- mdastExtensions: [gfmFromMarkdown()],
- });
-
const tasks: TaskInfo[] = [];
- visit(tree, "listItem", (node: ListItem) => {
- // Only process actual task list items (those with a checkbox)
- if (typeof node.checked === "boolean" && node.position?.start.line) {
+ visit(parseMemoAst(markdown), (node) => {
+ // Only process actual task list items (those with a checkbox); a list item's first line holds its marker
+ if (node.type === "listItem" && node.task && node.lines) {
tasks.push({
- lineNumber: node.position.start.line - 1, // Convert to 0-based
+ lineNumber: node.lines.start - 1, // Convert to 0-based
checked: node.checked,
});
}
@@ -138,18 +130,13 @@ export function createUniqueSlugGenerator(reservedSlugs: Iterable<string> = []):
}
export function extractTasks(markdown: string): TaskItem[] {
- const tree = fromMarkdown(markdown, {
- extensions: [gfm()],
- mdastExtensions: [gfmFromMarkdown()],
- });
-
const lines = markdown.split("\n");
const tasks: TaskItem[] = [];
let taskIndex = 0;
- visit(tree, "listItem", (node: ListItem) => {
- if (typeof node.checked === "boolean" && node.position?.start.line) {
- const lineNumber = node.position.start.line - 1;
+ visit(parseMemoAst(markdown), (node) => {
+ if (node.type === "listItem" && node.task && node.lines) {
+ const lineNumber = node.lines.start - 1;
const line = lines[lineNumber];
// Extract indentation
diff --git a/web/src/utils/markdown-task-actions.ts b/web/src/utils/markdown-task-actions.ts
index 61d101ab9..290b779c7 100644
--- a/web/src/utils/markdown-task-actions.ts
+++ b/web/src/utils/markdown-task-actions.ts
@@ -1,8 +1,5 @@
-import type { ListItem } from "mdast";
-import { fromMarkdown } from "mdast-util-from-markdown";
-import { gfmFromMarkdown } from "mdast-util-gfm";
-import { gfm } from "micromark-extension-gfm";
-import { visit } from "unist-util-visit";
+import { lineTable, visit } from "@usememos/editor";
+import { parseMemoAst } from "@/lib/memo-ast";
interface SourceRange {
start: number;
@@ -18,79 +15,26 @@ interface ParsedTaskItem {
checkboxMarker: SourceRange;
}
-interface LineInfo {
- text: string;
- startOffset: number;
- endOffset: number;
-}
-
-const TASK_LINE_REGEXP = /^(\s*)((?:[-*+])|(?:\d+[.)]))(\s+)\[([ xX])\]/;
-
-function getLineStarts(markdown: string): number[] {
- const starts = [0];
- for (let index = 0; index < markdown.length; index++) {
- if (markdown[index] === "\n") {
- starts.push(index + 1);
- }
- }
- return starts;
-}
-
-function getLineInfo(markdown: string, lineStarts: number[], lineNumber: number): LineInfo | undefined {
- const startOffset = lineStarts[lineNumber];
- if (startOffset === undefined) {
- return undefined;
- }
-
- const nextLineStart = lineStarts[lineNumber + 1];
- const endOffset = nextLineStart === undefined ? markdown.length : nextLineStart - 1;
- return {
- text: markdown.slice(startOffset, endOffset),
- startOffset,
- endOffset,
- };
-}
-
-function parseMarkdown(markdown: string) {
- return fromMarkdown(markdown, {
- extensions: [gfm()],
- mdastExtensions: [gfmFromMarkdown()],
- });
-}
+// A task item's first line: the quote markers and list markers before it (a list item may
+// start with another list's marker), its own marker, then the box.
+const TASK_LINE_REGEXP = /^((?:[ \t]*>)*(?:[ \t]*(?:[-*+]|\d{1,9}[.)])[ \t]+)+)\[([ xX])\]/;
function parseTaskItems(markdown: string): ParsedTaskItem[] {
- let tree: ReturnType<typeof parseMarkdown>;
- try {
- tree = parseMarkdown(markdown);
- } catch {
- return [];
- }
-
- const lineStarts = getLineStarts(markdown);
+ const lines = lineTable(markdown);
const tasks: ParsedTaskItem[] = [];
- visit(tree, "listItem", (node: ListItem) => {
- if (typeof node.checked !== "boolean") {
+ visit(parseMemoAst(markdown), (node) => {
+ if (node.type !== "listItem" || !node.task || !node.lines) {
return;
}
- const startLine = node.position ? node.position.start.line - 1 : undefined;
- if (startLine === undefined) {
+ const lineStart = lines.starts[node.lines.start - 1];
+ const match = markdown.slice(lineStart, lines.ends[node.lines.start - 1]).match(TASK_LINE_REGEXP);
+ if (!match) {
return;
}
- const lineInfo = getLineInfo(markdown, lineStarts, startLine);
- if (!lineInfo) {
- return;
- }
-
- const match = lineInfo.text.match(TASK_LINE_REGEXP);
- if (!match || match.index !== 0) {
- return;
- }
-
- const markerStart = lineInfo.startOffset + match[1].length + match[2].length + match[3].length + 1;
-
+ const markerStart = lineStart + match[1].length + 1;
tasks.push({
checked: node.checked,
checkboxMarker: {
diff --git a/web/tests/calendar-day-model.test.ts b/web/tests/calendar-day-model.test.ts
index 712ba00fd..60ef04c83 100644
--- a/web/tests/calendar-day-model.test.ts
+++ b/web/tests/calendar-day-model.test.ts
@@ -125,6 +125,7 @@ describe("calendar day snapshots", () => {
"`![code](https://example.com/code.jpg)`",
"```md\n![fenced](https://example.com/fenced.jpg)\n```",
'<img src="https://example.com/html.jpg">',
+ 'Inline <img src="https://example.com/inline-html.jpg"> text',
"![missing][undefined]",
"![data](data:image/png;base64,AAAA)",
"![insecure](http://example.com/insecure.jpg)",
@@ -137,6 +138,29 @@ describe("calendar day snapshots", () => {
expect(result.images.map((entry) => entry.thumbnailUrl)).toEqual(["https://example.com/valid.jpg"]);
});
+ it("reads images in footnotes in reading order, references and source policy included", () => {
+ const result = day([
+ memoAt(9, {
+ content: [
+ "See the note[^1].",
+ "[^1]: Taken at dawn ![dawn][photo]\n ![insecure](http://example.com/insecure.jpg)",
+ "![after](https://example.com/after.jpg)",
+ "[photo]: https://example.com/dawn.jpg",
+ ].join("\n\n"),
+ }),
+ ]);
+ expect(result.images.map((entry) => entry.thumbnailUrl)).toEqual(["https://example.com/dawn.jpg"]);
+ expect(getMemoThumbnail(memoAt(9, { content: "Note[^a]\n\n[^a]: ![only](https://example.com/only.jpg)" }))).toBe(
+ "https://example.com/only.jpg",
+ );
+ });
+
+ it("reads a footnote's text, not its reference label, into the excerpt", () => {
+ expect(day([memoAt(9, { content: "Test[^1]\n\n[^1]: very **important**\n\n second paragraph" })]).excerpt?.text).toBe(
+ "Test\nvery important\nsecond paragraph",
+ );
+ });
+
it("does not turn an image-only memo's alt text into an excerpt", () => {
const result = day([memoAt(9, { content: "![caption](https://example.com/a.jpg)", snippet: "caption" })]);
expect(result.excerpt).toBeUndefined();
diff --git a/web/tests/managed-attachment.test.ts b/web/tests/managed-attachment.test.ts
index 94420c50b..4c1e5ad1a 100644
--- a/web/tests/managed-attachment.test.ts
+++ b/web/tests/managed-attachment.test.ts
@@ -115,6 +115,37 @@ describe("managed attachment Markdown", () => {
);
});
+ it("removes images inside quotes, lists and table cells at their place in the source", () => {
+ const content = [
+ "> quote ![a](/file/attachments/remove-me) end",
+ "> - item ![b](/file/attachments/remove-me)",
+ "",
+ "| x | y |",
+ "| --- | --- |",
+ "| ![c](/file/attachments/remove-me) | ![d](/file/attachments/keep-me) |",
+ ].join("\n");
+
+ expect(removeManagedAttachmentReferences(content, new Set(["remove-me"]))).toBe(
+ ["> quote end", "> - item ", "", "| x | y |", "| --- | --- |", "| | ![d](/file/attachments/keep-me) |"].join("\n"),
+ );
+ });
+
+ it("reports the first invalid reference in document order, HTML included", () => {
+ const content = [
+ 'Inline <img src="/file/attachments/a">',
+ "",
+ "![bad](/file/attachments/a?x=1)",
+ "",
+ "<div>/file/attachments/b</div>",
+ ].join("\n");
+
+ expect(findInvalidManagedAttachmentReferences(content)).toEqual([
+ '<img src="/file/attachments/a">',
+ "/file/attachments/a?x=1",
+ "<div>/file/attachments/b</div>",
+ ]);
+ });
+
it("filters the entire motion group when its still image is inline", () => {
const motion = create(MotionMediaSchema, {
family: MotionMediaFamily.APPLE_LIVE_PHOTO,
diff --git a/web/tests/markdown-task-actions.test.ts b/web/tests/markdown-task-actions.test.ts
index 11c0cfe99..e087dd34c 100644
--- a/web/tests/markdown-task-actions.test.ts
+++ b/web/tests/markdown-task-actions.test.ts
@@ -37,4 +37,12 @@ describe("uncheckAllTasks", () => {
["```", "- [x] not a task", "```", "", "Inline `- [x] not a task` text", "", "- [ ] real task"].join("\n"),
);
});
+
+ it("changes the marker of tasks in quotes and of a task that opens a nested list", () => {
+ const markdown = ["> - [x] quoted", "> - [X] nested", "", "- - [x] inner", "", "> ```", "> - [x] code", "> ```"].join("\n");
+
+ expect(uncheckAllTasks(markdown)).toBe(
+ ["> - [ ] quoted", "> - [ ] nested", "", "- - [ ] inner", "", "> ```", "> - [x] code", "> ```"].join("\n"),
+ );
+ });
});
diff --git a/web/tests/memo-content-security.test.ts b/web/tests/memo-content-security.test.ts
index 08ee9e9cd..09dace97a 100644
--- a/web/tests/memo-content-security.test.ts
+++ b/web/tests/memo-content-security.test.ts
@@ -2,12 +2,15 @@ import { create } from "@bufbuild/protobuf";
import { describe, expect, it } from "vitest";
import { isTrustedIframeSrc } from "@/lib/html-sanitize-schema";
import { memoResolveUrl } from "@/lib/memo-markdown";
-import { renderSanitizedHtml } from "@/lib/sanitized-html";
+import { sanitizeMemoHtml } from "@/lib/sanitized-html";
import { AttachmentSchema } from "@/types/proto/api/attachment_service_pb";
+// As the editor hands raw HTML to `sanitizeHtml`: parsed by the browser into a fragment that is not in the page.
const renderHtml = (source: string): string => {
+ const template = document.createElement("template");
+ template.innerHTML = source;
const element = document.createElement("div");
- renderSanitizedHtml(source, element);
+ element.append(sanitizeMemoHtml(template.content));
return element.innerHTML;
};
@@ -79,11 +82,32 @@ describe("raw HTML sanitization", () => {
expect(renderHtml('<iframe src="http://player.bilibili.com/player.html?bvid=BV1xx411c7mD"></iframe>')).not.toMatch(/<iframe/);
});
- it("renders Markdown between disclosure tags and keeps the authored open state", () => {
- const html = renderHtml("<details open>\n<summary>More <b>info</b></summary>\n\nSome **bold** text\n\n</details>");
+ it("keeps the disclosure's open state and the editor's markers for the Markdown between the tags", () => {
+ const html = renderHtml("<details open>\n<summary>More <b>info</b></summary>\n\uE000\n</details>");
expect(html).toMatch(/<details[^>]* open=""/);
expect(html).toMatch(/<summary[^>]*>More <b>info<\/b><\/summary>/);
- expect(html).toContain("<strong>bold</strong>");
+ expect(html).toContain("\uE000");
+ });
+
+ it("keeps the text of removed elements but never a script's", () => {
+ const html = renderHtml("<marquee>\uE001 moving</marquee><script>alert(1)</script><style>p{}</style>");
+ expect(html).toBe("\uE001 moving");
+ });
+
+ it("keeps only the allowed class names and the span data the tag and mention classes use", () => {
+ expect(renderHtml('<span class="tag evil" data-tag="work" aria-label="tag">#work</span>')).toBe(
+ '<span class="tag" data-tag="work" aria-label="tag">#work</span>',
+ );
+ expect(renderHtml('<div class="fixed inset-0" data-x="1" aria-hidden="true">a</div>')).toBe("<div>a</div>");
+ expect(renderHtml('<code class="language-ts math-inline">x</code>')).toBe('<code class="language-ts math-inline">x</code>');
+ });
+
+ it("keeps heading and footnote ids as written", () => {
+ expect(renderHtml('<h2 id="setup">Setup</h2><a href="#fn-1" id="ref-1">1</a>')).toMatch(/id="setup".*href="#fn-1" id="ref-1"/);
+ });
+
+ it("makes checkboxes read-only checkboxes", () => {
+ expect(renderHtml('<input type="text" checked value="x">')).toMatch(/<input[^>]* type="checkbox"[^>]* disabled=""/);
});
});
diff --git a/web/tests/memo-content-view.test.tsx b/web/tests/memo-content-view.test.tsx
index f59d2599d..79ab4edcb 100644
--- a/web/tests/memo-content-view.test.tsx
+++ b/web/tests/memo-content-view.test.tsx
@@ -75,6 +75,15 @@ describe("memo view", () => {
await waitFor(() => expect(onTaskToggle).toHaveBeenCalledWith("- [x] First\n- [x] Second\n\nNote"));
});
+ it("lets an owner tick a task in a quote, changing only its bracket", async () => {
+ const onTaskToggle = vi.fn();
+ const content = "- [ ] First\n\n> - [ ] Quoted\n> - [ ] Nested";
+ const { container } = renderMemo(content, { onTaskToggle });
+ const checkboxes = container.querySelectorAll<HTMLInputElement>("input.mbe-checkbox");
+ fireEvent.mouseDown(checkboxes[2]!);
+ await waitFor(() => expect(onTaskToggle).toHaveBeenCalledWith("- [ ] First\n\n> - [ ] Quoted\n> - [x] Nested"));
+ });
+
it("keeps tasks locked for readers", () => {
const { container } = renderMemo("- [ ] First");
expect(container.querySelector("input.mbe-checkbox")).toBeDisabled();
@@ -186,6 +195,32 @@ describe("raw HTML", () => {
expect(container.querySelector("summary em")).toHaveTextContent("more");
expect(screen.getByText("Supporting text.")).toBeInTheDocument();
});
+
+ it("renders Markdown between disclosure tags inside the one section", async () => {
+ const { container } = renderMemo("<details>\n<summary>x</summary>\n\n**bold**\n\n</details>");
+ expect(container.querySelectorAll(".mbe-details")).toHaveLength(1);
+ expect(container.querySelector(".mbe-details")).toHaveTextContent("x");
+ expect(container.querySelector("[data-in-section] strong")).toHaveTextContent("bold");
+ expect(container).not.toHaveTextContent("<details>");
+ });
+
+ it("renders Markdown between HTML tags inside the one element", async () => {
+ const { container } = renderMemo('<div align="center">\n\n**bold**\n\n</div>');
+ await waitFor(() => expect(container.querySelector('div[align="center"] strong')).toHaveTextContent("bold"));
+ expect(container.querySelectorAll('div[align="center"]')).toHaveLength(1);
+ expect(container).not.toHaveTextContent("<div");
+ });
+
+ it("keeps trusted embeds and drops other iframes, handlers and scripts", async () => {
+ const { container } = renderMemo(
+ '<iframe src="https://www.youtube.com/embed/abc123"></iframe>\n\n<iframe src="https://evil.example/embed"></iframe>\n\n<div onclick="alert(1)">hi</div>\n\n<script>alert(2)</script>',
+ );
+ await waitFor(() => expect(container.querySelector('iframe[src^="https://www.youtube.com/embed/abc123"]')).not.toBeNull());
+ expect(container.querySelectorAll("iframe")).toHaveLength(1);
+ expect(container.querySelector("[onclick]")).toBeNull();
+ expect(container.querySelector("script")).toBeNull();
+ expect(container).not.toHaveTextContent("alert");
+ });
});
describe("callouts and collapsible sections", () => {