python标记处理<figure>和<figcaption>的扩展。
markdown-figcap的Python项目详细描述
降价图
用于Python-Markdown处理<figure>
和<figcaption>
的扩展。
用法
%%%
开始一个<figure>
%:
启动一个<figcaption>
frommarkdownimportMarkdowntext=r'''%%%%%% figure-class here ![img-alt](/source/of/img.jpg){: img-attributes here} %: figcaption here {: figcaption-attributes here}%: will not be a figcaption'''md=Markdown(extensions=['markdown_figcap','attr_list'])print(md.convert(text))
输出:
<p>%%%</p><figureclass="figure-class here"><imgalt="img-alt"here="here"img-attributes="img-attributes"src="/source/of/img.jpg"/><figcaptionfigcaption-attributes="figcaption-attributes"here="here">figcaption here</figcaption></figure><p>%: will not be a figcaption</p>
注意
- 源Python-Markdown的^{
} 扩展支持属性呈现(除了<figure>
的类)。 - 图starter only不会呈现为
<figure>
。 - figcaption starter只有在
figure
块中才能生效。 - 如果
<figure>
中的<p>
没有文本并且只有一个子项,则<img>
标记将被删除。
安装
来自PyPI:
pip install markdown-figcap