pip install markdown python 3 code example
Example: python package markdown2 how to use
def save(self, commit=True):
author = self.cleaned_data['author']
title = self.cleaned_data['title']
content = self.cleaned_data['content']
markdown = Markdown()
html = markdown.convert(content)
post = Post(author=author, title=title, content=content, html=html)
post.save()
tags_text = self.cleaned_data['tags']
tag_names = split_tags(tags_text)
for tag_name in tag_names:
tag_name.strip()
if 0 < len(tag_name) < 16:
tag = self.create_and_get(tag_name)
post.tags.add(tag)
return self.instance