def render(self): ''' Renders body into body_html, as Markdown for now Escapes any HTML added by the user. Converts any WikiWords into links ''' import markdown from toc import genTOC, header_permalinks # render self.content as Markdown md = markdown.Markdown( safe_mode="escape", extensions = ['toc'], extension_configs = { 'toc': [ ('anchorlink', True), ('title', 'Table of Contents'), ], }, ) rend = md.convert(self.content) # convert WikiWords to links, save in self.rendered self.rendered = wikify(rend)
def save(self, *args, **kwargs): self.rendered = wikify(self.content) super(Page, self).save(*args, **kwargs)
def save(self, *args, **kwargs): if not self.title: self.title = self.name self.rendered = wikify(self.content) super(Page, self).save(*args, **kwargs)