Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[docs] add icons to admonition titles #12486

Merged
merged 5 commits into from
Jun 27, 2024

Conversation

chrisjsewell
Copy link
Member

@chrisjsewell chrisjsewell commented Jun 27, 2024

and also replace ad-hoc "more" icon in quickstart, with using seealso admonition

see e.g.: https://sphinx--12486.org.readthedocs.build/en/12486/usage/installation.html


before:

image

after:

image

and also replace ad-hoc "more" icon in quickstart, with using `seealso` admonition
@chrisjsewell chrisjsewell requested a review from jayaddison June 27, 2024 20:25
@chrisjsewell chrisjsewell changed the title [docs] add icons for admonitions [docs] add icons to admonition titles Jun 27, 2024
Comment on lines -311 to -314

.. |more| image:: /_static/more.png
:align: middle
:alt: more info
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This code removal puzzled me for a few moments; now I understand it's removal of a substitution definition that is no-longer-used on the page (a bit like an unused import).

@chrisjsewell chrisjsewell requested a review from jayaddison June 27, 2024 21:02
Copy link
Contributor

@jayaddison jayaddison left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me 👍

@chrisjsewell chrisjsewell merged commit 953c009 into sphinx-doc:master Jun 27, 2024
7 checks passed
@chrisjsewell chrisjsewell deleted the admonition-icons branch June 27, 2024 21:06
@jfbu
Copy link
Contributor

jfbu commented Jul 1, 2024

+1 I will copy these settings (which adds to #12439) and make them default for admonitions in PDF output (perhaps not yet for the icons, which however is possibly via fontawesome5 LaTeX package I think). Although the possibility exists since 5.1.0 and 6.2.0 for user to customize rendering of admonitions, the defaults for PDF have remained the rather boring legacy old ones so far. A LaTeX interface has to be added for the coloured title. As I said icons are possible too, but add a font dependency. As you use HSB this will gave us an excuse to make Sphinx require xcolor LaTeX package which helps simplify a bit some internal code which tested whether xcolor was available or not.

jfbu added a commit to jfbu/sphinx that referenced this pull request Jul 3, 2024
The colours, and also most icons, are emulated from the recent
sphinx13.css update (PR sphinx-doc#12486, PR sphinx-doc#12439).
@jfbu
Copy link
Contributor

jfbu commented Jul 4, 2024

@chrisjsewell I have tried to transfer this to PDF at #12508.

I tried to use exact same choices for the colours of title rows.

For the icons also I followed choices here except I was not able to find the fontawesome5 name for "spark" (used by caution and danger, so I used a "radiation" icon) and besides I used a "skull-crossbones" for error admonition in place of a "times-circle".

I am making this comment here to ask what you would think of using shapes such as lightbulb rather than question mark for hint and info-circle for tip, and of using share for seealso ? I was told the pydata theme does something like that or similar (and actually their RTD home has a Seealso with the "share" icon I was hinting at).

@chrisjsewell
Copy link
Member Author

Yeh cheers, I'm certainly open to suggestions 👍

@chrisjsewell
Copy link
Member Author

chrisjsewell commented Jul 4, 2024

The icons I used were simply copy/pasted from furo, if I recall correctly

@jfbu
Copy link
Contributor

jfbu commented Jul 4, 2024

ok, things for me are simple for PDF output I only need to use the name of an icon as provided by LaTeX fontawesome5 package, I am not using svg images.

and those names are those in use at https://fontawesome.com/search

jfbu added a commit to jfbu/sphinx that referenced this pull request Jul 6, 2024
- The colours, and also most icons, are emulated from the recent
  sphinx13.css update (PR sphinx-doc#12486, PR sphinx-doc#12439).

- Add iconpackage key to sphinxsetup key of latex_elements
  fontawesome5 is used if available, else fall-back to fontawesome.
  If none is available, drop icons and shift titles left.
  In all cases, div.<type>_title-icon keys allow user to set
  arbitrary code to be used.

- Defaults for padding and border-widths of admonitions have been
  changed, now that they all acquire a default background colour.
  The defaults always have horizontal padding plus border-width
  add up to 12.5pt, so contents of all types align exactly vertically.
  Or course user can specify arbitrary values.

- The code inserting the coloured title-row incorporates a work-around
  to a feature of TeX vertical lists when they start with for example
  a colour special.  It would not be necessary with LaTeX of 2023-06-01
  and newer. cf Improve spacing at top of minipages in
  https://www.latex-project.org/news/latex2e-news/ltnews37.pdf
@AA-Turner AA-Turner added this to the 7.4.0 milestone Jul 13, 2024
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 14, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants