Skip to content

Commit 95969c4

Browse files
Merge pull request #6537 from maximumG/6527-report-description-makdown
feat: markdown support in report's description
2 parents 46ecb0a + 10c9954 commit 95969c4

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

docs/additional-features/reports.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ class DeviceConnectionsReport(Report):
8080
self.log_success(device)
8181
```
8282

83-
As you can see, reports are completely customizable. Validation logic can be as simple or as complex as needed.
83+
As you can see, reports are completely customizable. Validation logic can be as simple or as complex as needed. Also note that the `description` attribute support markdown syntax. It will be rendered in the report list page.
8484

8585
!!! warning
8686
Reports should never alter data: If you find yourself using the `create()`, `save()`, `update()`, or `delete()` methods on objects within reports, stop and re-evaluate what you're trying to accomplish. Note that there are no safeguards against the accidental alteration or destruction of data.
@@ -93,7 +93,7 @@ The following methods are available to log results within a report:
9393
* log_warning(object, message)
9494
* log_failure(object, message)
9595

96-
The recording of one or more failure messages will automatically flag a report as failed. It is advised to log a success for each object that is evaluated so that the results will reflect how many objects are being reported on. (The inclusion of a log message is optional for successes.) Messages recorded with `log()` will appear in a report's results but are not associated with a particular object or status.
96+
The recording of one or more failure messages will automatically flag a report as failed. It is advised to log a success for each object that is evaluated so that the results will reflect how many objects are being reported on. (The inclusion of a log message is optional for successes.) Messages recorded with `log()` will appear in a report's results but are not associated with a particular object or status. Log messages also support using markdown syntax and will be rendered on the report result page.
9797

9898
To perform additional tasks, such as sending an email or calling a webhook, after a report has been run, extend the `post_run()` method. The status of the report is available as `self.failed` and the results object is `self.result`.
9999

netbox/templates/extras/report.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
{% endif %}
3030
<h1 class="title">{{ report.name }}</h1>
3131
{% if report.description %}
32-
<p class="lead">{{ report.description }}</p>
32+
<p class="lead">{{ report.description|render_markdown }}</p>
3333
{% endif %}
3434
{% endblock %}
3535

netbox/templates/extras/report_list.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ <h3><a name="module.{{ module }}"></a>{{ module|bettertitle }}</h3>
2929
<td>
3030
{% include 'extras/inc/job_label.html' with result=report.result %}
3131
</td>
32-
<td>{{ report.description|placeholder }}</td>
32+
<td class="rendered-markdown">{{ report.description|render_markdown|placeholder }}</td>
3333
<td class="text-right">
3434
{% if report.result %}
3535
<a href="{% url 'extras:report_result' job_result_pk=report.result.pk %}">{{ report.result.created }}</a>

0 commit comments

Comments
 (0)