You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Extension for Python-Markdown to handle <figure> and <figcaption>.
Usage
%%% start a <figure>
%: start a <figcaption>
frommarkdownimportMarkdowntext=r'''%%%%%% figure-class here {: img-attributes here} %: figcaption here {: figcaption-attributes here}%: will not be a figcaption'''md=Markdown(extensions=['markdown_figcap','attr_list'])
print(md.convert(text))
Output:
<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>
Notice
The attributes rendering (except <figure>'s class) is supported by the origin Python-Markdown's attr_list extension.
Figure starter only will not be rendered as <figure>.
Figcaption starter will not take effect until it is in the figure block.
If the <p> in <figure> has no text and only one <img> child, the <p> tag will be got rid of.