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

Custom Abbreviation Tooltip Feature #4164

Open
4 tasks done
otabekoff opened this issue Aug 27, 2024 · 2 comments
Open
4 tasks done

Custom Abbreviation Tooltip Feature #4164

otabekoff opened this issue Aug 27, 2024 · 2 comments

Comments

@otabekoff
Copy link
Contributor

otabekoff commented Aug 27, 2024

Is your feature request related to a problem? Please describe.

Is your feature request related to a problem? Please describe.

Currently, VitePress provides basic support for HTML elements like <abbr> and <acronym> for displaying abbreviations. However, these elements have limitations in terms of customization and responsiveness, especially when zoomed in. The default tooltip appearance can be less than ideal, with small font sizes and limited control over styling.

In the image below, you can see VitePress displayed on a 1920x1080 screen. Initially, the page did not cover the entire screen, so it was adjusted to fit within the viewable area. To eliminate the extra space on the left and right, I zoomed in on the page.

Upon zooming, I noticed that the tag displays its title, but the tooltip does not scale correctly with the browser zoom. This issue results in the tooltip appearing smaller and less readable compared to the rest of the content.
Screenshot 2024-08-27 094915
image

Describe the solution you'd like

To get rid of this problem and in meantime to provide Vitepress a good enhancement let's implement a tooltip feature.

I propose adding a feature that allows for custom abbreviation tooltips. This feature would enable users to define tooltips with full control over their appearance and behavior, including font size, color, and positioning. It would involve creating a customizable component or directive that could be used within Markdown files to replace or enhance the default HTML <abbr> and <acronym> behavior.

Or at least a tooltip provided by default theme and enlarges with page.

Describe alternatives you've considered

  • Custom HTML/CSS: Using inline CSS in Markdown files to create tooltips. While functional, this approach is less flexible and more cumbersome to manage.
  • JavaScript Solutions: Utilizing JavaScript libraries or custom scripts to create tooltips. This approach requires additional dependencies and complexity.
  • Vue Components: Implementing a custom Vue component for tooltips. This provides flexibility but might require additional configuration and setup.

Additional context

The ability to create custom tooltips with specific styles and behavior would greatly enhance the user experience and provide a more polished look, especially when dealing with content that needs to be responsive and visually consistent.

Validations

@otabekoff
Copy link
Contributor Author

otabekoff commented Aug 27, 2024

I've created a custom component for my own use, as VitePress supports custom global Vue components. However, I believe this could be a valuable feature for others as well, so I'm sharing it here in the hopes that it might be considered for inclusion.

Here are some of my suggestions for writing custom abbreviations:

  • [HTML]{Hypertext Markup Language}
  • `abbr[HTML|Hypertext Markup Language]`
  • [HTML|Hypertext Markup Language]
  • `HTML`[Hypertext Markup Language]
  • `HTML`[Hypertext Markup Language]
  • `HTML`[[Hypertext Markup Language]]
  • HTML::Hypertext Markup Language::

Other suggestions:

  • HTML|Hypertext Markup Language|
  • HTML{Hypertext Markup Language}
  • HTML (Hypertext Markup Language)
  • HTML - Hypertext Markup Language
  • HTML/Hypertext Markup Language
  • HTML - "Hypertext Markup Language"

I thin the first suggestion which is [HTML]{Hypertext Markup Language} makes sense and fits what we want.

@vuejs vuejs deleted a comment Aug 27, 2024
@otabekoff
Copy link
Contributor Author

otabekoff commented Aug 27, 2024

Today, I found Rollup.org is using something similar what I've talked about and the style, it's awesome. But, it is only for Shiki related stuff.

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant