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

annotation buttons' content within admonitions are not centered #4558

Closed
5 tasks done
2bndy5 opened this issue Oct 28, 2022 · 4 comments
Closed
5 tasks done

annotation buttons' content within admonitions are not centered #4558

2bndy5 opened this issue Oct 28, 2022 · 4 comments
Labels
bug Issue reports a bug resolved Issue is resolved, yet unreleased if open

Comments

@2bndy5
Copy link
Contributor

2bndy5 commented Oct 28, 2022

Contribution guidelines

I've found a bug and checked that ...

  • ... the problem doesn't occur with the mkdocs or readthedocs themes
  • ... the problem persists when all overrides are removed, i.e. custom_dir, extra_javascript and extra_css
  • ... the documentation does not mention anything about my problem
  • ... there are no open or closed issues that are related to my problem

Description

I noticed that the + (& rotated +) used for the annotations' button content is a bit off center when placed within an admonition.
image

I think this may be related to the slightly smaller font used for admonitions.

Expected behaviour

Not a huge deal, but I had expected the buttons content to align with the center of the button.

Actual behaviour

See above picture in description.

also seen in master (as of 3459540)
image

Steps to reproduce

see the insiders docs here

I should note that it still shows in master (as of 3459540)

!!! note

    ``` yaml
    # (1)
    ```

    1.  Look ma, less line noise!

Package versions

  • Python 3.10.6
  • mkdocs, version 1.4.1
  • Material master branch (3459540)

Configuration

same for this repo.

System information

  • Operating system: Windows 11
  • Browser:
    • Firefox 106.0.2 (64-bit)
    • Chrome: 107.0.5304.88
@2bndy5 2bndy5 changed the title annotation buttons's content within admonitions are not centered annotation buttons' content within admonitions are not centered Oct 28, 2022
@squidfunk
Copy link
Owner

Thanks for reporting. I've already poured several hours into trying to solve this problem some time ago, but from my current knowledge I think it's not generally solvable. It's definitely related to sub-pixel rounding issues, which is implemented differently in all browsers. Additionally, proportional fonts other than Roboto Mono might need further adjustment.

One idea I explored is to substitute the text (+ + pseudo element for the circle) with the plus icon in circle from the material icon pack, but that suffered alignment problems as well. Note that when printing, + is replaced with the number of the list item, so annotations are clearly attributable, so the icon idea only works for screen media.

I'm closing this as 'won't fix', but since you have a downstream project with very similar goals, I'm happy to merge a fix in upstream if you find a better way of implementing annotations.

@squidfunk squidfunk added bug Issue reports a bug not fixable Issue concerns an unfixable bug labels Oct 28, 2022
@2bndy5
Copy link
Contributor Author

2bndy5 commented Oct 28, 2022

Thanks for getting back. My initial "hack" would be to exempt the buttons within admonitions from the smaller font in CSS. But I haven't really played with it (yet).

@squidfunk
Copy link
Owner

You will see alignment issues in the regular font size as well, so this hack will only solve parts of the problem.

@squidfunk
Copy link
Owner

Note that this is all fixed in Insiders, and will be merged with the annotation feature once the next funding goal is hit. We switched annotations to use icons instead of the code font, which yields a much more consistent rendering.

Additionally, annotation icons can now be changed to any icon.

@squidfunk squidfunk added resolved Issue is resolved, yet unreleased if open and removed not fixable Issue concerns an unfixable bug labels Jul 4, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Issue reports a bug resolved Issue is resolved, yet unreleased if open
Projects
None yet
Development

No branches or pull requests

2 participants