custom char for bulletlist sphinx

时间秒杀一切 提交于 2021-01-28 05:25:37

问题


There is someway to change the the default bullet 'disc'/'circle' on sphinx ? i tried something like the solution from https://groups.google.com/forum/#!topic/sphinx-users/fNWyyRzoa8I but it doesn't work for me, possibly because i'm not familiar with html and css syntax.

_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 

output -> test.html:

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

回答1:


You are close. Here's the code you want.

_static/custom.css (li.squarelist is unnecessary):

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

test.rst (note correct directive and proper indentation):

.. rst-class:: squarelist

* foo
* bar

Yields:

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


来源:https://stackoverflow.com/questions/46613338/custom-char-for-bulletlist-sphinx

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!