From 7126a6f23c6a83465b51b335335eb52e9277ec2b Mon Sep 17 00:00:00 2001 From: Oliver Kopp Date: Sat, 1 Apr 2023 15:02:44 +0200 Subject: [PATCH 1/3] Remove support for Markdown syntax for strikethrough and task lists --- CHANGELOG.md | 2 +- build.gradle | 2 -- src/main/java/module-info.java | 2 -- .../jabref/logic/layout/format/MarkdownFormatter.java | 9 --------- 4 files changed, 1 insertion(+), 14 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3529222a37f..c90258c6842 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -57,7 +57,7 @@ Note that this project **does not** adhere to [Semantic Versioning](http://semve ### Removed - We removed the support of BibTeXML.[#9540](https://github.com/JabRef/jabref/issues/9540) - +- We removed support for Markdown syntax for strikethrough and task lists in comment fields. diff --git a/build.gradle b/build.gradle index 797ae2a52e8..22905397b0b 100644 --- a/build.gradle +++ b/build.gradle @@ -198,8 +198,6 @@ dependencies { } implementation 'com.vladsch.flexmark:flexmark:0.64.0' - implementation 'com.vladsch.flexmark:flexmark-ext-gfm-strikethrough:0.64.0' - implementation 'com.vladsch.flexmark:flexmark-ext-gfm-tasklist:0.64.0' implementation group: 'net.harawata', name: 'appdirs', version: '1.2.1' diff --git a/src/main/java/module-info.java b/src/main/java/module-info.java index ca7ed66cc97..86078c9afb0 100644 --- a/src/main/java/module-info.java +++ b/src/main/java/module-info.java @@ -94,8 +94,6 @@ requires com.ibm.icu; requires flexmark; - requires flexmark.ext.gfm.strikethrough; - requires flexmark.ext.gfm.tasklist; requires flexmark.util.ast; requires flexmark.util.data; requires com.h2database.mvstore; diff --git a/src/main/java/org/jabref/logic/layout/format/MarkdownFormatter.java b/src/main/java/org/jabref/logic/layout/format/MarkdownFormatter.java index f387dc40224..39accb95b8c 100644 --- a/src/main/java/org/jabref/logic/layout/format/MarkdownFormatter.java +++ b/src/main/java/org/jabref/logic/layout/format/MarkdownFormatter.java @@ -1,12 +1,9 @@ package org.jabref.logic.layout.format; -import java.util.List; import java.util.Objects; import org.jabref.logic.layout.LayoutFormatter; -import com.vladsch.flexmark.ext.gfm.strikethrough.StrikethroughExtension; -import com.vladsch.flexmark.ext.gfm.tasklist.TaskListExtension; import com.vladsch.flexmark.html.HtmlRenderer; import com.vladsch.flexmark.parser.Parser; import com.vladsch.flexmark.util.ast.Node; @@ -19,12 +16,6 @@ public class MarkdownFormatter implements LayoutFormatter { public MarkdownFormatter() { MutableDataSet options = new MutableDataSet(); - // in case a new extension is added here, the depedency has to be added to build.gradle, too. - options.set(Parser.EXTENSIONS, List.of( - StrikethroughExtension.create(), - TaskListExtension.create() - )); - parser = Parser.builder(options).build(); renderer = HtmlRenderer.builder(options).build(); } From a84e29cf0d4574ae815d7cc76963a98ac46c0f91 Mon Sep 17 00:00:00 2001 From: Oliver Kopp Date: Mon, 3 Apr 2023 00:37:22 +0200 Subject: [PATCH 2/3] Add link to PR --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c90258c6842..86ed9155160 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -57,7 +57,7 @@ Note that this project **does not** adhere to [Semantic Versioning](http://semve ### Removed - We removed the support of BibTeXML.[#9540](https://github.com/JabRef/jabref/issues/9540) -- We removed support for Markdown syntax for strikethrough and task lists in comment fields. +- We removed support for Markdown syntax for strikethrough and task lists in comment fields. [#9726](https://github.com/JabRef/jabref/pull/9726) From d8f23467e5f764fccc1f8e85664a67fd7499dd79 Mon Sep 17 00:00:00 2001 From: Oliver Kopp Date: Mon, 3 Apr 2023 00:51:20 +0200 Subject: [PATCH 3/3] Remove tests referring to strikethrough and task list --- .../layout/format/MarkdownFormatterTest.java | 18 ------------------ 1 file changed, 18 deletions(-) diff --git a/src/test/java/org/jabref/logic/layout/format/MarkdownFormatterTest.java b/src/test/java/org/jabref/logic/layout/format/MarkdownFormatterTest.java index 595bc6fcc1d..e5e1f9281e6 100644 --- a/src/test/java/org/jabref/logic/layout/format/MarkdownFormatterTest.java +++ b/src/test/java/org/jabref/logic/layout/format/MarkdownFormatterTest.java @@ -6,7 +6,6 @@ import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertFalse; import static org.junit.jupiter.api.Assertions.assertThrows; -import static org.junit.jupiter.api.Assertions.assertTrue; class MarkdownFormatterTest { @@ -37,21 +36,4 @@ void formatWhenFormattingNullThenThrowsException() { Exception exception = assertThrows(NullPointerException.class, () -> markdownFormatter.format(null)); assertEquals("Field Text should not be null, when handed to formatter", exception.getMessage()); } - - @Test - void formatWhenMarkupContainingStrikethroughThenContainsMatchingDel() { - // Only test strikethrough extension - assertTrue(markdownFormatter.format("a ~~b~~ b").contains("b")); - } - - @Test - void formatWhenMarkupContainingTaskListThenContainsFormattedTaskList() { - String actual = markdownFormatter.format("Some text\n" + - "* [ ] open task\n" + - "* [x] closed task\n\n" + - "some other text"); - // Only test list items - assertTrue(actual.contains("
  •  open task
  • ")); - assertTrue(actual.contains("
  •  closed task
  • ")); - } }