【问题标题】:custom char for bulletlist sphinx子弹列表狮身人面像的自定义字符
【发布时间】:2018-03-18 17:00:32
【问题描述】:

有什么办法可以改变 sphinx 上的默认项目符号 'disc'/'circle' 吗?我尝试了类似https://groups.google.com/forum/#!topic/sphinx-users/fNWyyRzoa8I 的解决方案,但它对我不起作用,可能是因为我不熟悉 html 和 css 语法。

_static/custom.css:

ul.squarelist {                     
    list-style-type: square;  
    margin-left: 0;            
    padding-left: 0;           
}                              
li.squarelist {                     
    padding-left: 1em;         
    text-indent: -1em;         
}                              

test.rst:

.. cssclass:: squarelist    

    * foo             
    * bar 

输出-> test.html:

<ul class="check simple">           
<li>foo</li>                                
<li>bar</li>                   
</ul>                               

【问题讨论】:

    标签: html css customization python-sphinx restructuredtext


    【解决方案1】:

    你很接近。这是你想要的代码。

    _static/custom.css(不需要li.squarelist):

    ul.squarelist {
        list-style-type: square;
        margin-left: 0;
        padding-left: 0;
    }
    

    test.rst(注意正确的指令和正确的缩进):

    .. rst-class:: squarelist
    
    * foo
    * bar
    

    产量:

    <ul class="squarelist simple">
    <li>foo</li>
    <li>bar</li>
    </ul>
    

    【讨论】:

    • 谢谢!它适用于默认主题,但不适用于阅读文档(sphinx_rdt_theme)。知道为什么吗?
    • HTML 渲染是否相同?您是否正确拼写了主题(您调换了“t”和“d”)?您的custom.css 是在 RTD 上复制还是丢失并返回 404?您是否有在线示例可以分享以供进一步检查?
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多