Skip to content

Commit

Permalink
Support details, summary tags (support-project/knowledge#1089)
Browse files Browse the repository at this point in the history
  • Loading branch information
y-okumura-isp committed Mar 14, 2021
1 parent ffeae42 commit 736f5b0
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/main/java/io/github/gitbucket/markedj/Grammer.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ public class Grammer {

public static String BULLET = "(?:[*+-]|\\d+\\.)";
public static String COMMENT = "<!--[\\s\\S]*?-->";
public static String TAG = "(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:/|[^\\w\\s@]*@)\\b";
public static String TAG = "(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b|details|summary)\\w+(?!:/|[^\\w\\s@]*@)\\b";
public static String CLOSED = "<(" + TAG + ")[\\s\\S]+?<\\/\\1>";
public static String CLOSING = "<" + TAG + "(?:\"[^\"]*\"|'[^']*'|[^'\">])*?>";
public static String HR = "\\n+(?=\\1?(?:[-*_] *){3,}(?:\\n+|$))";
Expand Down
16 changes: 16 additions & 0 deletions src/test/java/io/github/gitbucket/markedj/MarkedTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,22 @@ public void testEmptyTableCell() throws Exception {
"</table>\n", result);
}

@Test
public void testDetailsTag() throws Exception {
String result = Marked.marked(
"<details>\n" +
"<summary>sample title<summary>\n" +
"long long text\n" +
"</details>\n");

assertEquals(
"<p><details>\n" +
"<summary>sample title<summary>\n" +
"long long text\n" +
"</details></p>\n",
result);
}

private String loadResourceAsString(String path) throws IOException {
InputStream in = Thread.currentThread().getContextClassLoader().getResourceAsStream(path);
try {
Expand Down

0 comments on commit 736f5b0

Please sign in to comment.