Files
monster-menus/README.md
T

148 lines
4.1 KiB
Markdown
Raw Permalink Blame History

This file contains invisible Unicode characters
This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# Monster Menus
Create simple, stylable menus from code blocks. Write links inside a menu code block, and the plugin renders a clean set of clickable items.
## Quick Start
Create a menu using the menu code block:
```markdown
​```menu
layout: default
[[Home]]
[[Projects|My Projects]]
[Google](https://google.com)
[Documents](file:///C:/Users/YourName/Documents)
``​`
```
The plugin supports three link types:
- 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 (desktop only). Use `[Text](<file:///C:/path with spaces>)` for paths with spaces.
## Layouts
Three built-in layouts, all following your theme's colors:
- `default` — outlined buttons
- `minimal` — plain text links
- `slate` — filled chips
Add modifiers after the layout name:
- `small` — smaller text and padding
- `grid` — equal-width tiles that fill the row
```code
layout: slate small
[[Dashboard]]
[Resources](https://example.com)
```
Without a `layout:` line (or with only modifiers, like `layout: small`), the menu uses the default layout chosen in the plugin settings.
## Options
Customize any menu with `key: value` lines (put them before the links for readability):
| 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 `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
text: #eee
hover-text: #0af
[[Home]]
[Web](https://example.com)
```
```css
.menu-container.my-menu {
display: flex;
gap: 0.5rem;
flex-wrap: wrap;
}
.menu-container.my-menu a {
padding: 0.5rem 0.8rem;
border-radius: 6px;
text-decoration: none;
color: var(--mm-text, var(--text-normal));
background: var(--mm-bg, transparent);
}
.menu-container.my-menu a:hover {
color: var(--mm-hover-text, var(--text-accent));
}
```
## Dataview Integration
Generate links from a Dataview query (requires the Dataview plugin). Start the query with `dataview:` or `dv:`. Everything after that line is part of the query, so put it last:
```code
layout: default
[[Home]]
dataview: LIST FROM "Projects"
```
Dataview's links join the menu row and take the layout's style. Per-link-type options apply too: note links count as `internal-`, everything else as `external-`.
## Editing a Menu
In Live Preview, clicking a menu link follows it instead of opening the code block. The code block's border and `</>` button are hidden; to edit the menu, click the thin strip (0.5rem) on the menu's left edge. The cursor changes to a question mark over it.
## Examples
Pill buttons with a gradient:
```code
layout: default
radius: 99px
bg: linear-gradient(45deg, #667eea, #764ba2)
text: white
hover-text: #ffd700
[[Dashboard]]
[Projects](https://github.com)
```
Compact tile grid:
```code
layout: slate small grid
[[Inbox]]
[[Projects]]
[[Areas]]
[[Resources]]
```