On Sat, Aug 8, 2020, 5:37 AM Yves Chevallier <canard...@gmail.com> wrote:

> I am wondering why Sphinx/Docutils add a paragraph around minor text:
>
> The list:
>
> ```rst
> - foo
> - bar
> - baz
> ```
>
> Will be translated in HTML as:
>
> ```html
> <li><p>foo</p></li>
> <li><p>bar</p></li>
> <li><p>baz</p></li>
> ```
>
> In some case it gives bad formatting especially if `<p>` has some margins.
>
> By default docutils removes these `<p>`:
>
> ```python
> >>> from docutils import core
> >>> print(core.publish_parts('''
> - a
> - b
> - c
> ''', writer_name='html')['html_body']))
> <div class="document">
> <ul class="simple">
> <li>a</li>
> <li>b</li>
> <li>c</li>
> </ul>
> </div>
> ```
>
> But behind the scenes they are still there...
>
> ```python
> >>> from docutils import core
> >>> print(core.publish_parts('''
> - a
> - b
> - c
> ''')['whole'])
> <document source="<string>">
>     <bullet_list bullet="-">
>         <list_item>
>             <paragraph>
>                 a
>         <list_item>
>             <paragraph>
>                 b
>         <list_item>
>             <paragraph>
>                 c
> ```
>
> Why is sphinx acting differently? Is there a way to tell Sphinx to not add
> paragraphs in such cases?
>
> --
> You received this message because you are subscribed to the Google Groups
> "sphinx-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to sphinx-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/sphinx-users/f85679d1-395c-4f05-b342-d844c0225e19n%40googlegroups.com
> <https://groups.google.com/d/msgid/sphinx-users/f85679d1-395c-4f05-b342-d844c0225e19n%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"sphinx-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sphinx-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sphinx-users/CAELGjd90DqAhFtaNyM_ddt%2BkJw4mTtodg12KO6XVDcCQsLvPcg%40mail.gmail.com.

Reply via email to