Skip to content

Commit 5d347d5

Browse files
committed
Extend HTML5 support by whitelisting various tags
HTML5 provides a wide feature set of useful elements. Since Markdown usually supports HTML it should be able to use these HTML5 tags as well. As they were requested by some users and they where checked for being safe, whitelisting them isn't a problem. To make the experience the same as on GitHub when it comes to the basic look and feel of the rendered markdown, some CSS was added to make the summary and the details tag look like on GitHub. Signed-off-by: Sheogorath <sheogorath@shivering-isles.com>
1 parent f642a11 commit 5d347d5

2 files changed

Lines changed: 20 additions & 1 deletion

File tree

public/css/markdown.css

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -188,3 +188,12 @@
188188
.markdown-body .alert > ul {
189189
margin-bottom: 0;
190190
}
191+
192+
/* Make details boxes look like on GitHub */
193+
.markdown-body details summary {
194+
cursor: pointer;
195+
}
196+
197+
.markdown-body summary {
198+
display: list-item;
199+
}

public/js/render.js

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,18 @@ whiteList['style'] = []
1919
whiteList['kbd'] = []
2020
// allow ifram tag with some safe attributes
2121
whiteList['iframe'] = ['allowfullscreen', 'name', 'referrerpolicy', 'sandbox', 'src', 'width', 'height']
22-
// allow summary tag
22+
// allow details tag
23+
whiteList['details'] = []
24+
// allow summary tag for details
2325
whiteList['summary'] = []
26+
// allow ruby tag
27+
whiteList['ruby'] = []
28+
// allow rt tag for ruby
29+
whiteList['rt'] = []
30+
// allow figure tag
31+
whiteList['figure'] = []
32+
// allow figcaption tag
33+
whiteList['figcaption'] = []
2434

2535
var filterXSSOptions = {
2636
allowCommentTag: true,

0 commit comments

Comments
 (0)