neutronX / django-markdownx

Comprehensive Markdown plugin built for Django
https://neutronx.github.io/django-markdownx/
Other
854 stars 153 forks source link

issue with blockquote #199

Closed harryghgim closed 3 years ago

harryghgim commented 3 years ago

When I use > to make a blockquote, it does not work.

I put {{ form.media }} in my template,

<!-- template file-->
  <div class="content-section">
    <form method="POST">
      {% csrf_token %}
      <fieldset class="form-group">
        <legend class="border-bottom mb-4">Blog Post</legend>
        {{ form|crispy }}
      </fieldset>
      <div class="form-group">
        <button id="post_btn" class="btn btn-outline-info" type="submit">Post</button>
      </div>
    </form>
    {{ form.media }}
  </div>
<!-- detail template-->
...
<p class="article-content">{{ post.formatted_markdown|truncatewords_html:50|safe }}</p>
...

and I used markdownify for the field.

# models.py
from markdownx.models import MarkdownxField
from markdownx.utils import markdownify

class Post(models.Model):
    ...
    content = MarkdownxField()
    ....

    @property
    def formatted_markdown(self):
        return markdownify(self.content)

And this is the screenshot

Screen Shot 2021-01-31 at 12 18 40 AM

Any guidance would be much appreciated. Thanks.

harryghgim commented 3 years ago

Sorry. It was not the issue with this package, but with css file. I didn't have any style for blockquote tag, so even if >in the textarea wraps text in blockquote, preview shows no change. I solved the problem by emulating github markdown style by putting css file of andyferra in my base template. Thus I close this issue.