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

Support details, summary tags (support-project/knowledge#1089) #24

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
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