Cache Markdown'ed HTML in database
This is done via coercion rules. To cache the field 'content' in the database, include this in your Eve schema: {'content': {'type': 'string', 'coerce': 'markdown'}, '_content_html': {'type': 'string'}} The `_content_html` field will be filled automatically when saving the document via Eve. To display the cached HTML, and fall back to display-time rendering if it is not there, use `{{ document | markdowned('content') }}` in your template. Still needs unit testing, a CLI command for regenerating the caches, and a CLI command for migrating the node type definitions in existing projects.
This commit is contained in:
@@ -11,7 +11,7 @@
|
||||
.comment-body
|
||||
p.comment-author {{ comment._user.full_name }}
|
||||
|
||||
span {{comment.properties.content_html | safe }}
|
||||
span {{comment.properties._content_html | safe }}
|
||||
|
||||
// TODO: Markdown preview when editing
|
||||
|
||||
|
Reference in New Issue
Block a user