Browse Source

Markdown: add <details>+<summary> to whitelist

This allows creating collapsible sections, which will probably be
especially useful in wiki pages.
merge-requests/76/merge
Deimos 5 years ago
parent
commit
b196d6cc17
  1. 5
      tildes/scss/_base.scss
  2. 6
      tildes/scss/_placeholders.scss
  3. 2
      tildes/scss/modules/_topic.scss
  4. 3
      tildes/tildes/lib/markdown.py

5
tildes/scss/_base.scss

@ -50,6 +50,11 @@ dl dd {
font-size: 0.7rem;
}
details:not([open]) {
cursor: pointer;
display: inline-block;
}
// Fixes a Chrome bug that seems to treat children of <details> as having
// box-sizing: content-box. See Known issues: https://caniuse.com/#feat=details
details * {

6
tildes/scss/_placeholders.scss

@ -11,6 +11,12 @@
}
}
details {
margin-bottom: 0.4rem;
padding: 0.2rem 0.4rem;
border: 1px dotted;
}
hr {
margin-left: 0;
max-width: $paragraph-max-width;

2
tildes/scss/modules/_topic.scss

@ -182,7 +182,7 @@
line-height: 0.8rem;
}
summary::after {
> summary::after {
font-style: italic;
content: "Re-collapse topic text";
display: none;

3
tildes/tildes/lib/markdown.py

@ -63,6 +63,7 @@ HTML_TAG_WHITELIST = (
"br",
"code",
"del",
"details",
"em",
"h1",
"h2",
@ -80,6 +81,7 @@ HTML_TAG_WHITELIST = (
"small",
"strong",
"sub",
"summary",
"sup",
"span",
"table",
@ -94,6 +96,7 @@ PROTOCOL_WHITELIST = ("http", "https", "mailto")
HTML_ATTRIBUTE_WHITELIST_DEFAULT = {
"a": ["href", "title"],
"details": ["open"],
"ol": ["start"],
"td": ["align"],
"th": ["align"],

Loading…
Cancel
Save