diff --git a/pom.xml b/pom.xml index b54c76c..6a85604 100644 --- a/pom.xml +++ b/pom.xml @@ -4,7 +4,7 @@ org.support-project markedj jar - 1.4.0 + 1.5.0 markedj https://github.com/gitbucket/markedj Fork from gitbucket markedj because knowledge's issue. markedj is JVM port of graceful markdown processor marked.js diff --git a/src/main/java/io/github/gitbucket/markedj/Utils.java b/src/main/java/io/github/gitbucket/markedj/Utils.java index 9bbc834..979b68b 100644 --- a/src/main/java/io/github/gitbucket/markedj/Utils.java +++ b/src/main/java/io/github/gitbucket/markedj/Utils.java @@ -13,7 +13,7 @@ public static String escape(String html, boolean encode){ if(!encode){ html = html.replaceAll("&(?!#?\\w+;)", "&"); } else { - html = html.replace("&", "&"); + html = html.replace("&", "&"); } return html.replace("<", "<").replace(">", ">").replace("\"", """).replace("'", "'"); } diff --git a/src/test/java/io/github/gitbucket/markedj/ExtendParseTest.java b/src/test/java/io/github/gitbucket/markedj/ExtendParseTest.java index 73abda5..1ff6a38 100644 --- a/src/test/java/io/github/gitbucket/markedj/ExtendParseTest.java +++ b/src/test/java/io/github/gitbucket/markedj/ExtendParseTest.java @@ -61,6 +61,53 @@ public void testLinkTarget() throws Exception { assertEquals(expect, result); } + + + + @Test + public void testUNC() throws Exception { + Options options = new Options(); + options.setBreaks(true); + options.setLinkTargetBlank(true); + String md = "[UNCPathLink](¥¥hoge¥data \"UNCPathLink\")"; + String result = Marked.marked(md, options); + String expect = "

UNCPathLink

\n"; + assertEquals(expect, result); + } + + @Test + public void testFile() throws Exception { + Options options = new Options(); + options.setBreaks(true); + options.setLinkTargetBlank(true); + String md = "[UNCPathLink](file://hoge/data \"UNCPathLink\")"; + String result = Marked.marked(md, options); + String expect = "

UNCPathLink

\n"; + assertEquals(expect, result); + } + + + @Test + public void testSmb() throws Exception { + Options options = new Options(); + options.setBreaks(true); + options.setLinkTargetBlank(true); + String md = "[UNCPathLink](smb://hoge/data \"UNCPathLink\")"; + String result = Marked.marked(md, options); + String expect = "

UNCPathLink

\n"; + assertEquals(expect, result); + } + + + @Test + public void testAmp() { + String markdown = "```\n&read_data\n```"; + String result = Marked.marked(markdown); + String check = "
&read_data\n
\n"; + org.junit.Assert.assertEquals(check, result); + } + + private String loadResourceAsString(String path) throws IOException { InputStream in = Thread.currentThread().getContextClassLoader().getResourceAsStream(path); try {