From 0813db666b4c903bd7353620cc2f0a80ab03b9ff Mon Sep 17 00:00:00 2001 From: Brian Tiemann Date: Thu, 22 Aug 2024 14:09:29 -0400 Subject: [PATCH] Remove clamp_height option, apply scrolling style to all markdown divs inside td's --- netbox/project-static/dist/netbox.css | Bin 543409 -> 543393 bytes .../styles/custom/_markdown.scss | 8 +++----- .../templates/builtins/customfield_value.html | 2 +- .../templatetags/builtins/filters.py | 13 ++----------- 4 files changed, 6 insertions(+), 17 deletions(-) diff --git a/netbox/project-static/dist/netbox.css b/netbox/project-static/dist/netbox.css index dcc103d85d3afb9a3c05594081549e11a2f6f51a..8460154e6b6b03969910d15c80ba811b618799bb 100644 GIT binary patch delta 46 zcmdluRdL}|#fBEf7N!>F7M2#)7Pc1lEgb7TrhoC^P?>(-gF|%sdJhhT?Gm0GGZ_Jj C9}naJ delta 79 zcmZ2DRdM4~#fBEf7N!>F7M2#)7Pc1lEgb7TroZsuP*5#NvC}I`%}YrwN=?ztO)Sbz j$uG~-D@!dZ$xKen(Jf9c%FoG}zTSgFWjlu_$4o{5e9s(% diff --git a/netbox/project-static/styles/custom/_markdown.scss b/netbox/project-static/styles/custom/_markdown.scss index fb9182a19..32ef7a09c 100644 --- a/netbox/project-static/styles/custom/_markdown.scss +++ b/netbox/project-static/styles/custom/_markdown.scss @@ -30,16 +30,14 @@ // Remove the bottom margin of

elements inside a table cell td > .rendered-markdown { + max-height: 200px; + overflow-y: scroll; + p:last-of-type { margin-bottom: 0; } } -td > .rendered-markdown.vertical-scroll { - max-height: 200px; - overflow-y: scroll; -} - // Markdown preview .markdown-widget { .preview { diff --git a/netbox/utilities/templates/builtins/customfield_value.html b/netbox/utilities/templates/builtins/customfield_value.html index 7fe8d1eff..dbf10e1bf 100644 --- a/netbox/utilities/templates/builtins/customfield_value.html +++ b/netbox/utilities/templates/builtins/customfield_value.html @@ -3,7 +3,7 @@ {% if customfield.type == 'integer' and value is not None %} {{ value }} {% elif customfield.type == 'longtext' and value %} - {{ value|markdown:True }} + {{ value|markdown }} {% elif customfield.type == 'boolean' and value == True %} {% checkmark value true="True" %} {% elif customfield.type == 'boolean' and value == False %} diff --git a/netbox/utilities/templatetags/builtins/filters.py b/netbox/utilities/templatetags/builtins/filters.py index 03c91b132..738b9a23e 100644 --- a/netbox/utilities/templatetags/builtins/filters.py +++ b/netbox/utilities/templatetags/builtins/filters.py @@ -159,16 +159,11 @@ def content_type_id(model): # @register.filter('markdown', is_safe=True) -def render_markdown(value, clamp_height=False): +def render_markdown(value): """ Render a string as Markdown. This filter is invoked as "markdown": {{ md_source_text|markdown }} - - If clamp_height is True, the "vertical-scroll" class will be added to the container div which sets a max-height - and adds a vertical scrollbar: - - {{ md_source_text|markdown:True }} """ if not value: return '' @@ -183,11 +178,7 @@ def render_markdown(value, clamp_height=False): # If the string is not empty wrap it in rendered-markdown to style tables if html: - classes = ['rendered-markdown'] - if clamp_height: - classes.append('vertical-scroll') - classes_str = ' '.join(classes) - html = f'

{html}
' + html = f'
{html}
' schemes = get_config().ALLOWED_URL_SCHEMES