def content_as_html(self, index=False): if self.user.blog_truncate_posts and index: content = markdown_renderer.render(self.content) try: truncated = content[:300 + content[300:].index(" ")] truncate_end = " [...]<br / ><a href='{url}'>Click here to read the full article</a>".format( url=url_for('blog.get', user_slug=self.user.blog_slug, post_slug=self.title_slug) ) return BeautifulSoup(truncated + truncate_end) except Exception as e: return content else: return markdown_renderer.render(self.content)
def content_as_html(self, index=False): if self.user.blog_truncate_posts and index: content = markdown_renderer.render(self.content) try: truncated = content[:300 + content[300:].index(" ")] truncate_end = " [...]<br / ><a href='{url}'>Click here to read the full article</a>".format( url=url_for('blog.get', user_slug=self.user.blog_slug, post_slug=self.title_slug)) return BeautifulSoup(truncated + truncate_end) except Exception as e: return content else: return markdown_renderer.render(self.content)
def description_as_html(self): return markdown_renderer.render(self.blog_description)
def ajax_markdown_parser(): return markdown_renderer.render(request.json)