pylixm / django-mdeditor

Django-mdeditor is Markdown Editor plugin application for django base on Editor.md.
https://pypi.org/project/django-mdeditor/
GNU General Public License v3.0
481 stars 103 forks source link

How can I truncate markdown text? #119

Closed caprioara closed 3 years ago

caprioara commented 3 years ago

Hello guys. I am trying to truncate my content field in template and I dont know how.

This is my content in model:

class BlogPost(models.Model):
    content  = MDTextField(default=' ')

Is there any way to do it? His is what i found on internet {{ blog_post.content | custom_markdown | truncatechars_html:300 }} but it didnt work either

caprioara commented 3 years ago

It seems like it works like this:

<div id="content"><textarea> {{blog_post.content|truncatechars_html:500}} </textarea></div>

It was my template that has a problem