diff --git a/org.eclipse.jdt.ls.core/.classpath b/org.eclipse.jdt.ls.core/.classpath index 98d8021704..63d877b9ff 100644 --- a/org.eclipse.jdt.ls.core/.classpath +++ b/org.eclipse.jdt.ls.core/.classpath @@ -3,7 +3,7 @@ - + diff --git a/org.eclipse.jdt.ls.core/META-INF/MANIFEST.MF b/org.eclipse.jdt.ls.core/META-INF/MANIFEST.MF index 9ab5ac83e2..c31358bed1 100644 --- a/org.eclipse.jdt.ls.core/META-INF/MANIFEST.MF +++ b/org.eclipse.jdt.ls.core/META-INF/MANIFEST.MF @@ -56,7 +56,7 @@ Export-Package: org.eclipse.jdt.ls.core.internal;x-friends:="org.eclipse.jdt.ls. org.eclipse.jdt.ls.core.internal.preferences;x-friends:="org.eclipse.jdt.ls.tests", org.eclipse.jdt.ls.core.internal.text.correction;x-friends:="org.eclipse.jdt.ls.tests" Bundle-ClassPath: lib/jsoup-1.9.2.jar, - lib/remark-1.0.0.jar, + lib/remark-1.2.0.jar, . Bundle-Vendor: %Bundle-Vendor Automatic-Module-Name: org.eclipse.jdt.ls.core diff --git a/org.eclipse.jdt.ls.core/build.properties b/org.eclipse.jdt.ls.core/build.properties index 697982e17a..47b84ea04a 100644 --- a/org.eclipse.jdt.ls.core/build.properties +++ b/org.eclipse.jdt.ls.core/build.properties @@ -4,7 +4,7 @@ bin.includes = META-INF/,\ .,\ plugin.xml,\ lib/jsoup-1.9.2.jar,\ - lib/remark-1.0.0.jar,\ + lib/remark-1.2.0.jar,\ lifecycle-mapping-metadata.xml,\ plugin.properties src.includes = src/ diff --git a/org.eclipse.jdt.ls.core/pom.xml b/org.eclipse.jdt.ls.core/pom.xml index 1c1b1f8ab8..26389c9f7d 100644 --- a/org.eclipse.jdt.ls.core/pom.xml +++ b/org.eclipse.jdt.ls.core/pom.xml @@ -20,7 +20,7 @@ com.kotcrab.remark remark - 1.0.0 + 1.2.0 org.jsoup diff --git a/org.eclipse.jdt.ls.core/src/org/eclipse/jdt/ls/core/internal/javadoc/JavaDoc2MarkdownConverter.java b/org.eclipse.jdt.ls.core/src/org/eclipse/jdt/ls/core/internal/javadoc/JavaDoc2MarkdownConverter.java index f2768ff043..fccc2cf3f1 100644 --- a/org.eclipse.jdt.ls.core/src/org/eclipse/jdt/ls/core/internal/javadoc/JavaDoc2MarkdownConverter.java +++ b/org.eclipse.jdt.ls.core/src/org/eclipse/jdt/ls/core/internal/javadoc/JavaDoc2MarkdownConverter.java @@ -32,7 +32,7 @@ public class JavaDoc2MarkdownConverter extends AbstractJavaDocConverter { static { Options options = new Options(); - options.tables = Tables.CONVERT_TO_CODE_BLOCK; + options.tables = Tables.MULTI_MARKDOWN; options.hardwraps = true; options.inlineLinks = true; options.autoLinks = true; diff --git a/org.eclipse.jdt.ls.tests/src/org/eclipse/jdt/ls/core/internal/javadoc/AbstractJavadocConverterTest.java b/org.eclipse.jdt.ls.tests/src/org/eclipse/jdt/ls/core/internal/javadoc/AbstractJavadocConverterTest.java index 43fcdefc3e..86727cb502 100644 --- a/org.eclipse.jdt.ls.tests/src/org/eclipse/jdt/ls/core/internal/javadoc/AbstractJavadocConverterTest.java +++ b/org.eclipse.jdt.ls.tests/src/org/eclipse/jdt/ls/core/internal/javadoc/AbstractJavadocConverterTest.java @@ -64,41 +64,78 @@ public abstract class AbstractJavadocConverterTest { * @unknown unknown tag * @unknown another unknown tag */ + //@formatter:off static final String RAW_JAVADOC_0 = "This Javadoc contains some code , a link to {@link IOException} and a table \n" + + "\n" + + " \n" + + " \n" + + "
header 1header 2
data 1data 2
\n"+ + "
literally {@literal literal} and now a list:\n"+ + "
    " + + "
  • Coffee" + + "
      " + + "
    • Mocha
    • " + + "
    • Latte
    • " + + "
    " + + "
  • " + + "
  • Tea" + + "
      " + + "
    • Darjeeling
    • " + + "
    • Early Grey
    • " + + "
    " + + "
  • " + + "
"+ + "\n"+ + " @param param1 the first parameter\n" + + " @param param2 \n"+ + " the 2nd parameter\n" + + " @param param3 \n"+ + " @since 1.0\n" + + " @since .0\n" + + " @author Ralf\n" + + " @author Andrew\n" + + " @exception NastyException a\n nasty exception\n" + + " @throws \n"+ + "IOException another nasty exception\n" + + " @return some kind of result\n"+ + " @unknown unknown tag\n"+ + " @unknown another unknown tag\n"; + + //Not using a THEAD tag + static final String RAW_JAVADOC_TABLE_0= + "\n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + "
Header 1Header 2
Row 1ARow 1B
Row 2ARow 2B
"; + + //Not using a THEAD tag + static final String RAW_JAVADOC_TABLE_1= "\n" + - " \n" + - " \n" + - "
header 1header 2
data 1data 2
\n"+ - "
literally {@literal literal} and now a list:\n"+ - "
    " - + "
  • Coffee" + - "
      " + - "
    • Mocha
    • " + - "
    • Latte
    • " + - "
    " + - "
  • " + - "
  • Tea" + - "
      " + - "
    • Darjeeling
    • " + - "
    • Early Grey
    • " + - "
    " + - "
  • " + - "
"+ - "\n"+ - " @param param1 the first parameter\n" + - " @param param2 \n"+ - " the 2nd parameter\n" + - " @param param3 \n"+ - " @since 1.0\n" + - " @since .0\n" + - " @author Ralf\n" + - " @author Andrew\n" + - " @exception NastyException a\n nasty exception\n" + - " @throws \n"+ - "IOException another nasty exception\n" + - " @return some kind of result\n"+ - " @unknown unknown tag\n"+ - " @unknown another unknown tag\n"; + " \n" + + " Row 0A\n" + + " Row 0B\n" + + " \n" + + " \n" + + " Row 1A\n" + + " Row 1B\n" + + " \n" + + " \n" + + " Row 2A\n" + + " Row 2B\n" + + " \n" + + ""; + + //@formatter:off } diff --git a/org.eclipse.jdt.ls.tests/src/org/eclipse/jdt/ls/core/internal/javadoc/JavaDoc2MarkdownConverterTest.java b/org.eclipse.jdt.ls.tests/src/org/eclipse/jdt/ls/core/internal/javadoc/JavaDoc2MarkdownConverterTest.java index 690ac7779d..651e4f391e 100644 --- a/org.eclipse.jdt.ls.tests/src/org/eclipse/jdt/ls/core/internal/javadoc/JavaDoc2MarkdownConverterTest.java +++ b/org.eclipse.jdt.ls.tests/src/org/eclipse/jdt/ls/core/internal/javadoc/JavaDoc2MarkdownConverterTest.java @@ -29,12 +29,13 @@ * @author Fred Bricon */ public class JavaDoc2MarkdownConverterTest extends AbstractJavadocConverterTest { - - private static final String MARKDOWN_0 = "This Javadoc contains some `code`, a link to `IOException` and a table\n" + + //@formatter:off + private static final String MARKDOWN_0 = + "This Javadoc contains some `code`, a link to `IOException` and a table\n" + "\n" + - " | header 1 | header 2 |\n" + - " | -------- | -------- |\n" + - " | data 1 | data 2 |\n" + + "| header 1 | header 2 |\n" + + "| -------- | -------- |\n" + + "| data 1 | data 2 |\n" + "\n" + "\n" + "literally literal and now a list:\n" + @@ -75,6 +76,20 @@ public class JavaDoc2MarkdownConverterTest extends AbstractJavadocConverterTest " \n" + " * another unknown tag"; + private static final String MARKDOWN_TABLE_0= + "| Header 1 | Header 2 |\n" + + "| -------- | -------- |\n" + + "| Row 1A | Row 1B |\n" + + "| Row 2A | Row 2B |"; + + private static final String MARKDOWN_TABLE_1= + "| | |\n" + + "| ------ | ------ |\n" + + "| Row 0A | Row 0B |\n" + + "| Row 1A | Row 1B |\n" + + "| Row 2A | Row 2B |"; + //@formatter:on + static final String RAW_JAVADOC_HTML_1 = "File"; static final String RAW_JAVADOC_HTML_2 = "JDT"; static final String RAW_JAVADOC_HTML_SEE = "@see Online docs for java"; @@ -99,6 +114,18 @@ public void testGetAsString() throws IOException { assertEquals(Util.convertToIndependentLineDelimiter(MARKDOWN_0), Util.convertToIndependentLineDelimiter(result)); } + @Test + public void testMarkdownTableNoTHEAD() throws IOException { + String result = new JavaDoc2MarkdownConverter(RAW_JAVADOC_TABLE_0).getAsString(); + assertEquals(Util.convertToIndependentLineDelimiter(MARKDOWN_TABLE_0), Util.convertToIndependentLineDelimiter(result)); + } + + @Test + public void testMarkdownTableInsertBlankHeader() throws IOException { + String result = new JavaDoc2MarkdownConverter(RAW_JAVADOC_TABLE_1).getAsString(); + assertEquals(Util.convertToIndependentLineDelimiter(MARKDOWN_TABLE_1), Util.convertToIndependentLineDelimiter(result)); + } + @Test public void testGetAsReader() throws IOException { JavaDoc2MarkdownConverter converter = new JavaDoc2MarkdownConverter(RAW_JAVADOC_0);