You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 6c8171e
Browse filesBrowse the repository at this point in the historyBrowse files
Copy file name to clipboardExpand all lines: docs/plugins/glossary.md
+8-7Lines changed: 8 additions & 7 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -38,32 +38,33 @@ export default defineConfig({
38
38
39
39
Or wrap the config with `withGlossary` from `markdown-it-glossary/vitepress`. It plays nicely with other `withX()` wrappers.
40
40
41
-
### Touch devices
41
+
### Hover, click and tap
42
42
43
-
`<abbr title>` tooltips only appear on hover, so they never show on a phone or tablet. Call `enableGlossaryTouch()` once in the browser and tapping a term shows its definition in a small popover instead. Tapping elsewhere, scrolling, or pressing Escape dismisses it. It only activates on devices that can't hover, so desktop keeps the native tooltip.
43
+
`<abbr title>` tooltips need a mouse hover, so they never show on a phone or tablet. Call `enableGlossaryTooltips()` once in the browser and every term gets a small popover that works with any input: hover a term with a mouse (click to pin it open), or tap it on a touch screen. Tap the term again, tap elsewhere, scroll, or press Escape to dismiss it. While the popover is open the term's `title` is lifted so the browser's own tooltip doesn't show on top of it, then restored.
44
44
45
45
In VitePress, call it from your theme's `enhanceApp`:
|`selector`|`'abbr[title]'`| Which elements carry a definition in their `title`. |
63
-
|`touchOnly`|`true`| Only activate on devices that can't hover. `false` also enables it on desktop. |
63
+
|`hover`|`true`| Show on mouse hover too. `false` for click and tap only. |
64
+
|`touchOnly`|`false`| Respond to touch input only, leaving mouse users the native tooltip. |
64
65
|`injectStyles`|`true`| Inject the default popover styles. `false` lets you style `.glossary-popover`. |
65
66
66
-
The default look follows VitePress theme colors and can be overridden with the `--glossary-popover-bg`, `--glossary-popover-fg`, and `--glossary-popover-border` CSS variables. `enableGlossaryTouch()` returns a function that removes its listeners.
67
+
The default look follows VitePress theme colors and can be overridden with the `--glossary-popover-bg`, `--glossary-popover-fg`, and `--glossary-popover-border` CSS variables. `enableGlossaryTooltips()` returns a function that removes its listeners.
67
68
68
69
## Writing the glossary file
69
70
@@ -126,6 +127,6 @@ The same syntax works on a page that has _not_ opted out. A page-local definitio
126
127
|`headingLevel`|`3`| Heading level that marks a term. |
127
128
|`frontmatterKey`|`'glossary'`| Frontmatter key for the opt-out. `false` disables it. |
128
129
129
-
The plugin emits plain `<abbr title>` tags and injects no CSS. This site adds a dotted underline and a help cursor in its theme so the tooltips are discoverable.
130
+
The plugin itself emits plain `<abbr title>` tags and injects no CSS. This site adds a dotted underline in its theme so the terms are discoverable, and `enableGlossaryTooltips()` adds the popover and a pointer cursor.
130
131
131
132
[Source and full README on GitHub](https://github.com/binarynoir/markdown-it-glossary)
0 commit comments