Beispiel #1
0
def get_html(
    mapper: Type[sa.orm.Mapper], connection: sa.engine.Connection, target: sa.orm.Mapper
) -> None:
    if target.ptype == "html":
        target.html = target.content
    else:
        target.html = markdown(target.content)
Beispiel #2
0
def render_markdown(mapper: Type[sa.orm.Mapper],
                    connection: sa.engine.Connection,
                    target: sa.orm.Mapper) -> None:
    if not target.slug:
        target.slug = slugify(target.title)
    if not target.date:
        target.date = datetime.utcnow()
    target.html = markdown(target.content)
    target.toc = markdown.renderer.render_toc()
    target.url = "/{}/{}".format(target.date.strftime("%Y/%m-%d"), target.slug)
Beispiel #3
0
def comment_html(mapper: Type[sa.orm.Mapper], connection: sa.engine.Connection,
                 target: sa.orm.Mapper) -> None:
    # Use a more strict version of markdown parser for untrusted source.
    target.html = strict_markdown(target.content)
Beispiel #4
0
def comment_html(
    mapper: Type[sa.orm.Mapper], connection: sa.engine.Connection, target: sa.orm.Mapper
) -> None:
    target.html = markdown(target.content)