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

欢迎加入QQ群-->: 979659372 Python中文网_新手群

推荐PyPI第三方库


热门话题
如何使用运行时从JAVA运行openssl命令?   不使用线程安全类(如AtomicInteger和SynchronizedList)的java ProducerConsumer问题   匹配字符串的java模式   在java中使用泛型接口作为返回类型   java将可能具有序列化JSON值的hashmap作为节点添加到JSON字符串中   Eclipse无法从Java8流推断正确的类型   java无法了解标准JButton的大小   java我能用一个循环优化这个函数吗(在第一种方法中)?   Apache CXF中基于WebSocket的java SOAP?   java想要运行奇偶和求和三步   矩阵上随机元素的java集值   java布尔相等:0==a,操作数顺序重要吗?   java Eclipse不会退出我的插件   java如何在spring的SOAP拦截器中获取HttpServletRequest和HttpServletResponse