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

Fix #11074: Can't change sphinxnote to use sphinxheavybox #11081

Merged
merged 1 commit into from Jan 3, 2023

Conversation

jfbu
Copy link
Contributor

@jfbu jfbu commented Jan 3, 2023

I have made an entry in Bugfixes, but as I commened in #11074 I did not consider the changed behavior at 5.1.0 as a bug (it would have been a regression), as it was never said explicitly one could use sphinxheavybox without precautions directly.

Memo: this allows to let sphinxnote etc... use sphinxheavybox but do not deduce one can wrap arbitrarily this way for a new environment unrelated to admonitions: under the hood there is sphinxadmonition dispatch which does some preparatory steps before the sphinxnote etc... are actually executed.

Fixes #11074

@jfbu jfbu added type:enhancement enhance or introduce a new feature builder:latex labels Jan 3, 2023
@jfbu jfbu added this to the 6.1.0 milestone Jan 3, 2023
@jfbu
Copy link
Contributor Author

jfbu commented Jan 3, 2023

I will merge this after testing completes as the ruff linting failure is unrelated. Ah @AA-Turner fixed the ruff configuration already...

@jfbu
Copy link
Contributor Author

jfbu commented Jan 3, 2023

I tested with this index.rst

====
TEST
====

NOTICES
=======

.. note::

   This is a note

.. tip::

   This is a tip

.. hint::

   This is a hint

.. important::

   This is important

.. warning::

   This is a warning

and this in conf.py

latex_elements = {
  'passoptionstopackages': '\\PassOptionsToPackage{svgnames}{xcolor}',
  'preamble': r'''
\renewenvironment{sphinxnote}[1]{\begin{sphinxheavybox}\sphinxstrong{#1} }{\end{sphinxheavybox}}
\renewenvironment{sphinxhint}[1]{\begin{sphinxheavybox}\sphinxstrong{#1} }{\end{sphinxheavybox}}
\renewenvironment{sphinximportant}[1]{\begin{sphinxheavybox}\sphinxstrong{#1} }{\end{sphinxheavybox}}
\renewenvironment{sphinxtip}[1]{\begin{sphinxheavybox}\sphinxstrong{#1} }{\end{sphinxheavybox}}
\colorlet{sphinxnoteBgColor}{yellow}
\colorlet{sphinxtipBgColor}{yellow!10}
''',
  'sphinxsetup': r'''
       div.warning_border-width=3pt,
       div.warning_padding=6pt,
       div.warning_padding-right=18pt,
       div.warning_padding-bottom=18pt,
       div.warning_border-TeXcolor={named}{DarkCyan},
       div.warning_background-TeXcolor={named}{LightCyan},
       div.warning_box-shadow=-12pt -12pt inset,
       div.warning_box-shadow-TeXcolor={named}{Cyan},
       hintborder=3pt,
       hintBorderColor=red,
       noteborder=5pt,
       noteBorderColor=blue,
'''
}

Capture d’écran 2023-01-03 à 20 10 46

@jfbu jfbu merged commit 2b2c62a into sphinx-doc:master Jan 3, 2023
@jfbu jfbu deleted the 11074_sphinxnote branch January 3, 2023 23:35
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 3, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
builder:latex type:enhancement enhance or introduce a new feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Can't change sphinxnote to use sphinxheavybox starting with 5.1.0
1 participant