فهرست منبع

Merge pull request #8121 from kkthxbye-code/fix-8097

Fix #8097: Re-fix markdown table rendering
Jeremy Stretch 4 سال پیش
والد
کامیت
fa38cdbc0d

تفاوت فایلی نمایش داده نمی شود زیرا این فایل بسیار بزرگ است
+ 0 - 0
netbox/project-static/dist/netbox-dark.css


تفاوت فایلی نمایش داده نمی شود زیرا این فایل بسیار بزرگ است
+ 0 - 0
netbox/project-static/dist/netbox-light.css


تفاوت فایلی نمایش داده نمی شود زیرا این فایل بسیار بزرگ است
+ 0 - 0
netbox/project-static/dist/netbox-print.css


+ 13 - 0
netbox/project-static/styles/netbox.scss

@@ -965,6 +965,19 @@ div.card-overlay {
   max-width: unset;
 }
 
+/* Rendered Markdown */
+.rendered-markdown table {
+  width: 100%;
+}
+.rendered-markdown th {
+  border-bottom: 2px solid #dddddd;
+  padding: 8px;
+}
+.rendered-markdown td {
+  border-top: 1px solid #dddddd;
+  padding: 8px;
+}
+
 // Preformatted text blocks
 td pre {
   margin-bottom: 0

+ 2 - 2
netbox/templates/circuits/provider.html

@@ -41,11 +41,11 @@
                     </tr>
                     <tr>
                         <th scope="row">NOC Contact</th>
-                        <td class="rendered-markdown">{{ object.noc_contact|render_markdown|placeholder }}</td>
+                        <td>{{ object.noc_contact|render_markdown|placeholder }}</td>
                     </tr>
                     <tr>
                         <th scope="row">Admin Contact</th>
-                        <td class="rendered-markdown">{{ object.admin_contact|render_markdown|placeholder }}</td>
+                        <td>{{ object.admin_contact|render_markdown|placeholder }}</td>
                     </tr>
                     <tr>
                         <th scope="row">Circuits</th>

+ 1 - 1
netbox/templates/inc/panels/comments.html

@@ -4,7 +4,7 @@
   <h5 class="card-header">
     Comments
   </h5>
-  <div class="card-body rendered-markdown">
+  <div class="card-body">
     {% if object.comments %}
       {{ object.comments|render_markdown }}
     {% else %}

+ 4 - 0
netbox/utilities/templatetags/helpers.py

@@ -59,6 +59,10 @@ def render_markdown(value):
     # Render Markdown
     html = markdown(value, extensions=['fenced_code', 'tables', StrikethroughExtension()])
 
+    # If the string is not empty wrap it in rendered-markdown to style tables
+    if html:
+        html = f'<div class="rendered-markdown">{html}</div>'
+
     return mark_safe(html)
 
 

برخی فایل ها در این مقایسه diff نمایش داده نمی شوند زیرا تعداد فایل ها بسیار زیاد است