import markdown html = markdown.markdown(text, extensions=['abbr'])
text
- разметка Markdown,extensions
- список расширений модуля.Расширение markdown.extensions.abbr
добавляет возможность определять сокращения. В частности, любое сокращение заключенное в HTML тег <abbr>
.
Например, следующая разметка Markdown:
The HTML specification is maintained by the W3C. *[HTML]: Hyper Text Markup Language *[W3C]: World Wide Web Consortium
Преобразуется в следующий HTML-текст
<p>The <abbr title="Hyper Text Markup Language">HTML</abbr> specification is maintained by the <abbr title="World Wide Web Consortium">W3C</abbr>.</p>
abbr
:import markdown text = """ The HTML specification is maintained by the W3C. *[HTML]: Hyper Text Markup Language *[W3C]: World Wide Web Consortium """ html = markdown.markdown(text, extensions=['abbr']) print(html) # <p>The <abbr title="Hyper Text Markup Language">HTML</abbr> specification # is maintained by the <abbr title="World Wide Web Consortium">W3C</abbr>.</p>