From: Guenter M. <mi...@us...> - 2016-03-15 20:24:09
|
On 2016-03-15, Tom Roche wrote: > summary: >======== > I have a reST doc with an image followed by a section header. I want > the header to render below the image, but it sometimes renders {to the > right of, on the same line as} the image. How to fix? The usual fix would be to fix the CSS rules for display (assuming this is about HTML output). There is no provision in rST regarding this layout detail. > details: >======== > document > -------- ... >> This project's content is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the `GNU Affero General Public License <./COPYING>`_ for more details. >> .. image:: ./images/Affero_badge__agplv3-155x51.png >> :scale: 100 % >> :alt: distributed under the GNU Affero General Public License >> :align: left >> overview >> ======== > rendering > --------- > BB currently renders this as I want: see > https://bitbucket.org/epa_n2o_project_team/aqmeii-na_n2o/wiki/Home#rst-header-open-source-notice > You should see (please lemme know if not--I'm using Firefox on Linux) > an image (the AGPL3 badge) above the section header='overview', as if > they were on separate lines of the page. > However, in my experience, BB's renderer is quirky. By contrast, `restview` > https://mg.pov.lt/restview/ > seems more DocUtils-compliant; moreover it runs locally, so I use it to > check my documents before commiting them to my local repo and `git > push`ing the repo to BitBucket. And `restview` renders the image to the > *left* of the header='overview', as if they were on the same line of > the page ... > So I'm guessing `restview`s rendering is more faithful to "the > standard" (am I missing something?) and I'm fearing that BB's renderer > will in future become more standard-compliant. There is no "standard" regarding the layout, just a default behaviour due to the shipped CSS files. You may try to compile your file (or a minimal example) with Docutils' rst2html and inspec the result. > solution > -------- > (I'm not quite sure what the appropriate terminology is for what I > want: please correct as needed.) > Is there a way to > * cause an image to break text flow, so that no other document text > (including section headers) appears left or right of the image, but > only above and below? > * force text (including section headers) to start on a new line, with > nothing to its left or right? The recommended way for this is to style the output with CSS. This may become hard if the processing is done somewhere on the net, you might have to ask there for possibilities to use custom CSS files. You could define CSS rules in the source in an "raw" role. However, this is not nice, must be done in every document and results in non-valid HTML (defining CSS in the <body> is not allowed) (while still rendered as desired in most browsers). You can also play with the :align: option of the image directive. Centered images are on a line of their own by default. Hope this gets you started, Günter |