diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 01ec8189..6b9319b1 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -13,6 +13,7 @@ Added - **Projectroles** - Info link for finder role in ``ProjectRoleView`` (#1511) + - Table and strikethrough support in ``render_markdown()`` (#1272) - **Timeline** - User count in siteinfo stats (#1504) - Plugin tests (#1506) diff --git a/adminalerts/templates/adminalerts/alert_detail.html b/adminalerts/templates/adminalerts/alert_detail.html index 6fb8c1cf..3c425d1b 100644 --- a/adminalerts/templates/adminalerts/alert_detail.html +++ b/adminalerts/templates/adminalerts/alert_detail.html @@ -37,10 +37,9 @@

Admin Alert


-
- {% autoescape off %} - {% render_markdown object.description.raw %} - {% endautoescape %} +
+ {% render_markdown object.description.raw as desc %} + {{ desc | safe }}
{% endif %} diff --git a/docs/source/major_changes.rst b/docs/source/major_changes.rst index a1c8ce14..9750b5ab 100644 --- a/docs/source/major_changes.rst +++ b/docs/source/major_changes.rst @@ -19,6 +19,7 @@ Release Highlights - Add auth type in user profile details card - Add user count in timeline siteinfo statistics - Add finder role info link in member list +- Add table and strikethrough support for markdown content - Fix invite create view redirect failing in categories - Fix role promoting crash as delegate with delegate limit reached - Fix requiring deprecated SODAR API settings in tests diff --git a/projectroles/static/projectroles/css/pagedown.css b/projectroles/static/projectroles/css/pagedown.css index 22fe5d6b..cbc54835 100644 --- a/projectroles/static/projectroles/css/pagedown.css +++ b/projectroles/static/projectroles/css/pagedown.css @@ -1,131 +1,121 @@ body { - /* HACK for non-working CSS override in django-pagedown */ - font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, - "Helvetica Neue", Arial, "Noto Sans", sans-serif, - "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", - "Noto Color Emoji"; + /* HACK for non-working CSS override in django-pagedown */ + font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, + "Helvetica Neue", Arial, "Noto Sans", sans-serif, + "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", + "Noto Color Emoji"; } blockquote { - border-left: 2px dotted #888; - padding-left: 5px; - background: #d0f0ff; + border-left: 2px dotted #888; + padding-left: 5px; + background: #d0f0ff; } -.wmd-panel -{ +.wmd-panel { margin-left: 0; margin-right: 0; width: 100%; resize: vertical; } -.wmd-button-bar -{ - width: 100%; - background-color: #fff; +.wmd-button-bar { + width: 100%; + background-color: #fff; } .wmd-input, -.sodar-json-input -{ - height: 175px !important; - min-height: 175px; - width: 100%; - background-color: Gainsboro; - border: 1px solid DarkGray; - resize: vertical; +.sodar-json-input { + height: 175px !important; + min-height: 175px; + width: 100%; + background-color: Gainsboro; + border: 1px solid DarkGray; + resize: vertical; } -.wmd-preview -{ - background-color: #c0e0ff; +.wmd-preview { + padding: 12px; + background-color: #c0e0ff; } -.wmd-button-row -{ - position: relative; - margin-left: 5px; - margin-right: 5px; - margin-bottom: 5px; - margin-top: 10px; - padding: 0px; - height: 20px; +.wmd-button-row { + position: relative; + margin: 10px 5px 5px; + padding: 0; + height: 20px; } -.wmd-spacer -{ - width: 1px; - height: 20px; - margin-left: 14px; - - position: absolute; - background-color: Silver; - display: inline-block; - list-style: none; +.wmd-spacer { + width: 1px; + height: 20px; + margin-left: 14px; + position: absolute; + background-color: Silver; + display: inline-block; + list-style: none; } .wmd-button { - width: 20px; - height: 20px; - padding-left: 2px; - padding-right: 3px; - position: absolute; - display: inline-block; - list-style: none; - cursor: pointer; + width: 20px; + height: 20px; + padding-left: 2px; + padding-right: 3px; + position: absolute; + display: inline-block; + list-style: none; + cursor: pointer; } .wmd-button > span { - background-image: url(../images/wmd-buttons.png); - background-repeat: no-repeat; - background-position: 0px 0px; - width: 20px; - height: 20px; - display: inline-block; + background-image: url(../images/wmd-buttons.png); + background-repeat: no-repeat; + background-position: 0px 0px; + width: 20px; + height: 20px; + display: inline-block; } -.wmd-spacer1 -{ - left: 50px; +.wmd-spacer1 { + left: 50px; } -.wmd-spacer2 -{ - left: 175px; +.wmd-spacer2 { + left: 175px; } -.wmd-spacer3 -{ - left: 300px; +.wmd-spacer3 { + left: 300px; } - - - -.wmd-prompt-background -{ - background-color: Black; +.wmd-prompt-background { + background-color: Black; } -.wmd-prompt-dialog -{ - border: 1px solid #999999; - background-color: #F5F5F5; +.wmd-prompt-dialog { + border: 1px solid #999999; + background-color: #F5F5F5; } .wmd-prompt-dialog > div { - font-size: 0.8em; - font-family: arial, helvetica, sans-serif; + font-size: 0.8em; + font-family: arial, helvetica, sans-serif; } - .wmd-prompt-dialog > form > input[type="text"] { - border: 1px solid #999999; - color: black; + border: 1px solid #999999; + color: black; +} + +.wmd-prompt-dialog > form > input[type="button"] { + border: 1px solid #888888; + font-family: trebuchet MS, helvetica, sans-serif; + font-size: 0.8em; + font-weight: bold; } -.wmd-prompt-dialog > form > input[type="button"]{ - border: 1px solid #888888; - font-family: trebuchet MS, helvetica, sans-serif; - font-size: 0.8em; - font-weight: bold; +.wmd-preview table, +.wmd-preview table thead th, +.wmd-preview table tbody td { + border: 1px solid #000000; + padding-left: 5px; + padding-right: 5px; } diff --git a/projectroles/static/projectroles/css/projectroles.css b/projectroles/static/projectroles/css/projectroles.css index 5d14e241..79bc65cc 100644 --- a/projectroles/static/projectroles/css/projectroles.css +++ b/projectroles/static/projectroles/css/projectroles.css @@ -765,29 +765,37 @@ pre#sodar-email-body { } } +/* Tables within markdown elements */ -/* Responsive modifications ------------------------------------------------- */ +.sodar-markdown-content table { + margin-bottom: 12px !important; +} +.sodar-markdown-content table, +.sodar-markdown-content table thead th, +.sodar-markdown-content table tbody td { + border: 1px solid #ced4da; + padding-left: 5px; + padding-right: 5px; +} -/* - Used to hide/show extra content based on browser window width. - */ +/* Responsive modifications ------------------------------------------------- */ +/* Used to hide/show extra content based on browser window width. */ .sodar-navbar-alt-item { display: none; } -/* Navbar (width)*/ +/* Navbar (width) */ + @media screen and (max-width: 990px) { .sodar-navbar-user-dropdown { display: none; } - .sodar-navbar-alt-item { display: inherit; } - .sodar-navbar-search { width: 250px; padding-top: 10px; diff --git a/projectroles/templates/projectroles/project_detail.html b/projectroles/templates/projectroles/project_detail.html index feac3c16..56e41cc5 100644 --- a/projectroles/templates/projectroles/project_detail.html +++ b/projectroles/templates/projectroles/project_detail.html @@ -56,11 +56,10 @@

ReadMe

-
+
{% if object.readme.rendered|length > 0 %} - {% autoescape off %} - {% render_markdown object.readme.raw %} - {% endautoescape %} + {% render_markdown object.readme.raw as readme %} + {{ readme | safe }} {% else %}

No ReadMe is currently set for this {% get_display_name object.type title=False %}. diff --git a/projectroles/templatetags/projectroles_common_tags.py b/projectroles/templatetags/projectroles_common_tags.py index 98b01642..d76ad8ac 100644 --- a/projectroles/templatetags/projectroles_common_tags.py +++ b/projectroles/templatetags/projectroles_common_tags.py @@ -295,7 +295,7 @@ def get_remote_icon(project, request): @register.simple_tag def render_markdown(raw_markdown): """Markdown field rendering helper""" - return mistune.markdown(raw_markdown) + return mistune.html(raw_markdown) @register.filter