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"
215215source = "registry+https://github.com/rust-lang/crates.io-index"
216216checksum = "8c3c1a368f70d6cf7302d78f8f7093da241fb8e8807c05cc9e51a125895a6d5b"
217217
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
218242[[package]]
219243name = "bitflags"
220244version = "1.3.2"
@@ -397,6 +421,7 @@ dependencies = [
397421 "once_cell",
398422 "strsim",
399423 "termcolor",
424 "terminal_size",
400425]
401426
402427[[package]]
@@ -456,6 +481,25 @@ version = "1.1.0"
456481source = "registry+https://github.com/rust-lang/crates.io-index"
457482checksum = "3d7b894f5411737b7867f4827955924d7c254fc9f4d91a6aad6b097804b1018b"
458483
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
459503[[package]]
460504name = "const-oid"
461505version = "0.7.1"
@@ -777,6 +821,12 @@ dependencies = [
777821 "syn 1.0.109",
778822]
779823
824[[package]]
825name = "deunicode"
826version = "0.4.3"
827source = "registry+https://github.com/rust-lang/crates.io-index"
828checksum = "850878694b7933ca4c9569d30a34b55031b9b139ee1fc7b94a527c4ef960d690"
829
780830[[package]]
781831name = "digest"
782832version = "0.9.0"
@@ -889,6 +939,12 @@ version = "0.1.2"
889939source = "registry+https://github.com/rust-lang/crates.io-index"
890940checksum = "c34f04666d835ff5d62e058c3995147c06f42fe86ff053337632bca83e42702d"
891941
942[[package]]
943name = "entities"
944version = "1.0.1"
945source = "registry+https://github.com/rust-lang/crates.io-index"
946checksum = "b5320ae4c3782150d900b79807611a59a99fc9a1d61d686faafc24b93fc8d7ca"
947
892948[[package]]
893949name = "errno"
894950version = "0.2.8"
@@ -900,6 +956,17 @@ dependencies = [
900956 "winapi",
901957]
902958
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
903970[[package]]
904971name = "errno-dragonfly"
905972version = "0.1.2"
@@ -926,6 +993,16 @@ version = "2.5.3"
926993source = "registry+https://github.com/rust-lang/crates.io-index"
927994checksum = "0206175f82b8d6bf6652ff7d71a1e27fd2e4efde587fd368662814d6ec1d9ce0"
928995
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
9291006[[package]]
9301007name = "flate2"
9311008version = "1.0.25"
@@ -1337,6 +1414,7 @@ dependencies = [
13371414 "bitflags 1.3.2",
13381415 "chrono",
13391416 "clap",
1417 "comrak",
13401418 "css-color-parser",
13411419 "dirs",
13421420 "emojis",
@@ -1499,7 +1577,7 @@ checksum = "8687c819457e979cc940d09cb16e42a1bf70aa6b60a549de6d3a62a0ee90c69e"
14991577dependencies = [
15001578 "hermit-abi 0.3.1",
15011579 "io-lifetimes",
1502 "rustix",
1580 "rustix 0.36.11",
15031581 "windows-sys 0.45.0",
15041582]
15051583
@@ -1569,6 +1647,15 @@ version = "0.2.140"
15691647source = "registry+https://github.com/rust-lang/crates.io-index"
15701648checksum = "99227334921fae1a979cf0bfdfcc6b3e5ce376ef57e16fb6fb3ea2ed6095f80c"
15711649
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
15721659[[package]]
15731660name = "link-cplusplus"
15741661version = "1.0.8"
@@ -1578,12 +1665,24 @@ dependencies = [
15781665 "cc",
15791666]
15801667
1668[[package]]
1669name = "linked-hash-map"
1670version = "0.5.6"
1671source = "registry+https://github.com/rust-lang/crates.io-index"
1672checksum = "0717cef1bc8b636c6e1c1bbdefc09e6322da8a9321966e8928ef80d20f7f770f"
1673
15811674[[package]]
15821675name = "linux-raw-sys"
15831676version = "0.1.4"
15841677source = "registry+https://github.com/rust-lang/crates.io-index"
15851678checksum = "f051f77a7c8e6957c0696eac88f26b0117e54f52d3fc682ab19397a8812846a4"
15861679
1680[[package]]
1681name = "linux-raw-sys"
1682version = "0.3.1"
1683source = "registry+https://github.com/rust-lang/crates.io-index"
1684checksum = "d59d8c75012853d2e872fb56bc8a2e53718e2cafe1a4c823143141c6d90c322f"
1685
15871686[[package]]
15881687name = "lock_api"
15891688version = "0.4.9"
@@ -2049,6 +2148,28 @@ version = "1.17.1"
20492148source = "registry+https://github.com/rust-lang/crates.io-index"
20502149checksum = "b7e5500299e16ebb147ae15a00a942af264cf3688f47923b8fc2cd5858f23ad3"
20512150
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
20522173[[package]]
20532174name = "opaque-debug"
20542175version = "0.3.0"
@@ -2258,6 +2379,26 @@ dependencies = [
22582379 "spki",
22592380]
22602381
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
22612402[[package]]
22622403name = "png"
22632404version = "0.17.7"
@@ -2345,14 +2486,12 @@ dependencies = [
23452486]
23462487
23472488[[package]]
2348name = "pulldown-cmark"
2349version = "0.9.2"
2489name = "quick-xml"
2490version = "0.28.1"
23502491source = "registry+https://github.com/rust-lang/crates.io-index"
2351checksum = "2d9cc634bc78768157b5cbfe988ffcd1dcba95cd2b2f03a88316c08c6d00ed63"
2492checksum = "e5c1a97b1bc42b1d550bfb48d4262153fe400a12bab1511821736f7eac76d7e2"
23522493dependencies = [
2353 "bitflags 1.3.2",
23542494 "memchr",
2355 "unicase",
23562495]
23572496
23582497[[package]]
@@ -2739,7 +2878,6 @@ dependencies = [
27392878 "js_int",
27402879 "js_option",
27412880 "percent-encoding",
2742 "pulldown-cmark",
27432881 "rand 0.8.5",
27442882 "regex",
27452883 "ruma-identifiers-validation",
@@ -2807,10 +2945,24 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
28072945checksum = "db4165c9963ab29e422d6c26fbc1d37f15bace6b2810221f9d925023480fcf0e"
28082946dependencies = [
28092947 "bitflags 1.3.2",
2810 "errno",
2948 "errno 0.2.8",
28112949 "io-lifetimes",
28122950 "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",
28142966 "windows-sys 0.45.0",
28152967]
28162968
@@ -2841,6 +2993,21 @@ version = "1.0.13"
28412993source = "registry+https://github.com/rust-lang/crates.io-index"
28422994checksum = "f91339c0467de62360649f8d3e185ca8de4224ff281f66000de5eb2a77a79041"
28432995
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
28443011[[package]]
28453012name = "scopeguard"
28463013version = "1.1.0"
@@ -2954,6 +3121,12 @@ dependencies = [
29543121 "lazy_static 1.4.0",
29553122]
29563123
3124[[package]]
3125name = "shell-words"
3126version = "1.1.0"
3127source = "registry+https://github.com/rust-lang/crates.io-index"
3128checksum = "24188a676b6ae68c3b2cb3a01be17fbf7240ce009799bb56d5b1409051e78fde"
3129
29573130[[package]]
29583131name = "signal-hook"
29593132version = "0.3.15"
@@ -3021,6 +3194,15 @@ dependencies = [
30213194 "parking_lot 0.11.2",
30223195]
30233196
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
30243206[[package]]
30253207name = "smallvec"
30263208version = "1.10.0"
@@ -3147,6 +3329,30 @@ dependencies = [
31473329 "unicode-xid 0.2.4",
31483330]
31493331
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
31503356[[package]]
31513357name = "tendril"
31523358version = "0.4.3"
@@ -3167,6 +3373,16 @@ dependencies = [
31673373 "winapi-util",
31683374]
31693375
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
31703386[[package]]
31713387name = "thiserror"
31723388version = "1.0.40"
@@ -3435,6 +3651,12 @@ dependencies = [
34353651 "unicode-width",
34363652]
34373653
3654[[package]]
3655name = "typed-arena"
3656version = "2.0.2"
3657source = "registry+https://github.com/rust-lang/crates.io-index"
3658checksum = "6af6ae20167a9ece4bcb41af5b80f8a1f1df981f6391189ce00fd257af04126a"
3659
34383660[[package]]
34393661name = "typenum"
34403662version = "1.16.0"
@@ -3495,6 +3717,12 @@ version = "0.2.4"
34953717source = "registry+https://github.com/rust-lang/crates.io-index"
34963718checksum = "f962df74c8c05a667b5ee8bcf162993134c104e96440b663c8daa176dc772d8c"
34973719
3720[[package]]
3721name = "unicode_categories"
3722version = "0.1.1"
3723source = "registry+https://github.com/rust-lang/crates.io-index"
3724checksum = "39ec24b3121d976906ece63c9daad25b85969647682eee313cb5779fdd69e14e"
3725
34983726[[package]]
34993727name = "universal-hash"
35003728version = "0.4.1"
@@ -3594,6 +3822,16 @@ dependencies = [
35943822 "zeroize",
35953823]
35963824
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
35973835[[package]]
35983836name = "want"
35993837version = "0.3.0"
@@ -3792,13 +4030,13 @@ version = "0.43.0"
37924030source = "registry+https://github.com/rust-lang/crates.io-index"
37934031checksum = "04662ed0e3e5630dfa9b26e4cb823b817f1a9addda855d973a9458c236556244"
37944032dependencies = [
3795 "windows_aarch64_gnullvm",
3796 "windows_aarch64_msvc",
3797 "windows_i686_gnu",
3798 "windows_i686_msvc",
3799 "windows_x86_64_gnu",
3800 "windows_x86_64_gnullvm",
3801 "windows_x86_64_msvc",
4033 "windows_aarch64_gnullvm 0.42.2",
4034 "windows_aarch64_msvc 0.42.2",
4035 "windows_i686_gnu 0.42.2",
4036 "windows_i686_msvc 0.42.2",
4037 "windows_x86_64_gnu 0.42.2",
4038 "windows_x86_64_gnullvm 0.42.2",
4039 "windows_x86_64_msvc 0.42.2",
38024040]
38034041
38044042[[package]]
@@ -3807,7 +4045,7 @@ version = "0.46.0"
38074045source = "registry+https://github.com/rust-lang/crates.io-index"
38084046checksum = "cdacb41e6a96a052c6cb63a144f24900236121c6f63f4f8219fef5977ecb0c25"
38094047dependencies = [
3810 "windows-targets",
4048 "windows-targets 0.42.2",
38114049]
38124050
38134051[[package]]
@@ -3816,13 +4054,13 @@ version = "0.42.0"
38164054source = "registry+https://github.com/rust-lang/crates.io-index"
38174055checksum = "5a3e1820f08b8513f676f7ab6c1f99ff312fb97b553d30ff4dd86f9f15728aa7"
38184056dependencies = [
3819 "windows_aarch64_gnullvm",
3820 "windows_aarch64_msvc",
3821 "windows_i686_gnu",
3822 "windows_i686_msvc",
3823 "windows_x86_64_gnu",
3824 "windows_x86_64_gnullvm",
3825 "windows_x86_64_msvc",
4057 "windows_aarch64_gnullvm 0.42.2",
4058 "windows_aarch64_msvc 0.42.2",
4059 "windows_i686_gnu 0.42.2",
4060 "windows_i686_msvc 0.42.2",
4061 "windows_x86_64_gnu 0.42.2",
4062 "windows_x86_64_gnullvm 0.42.2",
4063 "windows_x86_64_msvc 0.42.2",
38264064]
38274065
38284066[[package]]
@@ -3831,7 +4069,16 @@ version = "0.45.0"
38314069source = "registry+https://github.com/rust-lang/crates.io-index"
38324070checksum = "75283be5efb2831d37ea142365f009c02ec203cd29a3ebecbc093d52315b66d0"
38334071dependencies = [
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",
38354082]
38364083
38374084[[package]]
@@ -3840,13 +4087,28 @@ version = "0.42.2"
38404087source = "registry+https://github.com/rust-lang/crates.io-index"
38414088checksum = "8e5180c00cd44c9b1c88adb3693291f1cd93605ded80c250a75d472756b4d071"
38424089dependencies = [
3843 "windows_aarch64_gnullvm",
3844 "windows_aarch64_msvc",
3845 "windows_i686_gnu",
3846 "windows_i686_msvc",
3847 "windows_x86_64_gnu",
3848 "windows_x86_64_gnullvm",
3849 "windows_x86_64_msvc",
4090 "windows_aarch64_gnullvm 0.42.2",
4091 "windows_aarch64_msvc 0.42.2",
4092 "windows_i686_gnu 0.42.2",
4093 "windows_i686_msvc 0.42.2",
4094 "windows_x86_64_gnu 0.42.2",
4095 "windows_x86_64_gnullvm 0.42.2",
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",
38504112]
38514113
38524114[[package]]
@@ -3855,42 +4117,84 @@ version = "0.42.2"
38554117source = "registry+https://github.com/rust-lang/crates.io-index"
38564118checksum = "597a5118570b68bc08d8d59125332c54f1ba9d9adeedeef5b99b02ba2b0698f8"
38574119
4120[[package]]
4121name = "windows_aarch64_gnullvm"
4122version = "0.48.0"
4123source = "registry+https://github.com/rust-lang/crates.io-index"
4124checksum = "91ae572e1b79dba883e0d315474df7305d12f569b400fcf90581b06062f7e1bc"
4125
38584126[[package]]
38594127name = "windows_aarch64_msvc"
38604128version = "0.42.2"
38614129source = "registry+https://github.com/rust-lang/crates.io-index"
38624130checksum = "e08e8864a60f06ef0d0ff4ba04124db8b0fb3be5776a5cd47641e942e58c4d43"
38634131
4132[[package]]
4133name = "windows_aarch64_msvc"
4134version = "0.48.0"
4135source = "registry+https://github.com/rust-lang/crates.io-index"
4136checksum = "b2ef27e0d7bdfcfc7b868b317c1d32c641a6fe4629c171b8928c7b08d98d7cf3"
4137
38644138[[package]]
38654139name = "windows_i686_gnu"
38664140version = "0.42.2"
38674141source = "registry+https://github.com/rust-lang/crates.io-index"
38684142checksum = "c61d927d8da41da96a81f029489353e68739737d3beca43145c8afec9a31a84f"
38694143
4144[[package]]
4145name = "windows_i686_gnu"
4146version = "0.48.0"
4147source = "registry+https://github.com/rust-lang/crates.io-index"
4148checksum = "622a1962a7db830d6fd0a69683c80a18fda201879f0f447f065a3b7467daa241"
4149
38704150[[package]]
38714151name = "windows_i686_msvc"
38724152version = "0.42.2"
38734153source = "registry+https://github.com/rust-lang/crates.io-index"
38744154checksum = "44d840b6ec649f480a41c8d80f9c65108b92d89345dd94027bfe06ac444d1060"
38754155
4156[[package]]
4157name = "windows_i686_msvc"
4158version = "0.48.0"
4159source = "registry+https://github.com/rust-lang/crates.io-index"
4160checksum = "4542c6e364ce21bf45d69fdd2a8e455fa38d316158cfd43b3ac1c5b1b19f8e00"
4161
38764162[[package]]
38774163name = "windows_x86_64_gnu"
38784164version = "0.42.2"
38794165source = "registry+https://github.com/rust-lang/crates.io-index"
38804166checksum = "8de912b8b8feb55c064867cf047dda097f92d51efad5b491dfb98f6bbb70cb36"
38814167
4168[[package]]
4169name = "windows_x86_64_gnu"
4170version = "0.48.0"
4171source = "registry+https://github.com/rust-lang/crates.io-index"
4172checksum = "ca2b8a661f7628cbd23440e50b05d705db3686f894fc9580820623656af974b1"
4173
38824174[[package]]
38834175name = "windows_x86_64_gnullvm"
38844176version = "0.42.2"
38854177source = "registry+https://github.com/rust-lang/crates.io-index"
38864178checksum = "26d41b46a36d453748aedef1486d5c7a85db22e56aff34643984ea85514e94a3"
38874179
4180[[package]]
4181name = "windows_x86_64_gnullvm"
4182version = "0.48.0"
4183source = "registry+https://github.com/rust-lang/crates.io-index"
4184checksum = "7896dbc1f41e08872e9d5e8f8baa8fdd2677f29468c4e156210174edc7f7b953"
4185
38884186[[package]]
38894187name = "windows_x86_64_msvc"
38904188version = "0.42.2"
38914189source = "registry+https://github.com/rust-lang/crates.io-index"
38924190checksum = "9aec5da331524158c6d1a4ac0ab1541149c0b9505fde06423b02f5ef0106b9f0"
38934191
4192[[package]]
4193name = "windows_x86_64_msvc"
4194version = "0.48.0"
4195source = "registry+https://github.com/rust-lang/crates.io-index"
4196checksum = "1a515f5799fe4961cb532f983ce2b23082366b898e52ffbce459c86f67c8378a"
4197
38944198[[package]]
38954199name = "winnow"
38964200version = "0.4.0"
@@ -3943,6 +4247,15 @@ dependencies = [
39434247 "zeroize",
39444248]
39454249
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
39464259[[package]]
39474260name = "xml5ever"
39484261version = "0.17.0"
@@ -3954,6 +4267,15 @@ dependencies = [
39544267 "markup5ever",
39554268]
39564269
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
39574279[[package]]
39584280name = "zeroize"
39594281version = "1.3.0"
Cargo.toml +2 −1
@@ -17,6 +17,7 @@ rust-version = "1.66"
1717bitflags = "1.3.2"
1818chrono = "0.4"
1919clap = {version = "4.0", features = ["derive"]}
20comrak = "0.18.0"
2021css-color-parser = "0.1.2"
2122dirs = "4.0.0"
2223emojis = "~0.5.2"
@@ -44,7 +45,7 @@ version = "0.0.14"
4445[dependencies.matrix-sdk]
4546version = "0.6"
4647default-features = false
47features = ["e2e-encryption", "markdown", "sled", "rustls-tls"]
48features = ["e2e-encryption", "sled", "rustls-tls"]
4849
4950[dependencies.tokio]
5051version = "1.24.1"
src/message/html.rs +18 −2
@@ -1027,9 +1027,8 @@ pub mod tests {
10271027 Span::raw("│"),
10281028 Span::raw(" "),
10291029 Span::raw("│"),
1030 Span::styled(" ", bold),
10311030 Span::styled("3", bold),
1032 Span::styled(" ", bold),
1031 Span::styled(" ", bold),
10331032 Span::raw("│")
10341033 ]);
10351034
@@ -1157,4 +1156,21 @@ pub mod tests {
11571156 assert_eq!(text.lines[1], Spans(vec![Span::raw("World"), Span::raw(" "),]));
11581157 assert_eq!(text.lines[2], Spans(vec![Span::raw("Goodbye")]),);
11591158 }
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 }
11601176}
src/message/mod.rs +59
@@ -7,6 +7,7 @@ use std::hash::{Hash, Hasher};
77use std::slice::Iter;
88
99use chrono::{DateTime, Local as LocalTz, NaiveDateTime, TimeZone};
10use comrak::{markdown_to_html, ComrakOptions};
1011use unicode_width::UnicodeWidthStr;
1112
1213use matrix_sdk::ruma::{
@@ -26,6 +27,7 @@ use matrix_sdk::ruma::{
2627 Relation,
2728 RoomMessageEvent,
2829 RoomMessageEventContent,
30 TextMessageEventContent,
2931 },
3032 redaction::SyncRoomRedactionEvent,
3133 },
@@ -93,6 +95,19 @@ const USER_GUTTER_EMPTY_SPAN: Span<'static> = span_static(USER_GUTTER_EMPTY);
9395const TIME_GUTTER_EMPTY: &str = " ";
9496const TIME_GUTTER_EMPTY_SPAN: Span<'static> = span_static(TIME_GUTTER_EMPTY);
9597
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
96111#[inline]
97112fn millis_to_datetime(ms: UInt) -> DateTime<LocalTz> {
98113 let time = i64::from(ms) / 1000;
@@ -972,4 +987,48 @@ pub mod tests {
972987 // MessageCursor::latest() should point at the most recent message after conversion.
973988 assert_eq!(identity(&mc6), mc1);
974989 }
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 }
9751034}
src/message/printer.rs +7 −2
@@ -156,8 +156,13 @@ impl<'a> TextPrinter<'a> {
156156 pub fn push_str(&mut self, s: &'a str, style: Style) {
157157 let style = self.base_style.patch(style);
158158
159 for word in UnicodeSegmentation::split_word_bounds(s) {
160 if self.width == 0 && word.chars().all(char::is_whitespace) {
159 for mut word in UnicodeSegmentation::split_word_bounds(s) {
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) {
161166 // Drop leading whitespace.
162167 continue;
163168 }
src/windows/room/chat.rs +2 −5
@@ -75,7 +75,7 @@ use crate::base::{
7575 SendAction,
7676};
7777
78use crate::message::{Message, MessageEvent, MessageKey, MessageTimeStamp};
78use crate::message::{text_to_message, Message, MessageEvent, MessageKey, MessageTimeStamp};
7979use crate::worker::Requester;
8080
8181use super::scrollback::{Scrollback, ScrollbackState};
@@ -407,10 +407,7 @@ impl ChatState {
407407 return Ok(None);
408408 }
409409
410 let msg = TextMessageEventContent::markdown(msg.to_string());
411 let msg = MessageType::Text(msg);
412
413 let mut msg = RoomMessageEventContent::new(msg);
410 let mut msg = text_to_message(msg.to_string());
414411
415412 if let Some((_, event_id)) = &self.editing {
416413 msg.relates_to = Some(Relation::Replacement(Replacement::new(