Commit ad3b40d538

ad3b40d538e56f19c73514de03728d8dde6738d8

parent: 953be6a195

Unregistered key

Ulyssa <git@ulyssa.dev> · 2023-04-06 23:10 UTC

Interpret newlines as line breaks when converting Markdown to HTML (#74)

Layout: unified · split

Cargo.lock +354 −32
@@ -215,6 +215,30 @@ version = "1.6.0"
215source = "registry+https://github.com/rust-lang/crates.io-index" 215source = "registry+https://github.com/rust-lang/crates.io-index"
216checksum = "8c3c1a368f70d6cf7302d78f8f7093da241fb8e8807c05cc9e51a125895a6d5b" 216checksum = "8c3c1a368f70d6cf7302d78f8f7093da241fb8e8807c05cc9e51a125895a6d5b"
217 217
218[[package]]
219name = "bincode"
220version = "1.3.3"
221source = "registry+https://github.com/rust-lang/crates.io-index"
222checksum = "b1f45e9417d87227c7a56d22e471c6206462cba514c7590c09aff4cf6d1ddcad"
223dependencies = [
224 "serde",
225]
226
227[[package]]
228name = "bit-set"
229version = "0.5.3"
230source = "registry+https://github.com/rust-lang/crates.io-index"
231checksum = "0700ddab506f33b20a03b13996eccd309a48e5ff77d0d95926aa0210fb4e95f1"
232dependencies = [
233 "bit-vec",
234]
235
236[[package]]
237name = "bit-vec"
238version = "0.6.3"
239source = "registry+https://github.com/rust-lang/crates.io-index"
240checksum = "349f9b6a179ed607305526ca489b34ad0a41aed5f7980fa90eb03160b69598fb"
241
218[[package]] 242[[package]]
219name = "bitflags" 243name = "bitflags"
220version = "1.3.2" 244version = "1.3.2"
@@ -397,6 +421,7 @@ dependencies = [
397 "once_cell", 421 "once_cell",
398 "strsim", 422 "strsim",
399 "termcolor", 423 "termcolor",
424 "terminal_size",
400] 425]
401 426
402[[package]] 427[[package]]
@@ -456,6 +481,25 @@ version = "1.1.0"
456source = "registry+https://github.com/rust-lang/crates.io-index" 481source = "registry+https://github.com/rust-lang/crates.io-index"
457checksum = "3d7b894f5411737b7867f4827955924d7c254fc9f4d91a6aad6b097804b1018b" 482checksum = "3d7b894f5411737b7867f4827955924d7c254fc9f4d91a6aad6b097804b1018b"
458 483
484[[package]]
485name = "comrak"
486version = "0.18.0"
487source = "registry+https://github.com/rust-lang/crates.io-index"
488checksum = "482aa5695bca086022be453c700a40c02893f1ba7098a2c88351de55341ae894"
489dependencies = [
490 "clap",
491 "entities",
492 "memchr",
493 "once_cell",
494 "regex",
495 "shell-words",
496 "slug",
497 "syntect",
498 "typed-arena",
499 "unicode_categories",
500 "xdg",
501]
502
459[[package]] 503[[package]]
460name = "const-oid" 504name = "const-oid"
461version = "0.7.1" 505version = "0.7.1"
@@ -777,6 +821,12 @@ dependencies = [
777 "syn 1.0.109", 821 "syn 1.0.109",
778] 822]
779 823
824[[package]]
825name = "deunicode"
826version = "0.4.3"
827source = "registry+https://github.com/rust-lang/crates.io-index"
828checksum = "850878694b7933ca4c9569d30a34b55031b9b139ee1fc7b94a527c4ef960d690"
829
780[[package]] 830[[package]]
781name = "digest" 831name = "digest"
782version = "0.9.0" 832version = "0.9.0"
@@ -889,6 +939,12 @@ version = "0.1.2"
889source = "registry+https://github.com/rust-lang/crates.io-index" 939source = "registry+https://github.com/rust-lang/crates.io-index"
890checksum = "c34f04666d835ff5d62e058c3995147c06f42fe86ff053337632bca83e42702d" 940checksum = "c34f04666d835ff5d62e058c3995147c06f42fe86ff053337632bca83e42702d"
891 941
942[[package]]
943name = "entities"
944version = "1.0.1"
945source = "registry+https://github.com/rust-lang/crates.io-index"
946checksum = "b5320ae4c3782150d900b79807611a59a99fc9a1d61d686faafc24b93fc8d7ca"
947
892[[package]] 948[[package]]
893name = "errno" 949name = "errno"
894version = "0.2.8" 950version = "0.2.8"
@@ -900,6 +956,17 @@ dependencies = [
900 "winapi", 956 "winapi",
901] 957]
902 958
959[[package]]
960name = "errno"
961version = "0.3.0"
962source = "registry+https://github.com/rust-lang/crates.io-index"
963checksum = "50d6a0976c999d473fe89ad888d5a284e55366d9dc9038b1ba2aa15128c4afa0"
964dependencies = [
965 "errno-dragonfly",
966 "libc",
967 "windows-sys 0.45.0",
968]
969
903[[package]] 970[[package]]
904name = "errno-dragonfly" 971name = "errno-dragonfly"
905version = "0.1.2" 972version = "0.1.2"
@@ -926,6 +993,16 @@ version = "2.5.3"
926source = "registry+https://github.com/rust-lang/crates.io-index" 993source = "registry+https://github.com/rust-lang/crates.io-index"
927checksum = "0206175f82b8d6bf6652ff7d71a1e27fd2e4efde587fd368662814d6ec1d9ce0" 994checksum = "0206175f82b8d6bf6652ff7d71a1e27fd2e4efde587fd368662814d6ec1d9ce0"
928 995
996[[package]]
997name = "fancy-regex"
998version = "0.7.1"
999source = "registry+https://github.com/rust-lang/crates.io-index"
1000checksum = "9d6b8560a05112eb52f04b00e5d3790c0dd75d9d980eb8a122fb23b92a623ccf"
1001dependencies = [
1002 "bit-set",
1003 "regex",
1004]
1005
929[[package]] 1006[[package]]
930name = "flate2" 1007name = "flate2"
931version = "1.0.25" 1008version = "1.0.25"
@@ -1337,6 +1414,7 @@ dependencies = [
1337 "bitflags 1.3.2", 1414 "bitflags 1.3.2",
1338 "chrono", 1415 "chrono",
1339 "clap", 1416 "clap",
1417 "comrak",
1340 "css-color-parser", 1418 "css-color-parser",
1341 "dirs", 1419 "dirs",
1342 "emojis", 1420 "emojis",
@@ -1499,7 +1577,7 @@ checksum = "8687c819457e979cc940d09cb16e42a1bf70aa6b60a549de6d3a62a0ee90c69e"
1499dependencies = [ 1577dependencies = [
1500 "hermit-abi 0.3.1", 1578 "hermit-abi 0.3.1",
1501 "io-lifetimes", 1579 "io-lifetimes",
1502 "rustix", 1580 "rustix 0.36.11",
1503 "windows-sys 0.45.0", 1581 "windows-sys 0.45.0",
1504] 1582]
1505 1583
@@ -1569,6 +1647,15 @@ version = "0.2.140"
1569source = "registry+https://github.com/rust-lang/crates.io-index" 1647source = "registry+https://github.com/rust-lang/crates.io-index"
1570checksum = "99227334921fae1a979cf0bfdfcc6b3e5ce376ef57e16fb6fb3ea2ed6095f80c" 1648checksum = "99227334921fae1a979cf0bfdfcc6b3e5ce376ef57e16fb6fb3ea2ed6095f80c"
1571 1649
1650[[package]]
1651name = "line-wrap"
1652version = "0.1.1"
1653source = "registry+https://github.com/rust-lang/crates.io-index"
1654checksum = "f30344350a2a51da54c1d53be93fade8a237e545dbcc4bdbe635413f2117cab9"
1655dependencies = [
1656 "safemem",
1657]
1658
1572[[package]] 1659[[package]]
1573name = "link-cplusplus" 1660name = "link-cplusplus"
1574version = "1.0.8" 1661version = "1.0.8"
@@ -1578,12 +1665,24 @@ dependencies = [
1578 "cc", 1665 "cc",
1579] 1666]
1580 1667
1668[[package]]
1669name = "linked-hash-map"
1670version = "0.5.6"
1671source = "registry+https://github.com/rust-lang/crates.io-index"
1672checksum = "0717cef1bc8b636c6e1c1bbdefc09e6322da8a9321966e8928ef80d20f7f770f"
1673
1581[[package]] 1674[[package]]
1582name = "linux-raw-sys" 1675name = "linux-raw-sys"
1583version = "0.1.4" 1676version = "0.1.4"
1584source = "registry+https://github.com/rust-lang/crates.io-index" 1677source = "registry+https://github.com/rust-lang/crates.io-index"
1585checksum = "f051f77a7c8e6957c0696eac88f26b0117e54f52d3fc682ab19397a8812846a4" 1678checksum = "f051f77a7c8e6957c0696eac88f26b0117e54f52d3fc682ab19397a8812846a4"
1586 1679
1680[[package]]
1681name = "linux-raw-sys"
1682version = "0.3.1"
1683source = "registry+https://github.com/rust-lang/crates.io-index"
1684checksum = "d59d8c75012853d2e872fb56bc8a2e53718e2cafe1a4c823143141c6d90c322f"
1685
1587[[package]] 1686[[package]]
1588name = "lock_api" 1687name = "lock_api"
1589version = "0.4.9" 1688version = "0.4.9"
@@ -2049,6 +2148,28 @@ version = "1.17.1"
2049source = "registry+https://github.com/rust-lang/crates.io-index" 2148source = "registry+https://github.com/rust-lang/crates.io-index"
2050checksum = "b7e5500299e16ebb147ae15a00a942af264cf3688f47923b8fc2cd5858f23ad3" 2149checksum = "b7e5500299e16ebb147ae15a00a942af264cf3688f47923b8fc2cd5858f23ad3"
2051 2150
2151[[package]]
2152name = "onig"
2153version = "6.4.0"
2154source = "registry+https://github.com/rust-lang/crates.io-index"
2155checksum = "8c4b31c8722ad9171c6d77d3557db078cab2bd50afcc9d09c8b315c59df8ca4f"
2156dependencies = [
2157 "bitflags 1.3.2",
2158 "libc",
2159 "once_cell",
2160 "onig_sys",
2161]
2162
2163[[package]]
2164name = "onig_sys"
2165version = "69.8.1"
2166source = "registry+https://github.com/rust-lang/crates.io-index"
2167checksum = "7b829e3d7e9cc74c7e315ee8edb185bf4190da5acde74afd7fc59c35b1f086e7"
2168dependencies = [
2169 "cc",
2170 "pkg-config",
2171]
2172
2052[[package]] 2173[[package]]
2053name = "opaque-debug" 2174name = "opaque-debug"
2054version = "0.3.0" 2175version = "0.3.0"
@@ -2258,6 +2379,26 @@ dependencies = [
2258 "spki", 2379 "spki",
2259] 2380]
2260 2381
2382[[package]]
2383name = "pkg-config"
2384version = "0.3.26"
2385source = "registry+https://github.com/rust-lang/crates.io-index"
2386checksum = "6ac9a59f73473f1b8d852421e59e64809f025994837ef743615c6d0c5b305160"
2387
2388[[package]]
2389name = "plist"
2390version = "1.4.3"
2391source = "registry+https://github.com/rust-lang/crates.io-index"
2392checksum = "9bd9647b268a3d3e14ff09c23201133a62589c658db02bb7388c7246aafe0590"
2393dependencies = [
2394 "base64 0.21.0",
2395 "indexmap",
2396 "line-wrap",
2397 "quick-xml",
2398 "serde",
2399 "time 0.3.20",
2400]
2401
2261[[package]] 2402[[package]]
2262name = "png" 2403name = "png"
2263version = "0.17.7" 2404version = "0.17.7"
@@ -2345,14 +2486,12 @@ dependencies = [
2345] 2486]
2346 2487
2347[[package]] 2488[[package]]
2348name = "pulldown-cmark" 2489name = "quick-xml"
2349version = "0.9.2" 2490version = "0.28.1"
2350source = "registry+https://github.com/rust-lang/crates.io-index" 2491source = "registry+https://github.com/rust-lang/crates.io-index"
2351checksum = "2d9cc634bc78768157b5cbfe988ffcd1dcba95cd2b2f03a88316c08c6d00ed63" 2492checksum = "e5c1a97b1bc42b1d550bfb48d4262153fe400a12bab1511821736f7eac76d7e2"
2352dependencies = [ 2493dependencies = [
2353 "bitflags 1.3.2",
2354 "memchr", 2494 "memchr",
2355 "unicase",
2356] 2495]
2357 2496
2358[[package]] 2497[[package]]
@@ -2739,7 +2878,6 @@ dependencies = [
2739 "js_int", 2878 "js_int",
2740 "js_option", 2879 "js_option",
2741 "percent-encoding", 2880 "percent-encoding",
2742 "pulldown-cmark",
2743 "rand 0.8.5", 2881 "rand 0.8.5",
2744 "regex", 2882 "regex",
2745 "ruma-identifiers-validation", 2883 "ruma-identifiers-validation",
@@ -2807,10 +2945,24 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
2807checksum = "db4165c9963ab29e422d6c26fbc1d37f15bace6b2810221f9d925023480fcf0e" 2945checksum = "db4165c9963ab29e422d6c26fbc1d37f15bace6b2810221f9d925023480fcf0e"
2808dependencies = [ 2946dependencies = [
2809 "bitflags 1.3.2", 2947 "bitflags 1.3.2",
2810 "errno", 2948 "errno 0.2.8",
2811 "io-lifetimes", 2949 "io-lifetimes",
2812 "libc", 2950 "libc",
2813 "linux-raw-sys", 2951 "linux-raw-sys 0.1.4",
2952 "windows-sys 0.45.0",
2953]
2954
2955[[package]]
2956name = "rustix"
2957version = "0.37.7"
2958source = "registry+https://github.com/rust-lang/crates.io-index"
2959checksum = "2aae838e49b3d63e9274e1c01833cc8139d3fec468c3b84688c628f44b1ae11d"
2960dependencies = [
2961 "bitflags 1.3.2",
2962 "errno 0.3.0",
2963 "io-lifetimes",
2964 "libc",
2965 "linux-raw-sys 0.3.1",
2814 "windows-sys 0.45.0", 2966 "windows-sys 0.45.0",
2815] 2967]
2816 2968
@@ -2841,6 +2993,21 @@ version = "1.0.13"
2841source = "registry+https://github.com/rust-lang/crates.io-index" 2993source = "registry+https://github.com/rust-lang/crates.io-index"
2842checksum = "f91339c0467de62360649f8d3e185ca8de4224ff281f66000de5eb2a77a79041" 2994checksum = "f91339c0467de62360649f8d3e185ca8de4224ff281f66000de5eb2a77a79041"
2843 2995
2996[[package]]
2997name = "safemem"
2998version = "0.3.3"
2999source = "registry+https://github.com/rust-lang/crates.io-index"
3000checksum = "ef703b7cb59335eae2eb93ceb664c0eb7ea6bf567079d843e09420219668e072"
3001
3002[[package]]
3003name = "same-file"
3004version = "1.0.6"
3005source = "registry+https://github.com/rust-lang/crates.io-index"
3006checksum = "93fc1dc3aaa9bfed95e02e6eadabb4baf7e3078b0bd1b4d7b6b0b68378900502"
3007dependencies = [
3008 "winapi-util",
3009]
3010
2844[[package]] 3011[[package]]
2845name = "scopeguard" 3012name = "scopeguard"
2846version = "1.1.0" 3013version = "1.1.0"
@@ -2954,6 +3121,12 @@ dependencies = [
2954 "lazy_static 1.4.0", 3121 "lazy_static 1.4.0",
2955] 3122]
2956 3123
3124[[package]]
3125name = "shell-words"
3126version = "1.1.0"
3127source = "registry+https://github.com/rust-lang/crates.io-index"
3128checksum = "24188a676b6ae68c3b2cb3a01be17fbf7240ce009799bb56d5b1409051e78fde"
3129
2957[[package]] 3130[[package]]
2958name = "signal-hook" 3131name = "signal-hook"
2959version = "0.3.15" 3132version = "0.3.15"
@@ -3021,6 +3194,15 @@ dependencies = [
3021 "parking_lot 0.11.2", 3194 "parking_lot 0.11.2",
3022] 3195]
3023 3196
3197[[package]]
3198name = "slug"
3199version = "0.1.4"
3200source = "registry+https://github.com/rust-lang/crates.io-index"
3201checksum = "b3bc762e6a4b6c6fcaade73e77f9ebc6991b676f88bb2358bddb56560f073373"
3202dependencies = [
3203 "deunicode",
3204]
3205
3024[[package]] 3206[[package]]
3025name = "smallvec" 3207name = "smallvec"
3026version = "1.10.0" 3208version = "1.10.0"
@@ -3147,6 +3329,30 @@ dependencies = [
3147 "unicode-xid 0.2.4", 3329 "unicode-xid 0.2.4",
3148] 3330]
3149 3331
3332[[package]]
3333name = "syntect"
3334version = "5.0.0"
3335source = "registry+https://github.com/rust-lang/crates.io-index"
3336checksum = "c6c454c27d9d7d9a84c7803aaa3c50cd088d2906fe3c6e42da3209aa623576a8"
3337dependencies = [
3338 "bincode",
3339 "bitflags 1.3.2",
3340 "fancy-regex",
3341 "flate2",
3342 "fnv",
3343 "lazy_static 1.4.0",
3344 "once_cell",
3345 "onig",
3346 "plist",
3347 "regex-syntax",
3348 "serde",
3349 "serde_derive",
3350 "serde_json",
3351 "thiserror",
3352 "walkdir",
3353 "yaml-rust",
3354]
3355
3150[[package]] 3356[[package]]
3151name = "tendril" 3357name = "tendril"
3152version = "0.4.3" 3358version = "0.4.3"
@@ -3167,6 +3373,16 @@ dependencies = [
3167 "winapi-util", 3373 "winapi-util",
3168] 3374]
3169 3375
3376[[package]]
3377name = "terminal_size"
3378version = "0.2.6"
3379source = "registry+https://github.com/rust-lang/crates.io-index"
3380checksum = "8e6bf6f19e9f8ed8d4048dc22981458ebcf406d67e94cd422e5ecd73d63b3237"
3381dependencies = [
3382 "rustix 0.37.7",
3383 "windows-sys 0.48.0",
3384]
3385
3170[[package]] 3386[[package]]
3171name = "thiserror" 3387name = "thiserror"
3172version = "1.0.40" 3388version = "1.0.40"
@@ -3435,6 +3651,12 @@ dependencies = [
3435 "unicode-width", 3651 "unicode-width",
3436] 3652]
3437 3653
3654[[package]]
3655name = "typed-arena"
3656version = "2.0.2"
3657source = "registry+https://github.com/rust-lang/crates.io-index"
3658checksum = "6af6ae20167a9ece4bcb41af5b80f8a1f1df981f6391189ce00fd257af04126a"
3659
3438[[package]] 3660[[package]]
3439name = "typenum" 3661name = "typenum"
3440version = "1.16.0" 3662version = "1.16.0"
@@ -3495,6 +3717,12 @@ version = "0.2.4"
3495source = "registry+https://github.com/rust-lang/crates.io-index" 3717source = "registry+https://github.com/rust-lang/crates.io-index"
3496checksum = "f962df74c8c05a667b5ee8bcf162993134c104e96440b663c8daa176dc772d8c" 3718checksum = "f962df74c8c05a667b5ee8bcf162993134c104e96440b663c8daa176dc772d8c"
3497 3719
3720[[package]]
3721name = "unicode_categories"
3722version = "0.1.1"
3723source = "registry+https://github.com/rust-lang/crates.io-index"
3724checksum = "39ec24b3121d976906ece63c9daad25b85969647682eee313cb5779fdd69e14e"
3725
3498[[package]] 3726[[package]]
3499name = "universal-hash" 3727name = "universal-hash"
3500version = "0.4.1" 3728version = "0.4.1"
@@ -3594,6 +3822,16 @@ dependencies = [
3594 "zeroize", 3822 "zeroize",
3595] 3823]
3596 3824
3825[[package]]
3826name = "walkdir"
3827version = "2.3.3"
3828source = "registry+https://github.com/rust-lang/crates.io-index"
3829checksum = "36df944cda56c7d8d8b7496af378e6b16de9284591917d307c9b4d313c44e698"
3830dependencies = [
3831 "same-file",
3832 "winapi-util",
3833]
3834
3597[[package]] 3835[[package]]
3598name = "want" 3836name = "want"
3599version = "0.3.0" 3837version = "0.3.0"
@@ -3792,13 +4030,13 @@ version = "0.43.0"
3792source = "registry+https://github.com/rust-lang/crates.io-index" 4030source = "registry+https://github.com/rust-lang/crates.io-index"
3793checksum = "04662ed0e3e5630dfa9b26e4cb823b817f1a9addda855d973a9458c236556244" 4031checksum = "04662ed0e3e5630dfa9b26e4cb823b817f1a9addda855d973a9458c236556244"
3794dependencies = [ 4032dependencies = [
3795 "windows_aarch64_gnullvm", 4033 "windows_aarch64_gnullvm 0.42.2",
3796 "windows_aarch64_msvc", 4034 "windows_aarch64_msvc 0.42.2",
3797 "windows_i686_gnu", 4035 "windows_i686_gnu 0.42.2",
3798 "windows_i686_msvc", 4036 "windows_i686_msvc 0.42.2",
3799 "windows_x86_64_gnu", 4037 "windows_x86_64_gnu 0.42.2",
3800 "windows_x86_64_gnullvm", 4038 "windows_x86_64_gnullvm 0.42.2",
3801 "windows_x86_64_msvc", 4039 "windows_x86_64_msvc 0.42.2",
3802] 4040]
3803 4041
3804[[package]] 4042[[package]]
@@ -3807,7 +4045,7 @@ version = "0.46.0"
3807source = "registry+https://github.com/rust-lang/crates.io-index" 4045source = "registry+https://github.com/rust-lang/crates.io-index"
3808checksum = "cdacb41e6a96a052c6cb63a144f24900236121c6f63f4f8219fef5977ecb0c25" 4046checksum = "cdacb41e6a96a052c6cb63a144f24900236121c6f63f4f8219fef5977ecb0c25"
3809dependencies = [ 4047dependencies = [
3810 "windows-targets", 4048 "windows-targets 0.42.2",
3811] 4049]
3812 4050
3813[[package]] 4051[[package]]
@@ -3816,13 +4054,13 @@ version = "0.42.0"
3816source = "registry+https://github.com/rust-lang/crates.io-index" 4054source = "registry+https://github.com/rust-lang/crates.io-index"
3817checksum = "5a3e1820f08b8513f676f7ab6c1f99ff312fb97b553d30ff4dd86f9f15728aa7" 4055checksum = "5a3e1820f08b8513f676f7ab6c1f99ff312fb97b553d30ff4dd86f9f15728aa7"
3818dependencies = [ 4056dependencies = [
3819 "windows_aarch64_gnullvm", 4057 "windows_aarch64_gnullvm 0.42.2",
3820 "windows_aarch64_msvc", 4058 "windows_aarch64_msvc 0.42.2",
3821 "windows_i686_gnu", 4059 "windows_i686_gnu 0.42.2",
3822 "windows_i686_msvc", 4060 "windows_i686_msvc 0.42.2",
3823 "windows_x86_64_gnu", 4061 "windows_x86_64_gnu 0.42.2",
3824 "windows_x86_64_gnullvm", 4062 "windows_x86_64_gnullvm 0.42.2",
3825 "windows_x86_64_msvc", 4063 "windows_x86_64_msvc 0.42.2",
3826] 4064]
3827 4065
3828[[package]] 4066[[package]]
@@ -3831,7 +4069,16 @@ version = "0.45.0"
3831source = "registry+https://github.com/rust-lang/crates.io-index" 4069source = "registry+https://github.com/rust-lang/crates.io-index"
3832checksum = "75283be5efb2831d37ea142365f009c02ec203cd29a3ebecbc093d52315b66d0" 4070checksum = "75283be5efb2831d37ea142365f009c02ec203cd29a3ebecbc093d52315b66d0"
3833dependencies = [ 4071dependencies = [
3834 "windows-targets", 4072 "windows-targets 0.42.2",
4073]
4074
4075[[package]]
4076name = "windows-sys"
4077version = "0.48.0"
4078source = "registry+https://github.com/rust-lang/crates.io-index"
4079checksum = "677d2418bec65e3338edb076e806bc1ec15693c5d0104683f2efe857f61056a9"
4080dependencies = [
4081 "windows-targets 0.48.0",
3835] 4082]
3836 4083
3837[[package]] 4084[[package]]
@@ -3840,13 +4087,28 @@ version = "0.42.2"
3840source = "registry+https://github.com/rust-lang/crates.io-index" 4087source = "registry+https://github.com/rust-lang/crates.io-index"
3841checksum = "8e5180c00cd44c9b1c88adb3693291f1cd93605ded80c250a75d472756b4d071" 4088checksum = "8e5180c00cd44c9b1c88adb3693291f1cd93605ded80c250a75d472756b4d071"
3842dependencies = [ 4089dependencies = [
3843 "windows_aarch64_gnullvm", 4090 "windows_aarch64_gnullvm 0.42.2",
3844 "windows_aarch64_msvc", 4091 "windows_aarch64_msvc 0.42.2",
3845 "windows_i686_gnu", 4092 "windows_i686_gnu 0.42.2",
3846 "windows_i686_msvc", 4093 "windows_i686_msvc 0.42.2",
3847 "windows_x86_64_gnu", 4094 "windows_x86_64_gnu 0.42.2",
3848 "windows_x86_64_gnullvm", 4095 "windows_x86_64_gnullvm 0.42.2",
3849 "windows_x86_64_msvc", 4096 "windows_x86_64_msvc 0.42.2",
4097]
4098
4099[[package]]
4100name = "windows-targets"
4101version = "0.48.0"
4102source = "registry+https://github.com/rust-lang/crates.io-index"
4103checksum = "7b1eb6f0cd7c80c79759c929114ef071b87354ce476d9d94271031c0497adfd5"
4104dependencies = [
4105 "windows_aarch64_gnullvm 0.48.0",
4106 "windows_aarch64_msvc 0.48.0",
4107 "windows_i686_gnu 0.48.0",
4108 "windows_i686_msvc 0.48.0",
4109 "windows_x86_64_gnu 0.48.0",
4110 "windows_x86_64_gnullvm 0.48.0",
4111 "windows_x86_64_msvc 0.48.0",
3850] 4112]
3851 4113
3852[[package]] 4114[[package]]
@@ -3855,42 +4117,84 @@ version = "0.42.2"
3855source = "registry+https://github.com/rust-lang/crates.io-index" 4117source = "registry+https://github.com/rust-lang/crates.io-index"
3856checksum = "597a5118570b68bc08d8d59125332c54f1ba9d9adeedeef5b99b02ba2b0698f8" 4118checksum = "597a5118570b68bc08d8d59125332c54f1ba9d9adeedeef5b99b02ba2b0698f8"
3857 4119
4120[[package]]
4121name = "windows_aarch64_gnullvm"
4122version = "0.48.0"
4123source = "registry+https://github.com/rust-lang/crates.io-index"
4124checksum = "91ae572e1b79dba883e0d315474df7305d12f569b400fcf90581b06062f7e1bc"
4125
3858[[package]] 4126[[package]]
3859name = "windows_aarch64_msvc" 4127name = "windows_aarch64_msvc"
3860version = "0.42.2" 4128version = "0.42.2"
3861source = "registry+https://github.com/rust-lang/crates.io-index" 4129source = "registry+https://github.com/rust-lang/crates.io-index"
3862checksum = "e08e8864a60f06ef0d0ff4ba04124db8b0fb3be5776a5cd47641e942e58c4d43" 4130checksum = "e08e8864a60f06ef0d0ff4ba04124db8b0fb3be5776a5cd47641e942e58c4d43"
3863 4131
4132[[package]]
4133name = "windows_aarch64_msvc"
4134version = "0.48.0"
4135source = "registry+https://github.com/rust-lang/crates.io-index"
4136checksum = "b2ef27e0d7bdfcfc7b868b317c1d32c641a6fe4629c171b8928c7b08d98d7cf3"
4137
3864[[package]] 4138[[package]]
3865name = "windows_i686_gnu" 4139name = "windows_i686_gnu"
3866version = "0.42.2" 4140version = "0.42.2"
3867source = "registry+https://github.com/rust-lang/crates.io-index" 4141source = "registry+https://github.com/rust-lang/crates.io-index"
3868checksum = "c61d927d8da41da96a81f029489353e68739737d3beca43145c8afec9a31a84f" 4142checksum = "c61d927d8da41da96a81f029489353e68739737d3beca43145c8afec9a31a84f"
3869 4143
4144[[package]]
4145name = "windows_i686_gnu"
4146version = "0.48.0"
4147source = "registry+https://github.com/rust-lang/crates.io-index"
4148checksum = "622a1962a7db830d6fd0a69683c80a18fda201879f0f447f065a3b7467daa241"
4149
3870[[package]] 4150[[package]]
3871name = "windows_i686_msvc" 4151name = "windows_i686_msvc"
3872version = "0.42.2" 4152version = "0.42.2"
3873source = "registry+https://github.com/rust-lang/crates.io-index" 4153source = "registry+https://github.com/rust-lang/crates.io-index"
3874checksum = "44d840b6ec649f480a41c8d80f9c65108b92d89345dd94027bfe06ac444d1060" 4154checksum = "44d840b6ec649f480a41c8d80f9c65108b92d89345dd94027bfe06ac444d1060"
3875 4155
4156[[package]]
4157name = "windows_i686_msvc"
4158version = "0.48.0"
4159source = "registry+https://github.com/rust-lang/crates.io-index"
4160checksum = "4542c6e364ce21bf45d69fdd2a8e455fa38d316158cfd43b3ac1c5b1b19f8e00"
4161
3876[[package]] 4162[[package]]
3877name = "windows_x86_64_gnu" 4163name = "windows_x86_64_gnu"
3878version = "0.42.2" 4164version = "0.42.2"
3879source = "registry+https://github.com/rust-lang/crates.io-index" 4165source = "registry+https://github.com/rust-lang/crates.io-index"
3880checksum = "8de912b8b8feb55c064867cf047dda097f92d51efad5b491dfb98f6bbb70cb36" 4166checksum = "8de912b8b8feb55c064867cf047dda097f92d51efad5b491dfb98f6bbb70cb36"
3881 4167
4168[[package]]
4169name = "windows_x86_64_gnu"
4170version = "0.48.0"
4171source = "registry+https://github.com/rust-lang/crates.io-index"
4172checksum = "ca2b8a661f7628cbd23440e50b05d705db3686f894fc9580820623656af974b1"
4173
3882[[package]] 4174[[package]]
3883name = "windows_x86_64_gnullvm" 4175name = "windows_x86_64_gnullvm"
3884version = "0.42.2" 4176version = "0.42.2"
3885source = "registry+https://github.com/rust-lang/crates.io-index" 4177source = "registry+https://github.com/rust-lang/crates.io-index"
3886checksum = "26d41b46a36d453748aedef1486d5c7a85db22e56aff34643984ea85514e94a3" 4178checksum = "26d41b46a36d453748aedef1486d5c7a85db22e56aff34643984ea85514e94a3"
3887 4179
4180[[package]]
4181name = "windows_x86_64_gnullvm"
4182version = "0.48.0"
4183source = "registry+https://github.com/rust-lang/crates.io-index"
4184checksum = "7896dbc1f41e08872e9d5e8f8baa8fdd2677f29468c4e156210174edc7f7b953"
4185
3888[[package]] 4186[[package]]
3889name = "windows_x86_64_msvc" 4187name = "windows_x86_64_msvc"
3890version = "0.42.2" 4188version = "0.42.2"
3891source = "registry+https://github.com/rust-lang/crates.io-index" 4189source = "registry+https://github.com/rust-lang/crates.io-index"
3892checksum = "9aec5da331524158c6d1a4ac0ab1541149c0b9505fde06423b02f5ef0106b9f0" 4190checksum = "9aec5da331524158c6d1a4ac0ab1541149c0b9505fde06423b02f5ef0106b9f0"
3893 4191
4192[[package]]
4193name = "windows_x86_64_msvc"
4194version = "0.48.0"
4195source = "registry+https://github.com/rust-lang/crates.io-index"
4196checksum = "1a515f5799fe4961cb532f983ce2b23082366b898e52ffbce459c86f67c8378a"
4197
3894[[package]] 4198[[package]]
3895name = "winnow" 4199name = "winnow"
3896version = "0.4.0" 4200version = "0.4.0"
@@ -3943,6 +4247,15 @@ dependencies = [
3943 "zeroize", 4247 "zeroize",
3944] 4248]
3945 4249
4250[[package]]
4251name = "xdg"
4252version = "2.4.1"
4253source = "registry+https://github.com/rust-lang/crates.io-index"
4254checksum = "0c4583db5cbd4c4c0303df2d15af80f0539db703fa1c68802d4cbbd2dd0f88f6"
4255dependencies = [
4256 "dirs",
4257]
4258
3946[[package]] 4259[[package]]
3947name = "xml5ever" 4260name = "xml5ever"
3948version = "0.17.0" 4261version = "0.17.0"
@@ -3954,6 +4267,15 @@ dependencies = [
3954 "markup5ever", 4267 "markup5ever",
3955] 4268]
3956 4269
4270[[package]]
4271name = "yaml-rust"
4272version = "0.4.5"
4273source = "registry+https://github.com/rust-lang/crates.io-index"
4274checksum = "56c1936c4cc7a1c9ab21a1ebb602eb942ba868cbd44a99cb7cdc5892335e1c85"
4275dependencies = [
4276 "linked-hash-map",
4277]
4278
3957[[package]] 4279[[package]]
3958name = "zeroize" 4280name = "zeroize"
3959version = "1.3.0" 4281version = "1.3.0"
Cargo.toml +2 −1
@@ -17,6 +17,7 @@ rust-version = "1.66"
17bitflags = "1.3.2" 17bitflags = "1.3.2"
18chrono = "0.4" 18chrono = "0.4"
19clap = {version = "4.0", features = ["derive"]} 19clap = {version = "4.0", features = ["derive"]}
20comrak = "0.18.0"
20css-color-parser = "0.1.2" 21css-color-parser = "0.1.2"
21dirs = "4.0.0" 22dirs = "4.0.0"
22emojis = "~0.5.2" 23emojis = "~0.5.2"
@@ -44,7 +45,7 @@ version = "0.0.14"
44[dependencies.matrix-sdk] 45[dependencies.matrix-sdk]
45version = "0.6" 46version = "0.6"
46default-features = false 47default-features = false
47features = ["e2e-encryption", "markdown", "sled", "rustls-tls"] 48features = ["e2e-encryption", "sled", "rustls-tls"]
48 49
49[dependencies.tokio] 50[dependencies.tokio]
50version = "1.24.1" 51version = "1.24.1"
src/message/html.rs +18 −2
@@ -1027,9 +1027,8 @@ pub mod tests {
1027 Span::raw("│"), 1027 Span::raw("│"),
1028 Span::raw(" "), 1028 Span::raw(" "),
1029 Span::raw("│"), 1029 Span::raw("│"),
1030 Span::styled(" ", bold),
1031 Span::styled("3", bold), 1030 Span::styled("3", bold),
1032 Span::styled(" ", bold), 1031 Span::styled(" ", bold),
1033 Span::raw("│") 1032 Span::raw("│")
1034 ]); 1033 ]);
1035 1034
@@ -1157,4 +1156,21 @@ pub mod tests {
1157 assert_eq!(text.lines[1], Spans(vec![Span::raw("World"), Span::raw(" "),])); 1156 assert_eq!(text.lines[1], Spans(vec![Span::raw("World"), Span::raw(" "),]));
1158 assert_eq!(text.lines[2], Spans(vec![Span::raw("Goodbye")]),); 1157 assert_eq!(text.lines[2], Spans(vec![Span::raw("Goodbye")]),);
1159 } 1158 }
1159
1160 #[test]
1161 fn test_embedded_newline() {
1162 let s = "<p>Hello\nWorld</p>";
1163 let tree = parse_matrix_html(s);
1164 let text = tree.to_text(15, Style::default(), true);
1165 assert_eq!(text.lines.len(), 1);
1166 assert_eq!(
1167 text.lines[0],
1168 Spans(vec![
1169 Span::raw("Hello"),
1170 Span::raw(" "),
1171 Span::raw("World"),
1172 Span::raw(" ")
1173 ])
1174 );
1175 }
1160} 1176}
src/message/mod.rs +59
@@ -7,6 +7,7 @@ use std::hash::{Hash, Hasher};
7use std::slice::Iter; 7use std::slice::Iter;
8 8
9use chrono::{DateTime, Local as LocalTz, NaiveDateTime, TimeZone}; 9use chrono::{DateTime, Local as LocalTz, NaiveDateTime, TimeZone};
10use comrak::{markdown_to_html, ComrakOptions};
10use unicode_width::UnicodeWidthStr; 11use unicode_width::UnicodeWidthStr;
11 12
12use matrix_sdk::ruma::{ 13use matrix_sdk::ruma::{
@@ -26,6 +27,7 @@ use matrix_sdk::ruma::{
26 Relation, 27 Relation,
27 RoomMessageEvent, 28 RoomMessageEvent,
28 RoomMessageEventContent, 29 RoomMessageEventContent,
30 TextMessageEventContent,
29 }, 31 },
30 redaction::SyncRoomRedactionEvent, 32 redaction::SyncRoomRedactionEvent,
31 }, 33 },
@@ -93,6 +95,19 @@ const USER_GUTTER_EMPTY_SPAN: Span<'static> = span_static(USER_GUTTER_EMPTY);
93const TIME_GUTTER_EMPTY: &str = " "; 95const TIME_GUTTER_EMPTY: &str = " ";
94const TIME_GUTTER_EMPTY_SPAN: Span<'static> = span_static(TIME_GUTTER_EMPTY); 96const TIME_GUTTER_EMPTY_SPAN: Span<'static> = span_static(TIME_GUTTER_EMPTY);
95 97
98fn text_to_message_content(input: String) -> TextMessageEventContent {
99 let mut options = ComrakOptions::default();
100 options.render.hardbreaks = true;
101 let html = markdown_to_html(input.as_str(), &options);
102
103 TextMessageEventContent::html(input, html)
104}
105
106pub fn text_to_message(input: String) -> RoomMessageEventContent {
107 let msg = MessageType::Text(text_to_message_content(input));
108 RoomMessageEventContent::new(msg)
109}
110
96#[inline] 111#[inline]
97fn millis_to_datetime(ms: UInt) -> DateTime<LocalTz> { 112fn millis_to_datetime(ms: UInt) -> DateTime<LocalTz> {
98 let time = i64::from(ms) / 1000; 113 let time = i64::from(ms) / 1000;
@@ -972,4 +987,48 @@ pub mod tests {
972 // MessageCursor::latest() should point at the most recent message after conversion. 987 // MessageCursor::latest() should point at the most recent message after conversion.
973 assert_eq!(identity(&mc6), mc1); 988 assert_eq!(identity(&mc6), mc1);
974 } 989 }
990
991 #[test]
992 fn test_markdown_message() {
993 let input = "**bold**\n";
994 let content = text_to_message_content(input.into());
995 assert_eq!(content.body, input);
996 assert_eq!(content.formatted.unwrap().body, "<p><strong>bold</strong></p>\n");
997
998 let input = "*emphasis*\n";
999 let content = text_to_message_content(input.into());
1000 assert_eq!(content.body, input);
1001 assert_eq!(content.formatted.unwrap().body, "<p><em>emphasis</em></p>\n");
1002
1003 let input = "`code`\n";
1004 let content = text_to_message_content(input.into());
1005 assert_eq!(content.body, input);
1006 assert_eq!(content.formatted.unwrap().body, "<p><code>code</code></p>\n");
1007
1008 let input = "```rust\nconst A: usize = 1;\n```\n";
1009 let content = text_to_message_content(input.into());
1010 assert_eq!(content.body, input);
1011 assert_eq!(
1012 content.formatted.unwrap().body,
1013 "<pre><code class=\"language-rust\">const A: usize = 1;\n</code></pre>\n"
1014 );
1015
1016 let input = "para 1\n\npara 2\n";
1017 let content = text_to_message_content(input.into());
1018 assert_eq!(content.body, input);
1019 assert_eq!(content.formatted.unwrap().body, "<p>para 1</p>\n<p>para 2</p>\n");
1020
1021 let input = "line 1\nline 2\n";
1022 let content = text_to_message_content(input.into());
1023 assert_eq!(content.body, input);
1024 assert_eq!(content.formatted.unwrap().body, "<p>line 1<br />\nline 2</p>\n");
1025
1026 let input = "# Heading\n## Subheading\n\ntext\n";
1027 let content = text_to_message_content(input.into());
1028 assert_eq!(content.body, input);
1029 assert_eq!(
1030 content.formatted.unwrap().body,
1031 "<h1>Heading</h1>\n<h2>Subheading</h2>\n<p>text</p>\n"
1032 );
1033 }
975} 1034}
src/message/printer.rs +7 −2
@@ -156,8 +156,13 @@ impl<'a> TextPrinter<'a> {
156 pub fn push_str(&mut self, s: &'a str, style: Style) { 156 pub fn push_str(&mut self, s: &'a str, style: Style) {
157 let style = self.base_style.patch(style); 157 let style = self.base_style.patch(style);
158 158
159 for word in UnicodeSegmentation::split_word_bounds(s) { 159 for mut word in UnicodeSegmentation::split_word_bounds(s) {
160 if self.width == 0 && word.chars().all(char::is_whitespace) { 160 if let "\n" | "\r\n" = word {
161 // Render embedded newlines as spaces.
162 word = " ";
163 }
164
165 if self.curr_width == 0 && word.chars().all(char::is_whitespace) {
161 // Drop leading whitespace. 166 // Drop leading whitespace.
162 continue; 167 continue;
163 } 168 }
src/windows/room/chat.rs +2 −5
@@ -75,7 +75,7 @@ use crate::base::{
75 SendAction, 75 SendAction,
76}; 76};
77 77
78use crate::message::{Message, MessageEvent, MessageKey, MessageTimeStamp}; 78use crate::message::{text_to_message, Message, MessageEvent, MessageKey, MessageTimeStamp};
79use crate::worker::Requester; 79use crate::worker::Requester;
80 80
81use super::scrollback::{Scrollback, ScrollbackState}; 81use super::scrollback::{Scrollback, ScrollbackState};
@@ -407,10 +407,7 @@ impl ChatState {
407 return Ok(None); 407 return Ok(None);
408 } 408 }
409 409
410 let msg = TextMessageEventContent::markdown(msg.to_string()); 410 let mut msg = text_to_message(msg.to_string());
411 let msg = MessageType::Text(msg);
412
413 let mut msg = RoomMessageEventContent::new(msg);
414 411
415 if let Some((_, event_id)) = &self.editing { 412 if let Some((_, event_id)) = &self.editing {
416 msg.relates_to = Some(Relation::Replacement(Replacement::new( 413 msg.relates_to = Some(Relation::Replacement(Replacement::new(