vuejs / vitepress

Vite & Vue powered static site generator.
https://vitepress.dev
MIT License
12.55k stars 2.05k forks source link

Custom Abbreviation Tooltip Feature #4164

Open otabekoff opened 2 weeks ago

otabekoff commented 2 weeks ago

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

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 commented 2 weeks ago

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:

Other suggestions:

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

otabekoff commented 2 weeks ago

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