[website] parse markdown
This commit is contained in:
parent
59306e76d5
commit
fa938045ed
2 changed files with 4 additions and 5 deletions
|
|
@ -9,6 +9,7 @@ from frappe.website.website_generator import WebsiteGenerator
|
|||
from frappe.website.render import clear_cache
|
||||
from frappe.utils import today, cint, global_date_format, get_fullname
|
||||
from frappe.website.utils import find_first_image, get_comment_list
|
||||
from markdown2 import markdown
|
||||
|
||||
class BlogPost(WebsiteGenerator):
|
||||
save_versions = True
|
||||
|
|
@ -64,6 +65,9 @@ class BlogPost(WebsiteGenerator):
|
|||
"description": context.description,
|
||||
}
|
||||
|
||||
if "<!-- markdown -->" in context.content:
|
||||
context.content = markdown(context.content)
|
||||
|
||||
image = find_first_image(self.content)
|
||||
if image:
|
||||
context.metatags["image"] = image
|
||||
|
|
|
|||
|
|
@ -49,11 +49,6 @@ def render_blocks(context):
|
|||
if "title" not in out:
|
||||
out["title"] = context.get("title")
|
||||
|
||||
# markdown
|
||||
if "<!-- markdown -->" in out.get("content", ""):
|
||||
out["content"] = markdown(out["content"])
|
||||
|
||||
|
||||
# header
|
||||
if out["no_header"]:
|
||||
out["header"] = ""
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue