Closed ghost closed 7 years ago
Can you be more specific? Do you get the right HTML output?
Yeah, I got the right HTML output, but in my page can't show the table, just like above, the table have no border, here is my Django model code:
class Article(models.Model):
title = models.CharField('Title', max_length=300)
content = models.TextField()
content_html = models.TextField(null=True)
last_edit = models.DateTimeField('Last Edit', auto_now=True)
timestamp = models.DateTimeField('Create Time', default=datetime.datetime.now)
tags = models.ManyToManyField(Tag, blank=True)
excerpt_img_url = models.URLField(max_length=500, null=True)
excerpt_content = models.TextField(blank=True)
@staticmethod
def content_changed(sender, instance, **kwargs):
renderer = HighlighterRenderer()
markdown = misaka.Markdown(renderer, extensions=('tables',
'fenced-code', 'footnotes', 'autolink',
'strikethrough', 'underline', 'highlight',
'quote', 'superscript', 'math'))
instance.content_html = markdown(instance.content)
soup = BeautifulSoup(instance.content_html, 'html.parser')
if soup.find('img') is not None:
instance.excerpt_img_url = soup.find('img')['src']
instance.excerpt_content = bleach.clean(instance.content_html,
tags=['a', 'b'], strip=True)
def __str__(self):
return self.title
pre_save.connect(Article.content_changed, sender=Article)
Ok, looks correct. Did you also check the CSS?
I have no CSS style about the table.
Try to add it. Maybe it works.
It work after add the CSS style for it. Why the library can't do that?
That's not Misaka's job. I would have to inline CSS, which is wrong and causes conflicts with the CSS of the user/developer.
I can‘t use the markdown syntax to insert a table, I input this:
then I get this:
It should be like this:
How can I get the normal table?