Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove support for Markdown syntax for strikethrough and task lists #9726

Merged
merged 4 commits into from
Apr 2, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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>"));
}
}