feat!: simplify menu layouts and options
- Three theme-aware layouts (default, minimal, slate) plus small/grid modifiers - New options: size, gap, radius, padding; per-link-type colors resolve via --mm-* variables - Remove horizon and aether layouts, wide modifier and hover-font - Fix class: menus ignoring hover colors (inline styles removed) - Fix Dataview links not joining the menu row - Wire up default layout setting - Parse <angle-bracketed> file link destinations - Internal links: Ctrl/middle-click new tab, hover preview, keyboard focus - Keep 0.5rem edit strip working with Obsidian's .embed-actions wrapper, no icon flicker
This commit is contained in:
1 parent
46dea4e8ed
commit
0f257cbace
5 files changed
+658
-1024
No files matched your search
@@ -15,36 +15,69 @@ layout: default
|
||||
```
|
||||
|
||||
The plugin supports three link types:
|
||||
- Internal: `[[Note]]` or `[[Note|Alias]]` opens notes in Obsidian
|
||||
- Internal: `[[Note]]` or `[[Note|Alias]]` opens notes in Obsidian. Ctrl-click or middle-click opens a new tab; Ctrl-hover shows the page preview.
|
||||
- Web: `[Text](https://example.com)` opens in your browser
|
||||
- File: `[Text](file:///C:/path/to/file)` opens local files or folders
|
||||
- File: `[Text](file:///C:/path/to/file)` opens local files or folders (desktop only). Use `[Text](<file:///C:/path with spaces>)` for paths with spaces.
|
||||
|
||||
## Built-in Templates
|
||||
## Layouts
|
||||
|
||||
Choose from five pre-styled layouts:
|
||||
Three built-in layouts, all following your theme's colors:
|
||||
|
||||
- `default` — balanced, general-purpose design
|
||||
- `minimal` — clean and understated
|
||||
- `slate` — darker theme with subtle borders
|
||||
- `horizon` — horizontal emphasis with gradients
|
||||
- `aether` — light and airy aesthetic
|
||||
- `default` — outlined buttons
|
||||
- `minimal` — plain text links
|
||||
- `slate` — filled chips
|
||||
|
||||
Add extra classes after the layout name:
|
||||
Add modifiers after the layout name:
|
||||
|
||||
- `small` — smaller text and padding
|
||||
- `grid` — equal-width tiles that fill the row
|
||||
|
||||
```code
|
||||
layout: horizon wide
|
||||
layout: slate small
|
||||
[[Dashboard]]
|
||||
[Resources](https://example.com)
|
||||
```
|
||||
|
||||
Without a `layout:` line, the menu uses the default layout chosen in the plugin settings.
|
||||
|
||||
## Options
|
||||
|
||||
Customize any menu with `key: value` lines before the links:
|
||||
|
||||
| Option | Effect |
|
||||
|---|---|
|
||||
| `text`, `bg`, `border` | Link colors |
|
||||
| `hover-text`, `hover-bg`, `hover-border` | Hover colors |
|
||||
| `font` | Font family (quote names with spaces: `"Work Sans"`) |
|
||||
| `size` | Font size (`0.8em`, `14px`) |
|
||||
| `gap` | Space between links |
|
||||
| `radius` | Corner rounding (`99px` for pills) |
|
||||
| `padding` | Space inside each link (`0.3em 1em`) |
|
||||
|
||||
Prefix a color or font option with `internal-`, `external-`, or `file-` to target one link type:
|
||||
|
||||
```code
|
||||
layout: minimal
|
||||
internal-text: var(--text-accent)
|
||||
external-text: #ff6600
|
||||
file-text: #0066ff
|
||||
|
||||
[[Internal Link]]
|
||||
[External Link](https://example.com)
|
||||
[File Link](file:///C:/Documents)
|
||||
```
|
||||
|
||||
Values are plain CSS: hex, rgb, hsl, gradients, or theme variables like `var(--text-accent)`.
|
||||
Aliases: `background` = `bg`, `accent` = `hover-text`, `text-hover` = `hover-text`, `bg-hover` = `hover-bg`, `border-hover` = `hover-border`.
|
||||
|
||||
## Custom Styling
|
||||
|
||||
Use your own CSS class to bypass the built-in templates entirely. The plugin only renders the HTML structure and inline CSS variables—no default styles apply.
|
||||
Use `class:` with your own class name instead of a layout. The plugin then applies no built-in styles; it renders the links and sets the options as CSS variables on the container.
|
||||
|
||||
Each link also exposes resolved variables (`--mm-text`, `--mm-bg`, `--mm-border`, `--mm-font`, `--mm-hover-text`, `--mm-hover-bg`, `--mm-hover-border`) that already apply the per-link-type options.
|
||||
|
||||
```code
|
||||
class: my-menu
|
||||
bg: #111
|
||||
text: #eee
|
||||
hover-text: #0af
|
||||
|
||||
@@ -52,8 +85,6 @@ hover-text: #0af
|
||||
[Web](https://example.com)
|
||||
```
|
||||
|
||||
Then create your own CSS snippet:
|
||||
|
||||
```css
|
||||
.menu-container.my-menu {
|
||||
display: flex;
|
||||
@@ -64,47 +95,16 @@ Then create your own CSS snippet:
|
||||
.menu-container.my-menu a {
|
||||
padding: 0.5rem 0.8rem;
|
||||
border-radius: 6px;
|
||||
color: var(--text, var(--text-normal));
|
||||
background: var(--bg, transparent);
|
||||
text-decoration: none;
|
||||
color: var(--mm-text, var(--text-normal));
|
||||
background: var(--mm-bg, transparent);
|
||||
}
|
||||
|
||||
.menu-container.my-menu a:hover {
|
||||
color: var(--hover-text, var(--text-accent));
|
||||
background: var(--hover-bg, transparent);
|
||||
color: var(--mm-hover-text, var(--text-accent));
|
||||
}
|
||||
```
|
||||
|
||||
## Style Variables
|
||||
|
||||
Override colors and fonts using YAML-like variables inside the code block. Only these whitelisted properties are supported:
|
||||
|
||||
**Global variables:**
|
||||
- `bg` — background color for buttons
|
||||
- `text` — text color
|
||||
- `border` — border color
|
||||
- `font` — font family
|
||||
- `hover-text`, `hover-bg`, `hover-border`, `hover-font` — hover state styles
|
||||
|
||||
**Per-link-type variables:**
|
||||
|
||||
Prefix any global variable with `internal-`, `external-`, or `file-` to target specific link types:
|
||||
|
||||
```code
|
||||
layout: minimal
|
||||
internal-text: #00ff00
|
||||
external-text: #ff6600
|
||||
file-text: #0066ff
|
||||
|
||||
[[Internal Link]]
|
||||
[External Link](https://example.com)
|
||||
[File Link](file:///C:/Documents)
|
||||
|
||||
```
|
||||
|
||||
**Accepted formats:**
|
||||
- Colors: hex (`#1a1a1a`), rgb, hsl, CSS variables (`var(--text-accent)`), gradients
|
||||
- Fonts: plain names or quoted for spaces (`font: "Work Sans"`)
|
||||
|
||||
## Dataview Integration
|
||||
|
||||
Generate links dynamically from Dataview queries. Prefix your query with `dataview:` or `dv:`:
|
||||
@@ -119,10 +119,11 @@ The plugin unwraps Dataview results so links blend seamlessly into your menu lay
|
||||
|
||||
## Examples
|
||||
|
||||
Template with gradient background:
|
||||
Pill buttons with a gradient:
|
||||
|
||||
```code
|
||||
layout: horizon
|
||||
layout: default
|
||||
radius: 99px
|
||||
bg: linear-gradient(45deg, #667eea, #764ba2)
|
||||
text: white
|
||||
hover-text: #ffd700
|
||||
@@ -131,13 +132,12 @@ hover-text: #ffd700
|
||||
[Projects](https://github.com)
|
||||
```
|
||||
|
||||
Custom class with theme variables:
|
||||
Compact tile grid:
|
||||
|
||||
```code
|
||||
class: my-toolbar
|
||||
text: var(--text-normal)
|
||||
hover-text: var(--text-accent)
|
||||
|
||||
layout: slate small grid
|
||||
[[Inbox]]
|
||||
[Wiki](https://example.com)
|
||||
```
|
||||
[[Projects]]
|
||||
[[Areas]]
|
||||
[[Resources]]
|
||||
```
|
||||
Reference in new issue
Block a user