mirror of
https://github.com/inventree/InvenTree.git
synced 2025-04-28 03:26:45 +00:00
Add docs for rendering markdown content (#9364)
This commit is contained in:
parent
fe807cb826
commit
fc5b8479cb
@ -86,8 +86,6 @@ A number of helper functions are available for accessing database objects:
|
|||||||
|
|
||||||
The `filter_queryset` function allows for arbitrary filtering of the provided querysert. It takes a queryset and a list of filter arguments, and returns a filtered queryset.
|
The `filter_queryset` function allows for arbitrary filtering of the provided querysert. It takes a queryset and a list of filter arguments, and returns a filtered queryset.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
::: report.templatetags.report.filter_queryset
|
::: report.templatetags.report.filter_queryset
|
||||||
options:
|
options:
|
||||||
show_docstring_description: false
|
show_docstring_description: false
|
||||||
@ -513,6 +511,26 @@ A [Part Parameter](../part/parameter.md) has the following available attributes:
|
|||||||
| Units | The *units* of the parameter (e.g. "km") |
|
| Units | The *units* of the parameter (e.g. "km") |
|
||||||
| Template | A reference to a [PartParameterTemplate](../part/parameter.md#parameter-templates) |
|
| Template | A reference to a [PartParameterTemplate](../part/parameter.md#parameter-templates) |
|
||||||
|
|
||||||
|
## Rendering Markdown
|
||||||
|
|
||||||
|
Some data fields (such as the *Notes* field available on many internal database models) support [markdown formatting](https://en.wikipedia.org/wiki/Markdown). To render markdown content in a custom report, there are template filters made available through the [django-markdownify](https://github.com/erwinmatijsen/django-markdownify) library. This library provides functionality for converting markdown content to HTML representation, allowing it to be then rendered to PDF by the InvenTree report generation pipeline.
|
||||||
|
|
||||||
|
To render markdown content in a report, consider the following simplified example:
|
||||||
|
|
||||||
|
```html
|
||||||
|
{% raw %}
|
||||||
|
|
||||||
|
{% load markdownify %}
|
||||||
|
|
||||||
|
<h3>Part Notes</h3>
|
||||||
|
<p>
|
||||||
|
{{ part.notes | markdownify }}
|
||||||
|
</p>
|
||||||
|
{% endraw %}
|
||||||
|
```
|
||||||
|
|
||||||
|
You can read further details in the [django-markdownify documentation](https://django-markdownify.readthedocs.io/en/latest/).
|
||||||
|
|
||||||
## List of tags and filters
|
## List of tags and filters
|
||||||
|
|
||||||
The following tags and filters are available.
|
The following tags and filters are available.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user