From 6bde2922ed2e31ed0d6baacedd6005ea6042db44 Mon Sep 17 00:00:00 2001 From: Felix Ableitner Date: Thu, 19 Dec 2024 12:27:01 +0100 Subject: [PATCH] Revert "Markdown formatting" This reverts commit 56a6ba9b8b8f1511d6d93c3ba4df5bcbd540989a. --- Cargo.lock | 298 +------------------------------------ Cargo.toml | 1 - src/backend/api/article.rs | 7 +- 3 files changed, 7 insertions(+), 299 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 4d922b8..de3760f 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -125,55 +125,6 @@ dependencies = [ "libc", ] -[[package]] -name = "anstream" -version = "0.6.18" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8acc5369981196006228e28809f761875c0327210a891e941f4c683b3a99529b" -dependencies = [ - "anstyle", - "anstyle-parse", - "anstyle-query", - "anstyle-wincon", - "colorchoice", - "is_terminal_polyfill", - "utf8parse", -] - -[[package]] -name = "anstyle" -version = "1.0.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "55cc3b69f167a1ef2e161439aa98aed94e6028e5f9a59be9a6ffb47aef1651f9" - -[[package]] -name = "anstyle-parse" -version = "0.2.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3b2d16507662817a6a20a9ea92df6652ee4f94f914589377d69f3b21bc5798a9" -dependencies = [ - "utf8parse", -] - -[[package]] -name = "anstyle-query" -version = "1.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "79947af37f4177cfead1110013d678905c37501914fba0efea834c3fe9a8d60c" -dependencies = [ - "windows-sys 0.59.0", -] - -[[package]] -name = "anstyle-wincon" -version = "3.0.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2109dbce0e72be3ec00bed26e6a7479ca384ad226efdd66db8fa2e3a38c83125" -dependencies = [ - "anstyle", - "windows-sys 0.59.0", -] - [[package]] name = "any_spawner" version = "0.2.0" @@ -578,46 +529,6 @@ dependencies = [ "inout", ] -[[package]] -name = "clap" -version = "4.5.23" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3135e7ec2ef7b10c6ed8950f0f792ed96ee093fa088608f1c76e569722700c84" -dependencies = [ - "clap_builder", - "clap_derive", -] - -[[package]] -name = "clap_builder" -version = "4.5.23" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "30582fc632330df2bd26877bde0c1f4470d57c582bbc070376afcd04d8cb4838" -dependencies = [ - "anstream", - "anstyle", - "clap_lex", - "strsim 0.11.1", -] - -[[package]] -name = "clap_derive" -version = "4.5.18" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4ac6a0c7b1a9e9a5186361f67dfa1b88213572f427fb9ab038efb2bd8c582dab" -dependencies = [ - "heck", - "proc-macro2", - "quote", - "syn 2.0.90", -] - -[[package]] -name = "clap_lex" -version = "0.7.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f46ad14479a25103f283c0f10005961cf086d8dc42205bb44c46ac563475dca6" - [[package]] name = "clokwerk" version = "0.4.0" @@ -644,12 +555,6 @@ version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "186dce98367766de751c42c4f03970fc60fc012296e706ccbb9d5df9b6c1e271" -[[package]] -name = "colorchoice" -version = "1.0.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5b63caa9aa9397e2d9480a9b13673856c78d8ac123288526c37d7839f2a86990" - [[package]] name = "concurrent-queue" version = "2.5.0" @@ -1188,7 +1093,7 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5d3041965b7a63e70447ec818a46b1e5297f7fcae3058356d226c02750c4e6cb" dependencies = [ - "nu-ansi-term 0.50.1", + "nu-ansi-term", ] [[package]] @@ -1441,50 +1346,6 @@ dependencies = [ "miniz_oxide", ] -[[package]] -name = "fmtm" -version = "0.0.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "67821986c4f702a48182ce7f6a6053edf3bb3914ae5233deca7f43fb7d0cad21" -dependencies = [ - "anyhow", - "clap", - "fmtm_ytmimi_markdown_fmt", - "fmtt", - "tracing", - "tracing-subscriber", -] - -[[package]] -name = "fmtm_ytmimi_markdown_fmt" -version = "0.0.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fa29f82bcbac43afa28064b265f4568cd243c5ea386e73d4a9ff3a7081905e95" -dependencies = [ - "itertools 0.13.0", - "pulldown-cmark", - "textwrap", - "tracing", - "unicode-segmentation", - "unicode-width", -] - -[[package]] -name = "fmtt" -version = "0.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e8bf46ce300930c5057e54c2d538e079733abedc30eda1afd48770ed6b2cf9f0" -dependencies = [ - "anyhow", - "clap", - "regex", - "serde", - "serde_json", - "tailcall", - "tracing", - "tracing-subscriber", -] - [[package]] name = "fnv" version = "1.0.7" @@ -1982,7 +1843,6 @@ dependencies = [ "doku", "enum_delegate", "env_logger", - "fmtm", "futures", "getrandom", "gloo-net", @@ -2238,12 +2098,6 @@ version = "2.10.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ddc24109865250148c2e0f3d25d4f0f479571723792d3802153c60922a4fb708" -[[package]] -name = "is_terminal_polyfill" -version = "1.70.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7943c866cc5cd64cbc25b2e01621d07fa8eb2a1a23160ee81ce38704e97b8ecf" - [[package]] name = "itertools" version = "0.10.5" @@ -2739,15 +2593,6 @@ dependencies = [ "markdown-it", ] -[[package]] -name = "matchers" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8263075bb86c5a1b1427b5ae862e8889656f126e9f77c484496e8b47cf5c5558" -dependencies = [ - "regex-automata 0.1.10", -] - [[package]] name = "matchit" version = "0.7.3" @@ -2908,16 +2753,6 @@ dependencies = [ "minimal-lexical", ] -[[package]] -name = "nu-ansi-term" -version = "0.46.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "77a8165726e8236064dbb45459242600304b42a5ea24ee2948e18e023bf7ba84" -dependencies = [ - "overload", - "winapi", -] - [[package]] name = "nu-ansi-term" version = "0.50.1" @@ -3085,12 +2920,6 @@ dependencies = [ "hashbrown 0.14.5", ] -[[package]] -name = "overload" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b15813163c1d831bf4a13c3610c05c0d03b39feb07f7e09fa234dac9b15aaf39" - [[package]] name = "parking" version = "2.2.1" @@ -3421,17 +3250,6 @@ dependencies = [ "psl-types", ] -[[package]] -name = "pulldown-cmark" -version = "0.11.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "679341d22c78c6c649893cbd6c3278dcbe9fc4faa62fea3a9296ae2b50c14625" -dependencies = [ - "bitflags 2.6.0", - "memchr", - "unicase", -] - [[package]] name = "quanta" version = "0.12.4" @@ -3666,17 +3484,8 @@ checksum = "b544ef1b4eac5dc2db33ea63606ae9ffcfac26c1416a2806ae0bf5f56b201191" dependencies = [ "aho-corasick", "memchr", - "regex-automata 0.4.9", - "regex-syntax 0.8.5", -] - -[[package]] -name = "regex-automata" -version = "0.1.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6c230d73fb8d8c1b9c0b3135c5142a8acee3a0558fb8db5cf1cb65f8d7862132" -dependencies = [ - "regex-syntax 0.6.29", + "regex-automata", + "regex-syntax", ] [[package]] @@ -3687,15 +3496,9 @@ checksum = "809e8dc61f6de73b46c85f4c96486310fe304c434cfa43669d7b40f711150908" dependencies = [ "aho-corasick", "memchr", - "regex-syntax 0.8.5", + "regex-syntax", ] -[[package]] -name = "regex-syntax" -version = "0.6.29" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f162c6dd7b008981e4d40210aca20b4bd0f9b60ca9271061b07f78537722f2e1" - [[package]] name = "regex-syntax" version = "0.8.5" @@ -4159,15 +3962,6 @@ dependencies = [ "digest", ] -[[package]] -name = "sharded-slab" -version = "0.1.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f40ca3c46823713e0d4209592e8d6e826aa57e928f09752619fc696c499637f6" -dependencies = [ - "lazy_static", -] - [[package]] name = "shlex" version = "1.3.0" @@ -4240,12 +4034,6 @@ dependencies = [ "syn 2.0.90", ] -[[package]] -name = "smawk" -version = "0.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b7c388c1b5e93756d0c740965c41e8822f866621d41acbdf6336a6a168f8840c" - [[package]] name = "socket2" version = "0.5.8" @@ -4376,7 +4164,7 @@ dependencies = [ "fnv", "once_cell", "plist", - "regex-syntax 0.8.5", + "regex-syntax", "serde", "serde_derive", "serde_json", @@ -4444,26 +4232,6 @@ version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7b2093cf4c8eb1e67749a6762251bc9cd836b6fc171623bd0a9d324d37af2417" -[[package]] -name = "tailcall" -version = "1.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "695cb8728beab065fe29d03ae105a23c7cdd6e8d9ed5fd717a0bbbd8c56ab0bb" -dependencies = [ - "tailcall-impl", -] - -[[package]] -name = "tailcall-impl" -version = "1.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "10b7bf224f4cbce8706b34f6fd1db63bc9b1fa933a3b9e6eee2e78a660416e13" -dependencies = [ - "proc-macro2", - "quote", - "syn 1.0.109", -] - [[package]] name = "tempfile" version = "3.14.0" @@ -4477,17 +4245,6 @@ dependencies = [ "windows-sys 0.59.0", ] -[[package]] -name = "textwrap" -version = "0.16.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "23d434d3f8967a09480fb04132ebe0a3e088c173e6d0ee7897abbdf4eab0f8b9" -dependencies = [ - "smawk", - "unicode-linebreak", - "unicode-width", -] - [[package]] name = "thiserror" version = "1.0.69" @@ -4528,16 +4285,6 @@ dependencies = [ "syn 2.0.90", ] -[[package]] -name = "thread_local" -version = "1.1.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8b9ef9bad013ada3808854ceac7b46812a6465ba368859a37e2100283d2d719c" -dependencies = [ - "cfg-if", - "once_cell", -] - [[package]] name = "throw_error" version = "0.2.0" @@ -4806,23 +4553,6 @@ dependencies = [ "once_cell", ] -[[package]] -name = "tracing-subscriber" -version = "0.3.19" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e8189decb5ac0fa7bc8b96b7cb9b2701d60d48805aca84a238004d665fcc4008" -dependencies = [ - "matchers", - "nu-ansi-term 0.46.0", - "once_cell", - "regex", - "sharded-slab", - "smallvec", - "thread_local", - "tracing", - "tracing-core", -] - [[package]] name = "triomphe" version = "0.1.11" @@ -4909,12 +4639,6 @@ version = "1.0.14" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "adb9e6ca4f869e1180728b7950e35922a7fc6397f7b641499e8f3ef06e50dc83" -[[package]] -name = "unicode-linebreak" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3b09c83c3c29d37506a3e260c08c03743a6bb66a9cd432c6934ab501a190571f" - [[package]] name = "unicode-normalization" version = "0.1.24" @@ -4930,12 +4654,6 @@ version = "1.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f6ccf251212114b54433ec949fd6a7841275f9ada20dddd2f29e9ceea4501493" -[[package]] -name = "unicode-width" -version = "0.1.14" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7dd6e30e90baa6f72411720665d41d89b9a3d039dc45b8faea1ddd07f617f6af" - [[package]] name = "unicode-xid" version = "0.2.6" @@ -4978,12 +4696,6 @@ version = "1.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b6c140620e7ffbb22c2dee59cafe6084a59b5ffc27a8859a5f0d494b5d52b6be" -[[package]] -name = "utf8parse" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "06abde3611657adf66d383f00b093d7faecc7fa57071cce2578660c9f1010821" - [[package]] name = "uuid" version = "1.11.0" diff --git a/Cargo.toml b/Cargo.toml index 7aed505..1d9c291 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -106,7 +106,6 @@ anyhow = "1.0.94" include_dir = "0.7.4" mime_guess = "2.0.5" clokwerk = "0.4.0" -fmtm = "0.0.3" [dev-dependencies] pretty_assertions = "1.4.1" diff --git a/src/backend/api/article.rs b/src/backend/api/article.rs index b68c356..5551ff0 100644 --- a/src/backend/api/article.rs +++ b/src/backend/api/article.rs @@ -126,13 +126,10 @@ pub(in crate::backend::api) async fn edit_article( return Err(anyhow!("Links to local instance don't work over federation").into()); } - // Markdown formatting - let new_text = fmtm::format(&edit_form.new_text, Some(80))?; - if edit_form.previous_version_id == original_article.latest_version { // No intermediate changes, simply submit new version submit_article_update( - new_text.clone(), + edit_form.new_text.clone(), edit_form.summary.clone(), edit_form.previous_version_id, &original_article.article, @@ -146,7 +143,7 @@ pub(in crate::backend::api) async fn edit_article( // version and generate a diff to find out what exactly has changed. let edits = DbEdit::list_for_article(original_article.article.id, &data)?; let ancestor = generate_article_version(&edits, &edit_form.previous_version_id)?; - let patch = create_patch(&ancestor, &new_text); + let patch = create_patch(&ancestor, &edit_form.new_text); let previous_version = DbEdit::read(&edit_form.previous_version_id, &data)?; let form = DbConflictForm {