def markdown_extract(text, extract_length=190):
''' return the plain text representation of markdown encoded text. That
is the texted without any html tags. If extract_length is 0 then it
will not be truncated.'''
if not text:
return ''
plain = RE_MD_HTML_TAGS.sub('', markdown(text))
if not extract_length or len(plain) < extract_length:
return literal(plain)
return literal(
unicode(
whtext.truncate(
plain,
length=extract_length,
indicator='...',
whole_word=True
)
)
)
评论列表
文章目录