Skip to content

Commit

Permalink
Remove support for Markdown syntax for strikethrough and task lists (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
koppor authored Apr 2, 2023
1 parent 38582dd commit 1896c99
Show file tree
Hide file tree
Showing 5 changed files with 1 addition and 31 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,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. [#9726](https://github.com/JabRef/jabref/pull/9726)



Expand Down
2 changes: 0 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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'

Expand Down
2 changes: 0 additions & 2 deletions src/main/java/module-info.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
@@ -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;
Expand All @@ -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();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 {

Expand Down Expand Up @@ -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("<del>b</del>"));
}

@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("<li class=\"task-list-item\"><input type=\"checkbox\" class=\"task-list-item-checkbox\" disabled=\"disabled\" readonly=\"readonly\" />&nbsp;open task</li>"));
assertTrue(actual.contains("<li class=\"task-list-item\"><input type=\"checkbox\" class=\"task-list-item-checkbox\" checked=\"checked\" disabled=\"disabled\" readonly=\"readonly\" />&nbsp;closed task</li>"));
}
}

0 comments on commit 1896c99

Please sign in to comment.