OverLordGoldDragon
OverLordGoldDragon

Reputation: 19796

Image above title (Github README.rst)

I seek to put a centered image before the document title, but latter keeps forcing itself to top; if I insert a | between, then ====, ----, and all subsequent section headers are much smaller. No such problem in Markdown.

Can an image precede a document's title in .rst?


My approach:

.. raw:: html

    <p align="center"><img src=""></p>

Title
=====

Upvotes: 0

Views: 826

Answers (1)

Steve Piercy
Steve Piercy

Reputation: 15055

Titles and subtitles should be over- and underlined.

Also raw is not recommended. The image directive is preferred. It has an :align: center option, or can be styled with a custom CSS :class: option.

The following works for me, where the rendered HTML is <h1>Title</h1> as desired and the image above the title.

.. image:: relative-path-to/image.*
    :align: center

=====
Title
=====

Upvotes: 2

Related Questions