Skip to content

Commit

Permalink
Extend whitelisted markdown html tags (#169)
Browse files Browse the repository at this point in the history
  • Loading branch information
anders-kiaer authored Dec 16, 2019
1 parent b66c716 commit 0ab0929
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 20 deletions.
7 changes: 7 additions & 0 deletions examples/example-markdown.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,13 @@ Hi from a Markdown container containing Norwegian letters (æ ø å), some
> tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam,
> quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
#### Collapsible text

<details>
<summary>This is the title of some detailed information</summary>
Here is some more information, which can be extended/collapsed on demand.
</details>

#### An example table

First Header | Second Header
Expand Down
54 changes: 34 additions & 20 deletions webviz_config/containers/_markdown.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,45 +96,59 @@ class Markdown(WebvizContainerABC):
"""

ALLOWED_TAGS = [
"a",
"b",
"blockquote",
"br",
"cite",
"code",
"dd",
"del",
"details",
"div",
"dl",
"dt",
"em",
"h1",
"h2",
"h3",
"h4",
"h5",
"h6",
"b",
"hr",
"i",
"strong",
"em",
"tt",
"img",
"ins",
"li",
"mark",
"ol",
"p",
"br",
"pre",
"q",
"s",
"span",
"div",
"blockquote",
"code",
"hr",
"ul",
"ol",
"li",
"dd",
"dt",
"img",
"a",
"strong",
"sub",
"summary",
"sup",
"table",
"thead",
"tbody",
"tr",
"th",
"td",
"th",
"thead",
"tr",
"ul",
]

ALLOWED_ATTRIBUTES = {
"*": ["id", "class", "style"],
"img": ["src", "alt", "title", "style"],
"a": ["href", "alt", "title"],
"details": ["open"],
"img": ["src", "alt", "title", "style"],
"li": ["value"],
"ol": ["reversed", "start", "type"],
"td": ["colspan", "rowspan"],
"th": ["colspan", "rowspan", "scope"],
}

ALLOWED_STYLES = ["width", "height"]
Expand Down

0 comments on commit 0ab0929

Please sign in to comment.