diff --git a/README.md b/README.md index d94ae51..a7bb607 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# Obsidian Menus +# 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 @@ -38,11 +38,11 @@ layout: slate small [Resources](https://example.com) ``` -Without a `layout:` line, the menu uses the default layout chosen in the plugin settings. +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 before the links: +Customize any menu with `key: value` lines (put them before the links for readability): | Option | Effect | |---|---| @@ -107,7 +107,7 @@ hover-text: #0af ## Dataview Integration -Generate links dynamically from Dataview queries. Prefix your query with `dataview:` or `dv:`: +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 @@ -115,7 +115,11 @@ layout: default dataview: LIST FROM "Projects" ``` -The plugin unwraps Dataview results so links blend seamlessly into your menu layout. +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 diff --git a/main.js b/main.js index 8779af4..926cbc8 100644 --- a/main.js +++ b/main.js @@ -226,7 +226,7 @@ var MenuPluginSettingTab = class extends import_obsidian.PluginSettingTab { display() { const { containerEl } = this; containerEl.empty(); - new import_obsidian.Setting(containerEl).setName("Default layout").setDesc("Layout used when a menu block has no layout: line.").addDropdown((dropdown) => { + new import_obsidian.Setting(containerEl).setName("Default layout").setDesc("Layout used when a menu block has no layout: line, or only modifiers (small, grid).").addDropdown((dropdown) => { for (const layout of LAYOUTS) { dropdown.addOption(layout, layout.charAt(0).toUpperCase() + layout.slice(1)); } @@ -238,7 +238,7 @@ var MenuPluginSettingTab = class extends import_obsidian.PluginSettingTab { new import_obsidian.Setting(containerEl).setName("Usage guide").setHeading(); const doc = containerEl.createEl("div", { cls: "menu-settings-docs" }); doc.createEl("p", { - text: "Put one link per line in a `menu` code block. Options go before the links." + text: "Put one link per line in a `menu` code block. Options go before the links. To edit a menu in Live Preview, click the thin strip on its left edge." }); doc.createEl("h4", { text: "Example" }); const pre = doc.createEl("pre"); @@ -260,10 +260,11 @@ radius: 99px tr.createEl("td", { text: syntax, cls: "menu-settings-syntax" }); tr.createEl("td", { text: description }); }; - addRow("[[Note]]", "Opens an Obsidian note (Ctrl-click or middle-click: new tab)"); + addRow("[[Note]]", "Opens an Obsidian note (Ctrl-click or middle-click: new tab; Ctrl-hover: preview)"); addRow("[[Note|Alias]]", "Obsidian note with custom display text"); addRow("[Text](https://...)", "Opens URL in your browser"); addRow("[Text](file:///path)", "Opens a local file or folder (desktop only)"); + addRow("[Text]()", "File path containing spaces"); doc.createEl("h4", { text: "Options" }); const propTable = doc.createEl("table", { cls: "menu-settings-table" }); const addProp = (prop, values, description) => { @@ -278,7 +279,7 @@ radius: 99px addProp("hover-text / hover-bg / hover-border", "any CSS value", "Hover colors"); addProp("size / gap / radius / padding", "any CSS length", "Font size, spacing, corner rounding"); addProp("internal-* / external-* / file-*", "any CSS value", "Color or font for one link type"); - addProp("dataview: / dv:", "Dataview query", "Add links from Dataview (rest of block)"); + addProp("dataview: / dv:", "Dataview query", "Add links from Dataview; the rest of the block is the query (needs Dataview)"); } }; // Annotate the CommonJS export names for ESM import in node: diff --git a/main.ts b/main.ts index b4df663..922da9c 100644 --- a/main.ts +++ b/main.ts @@ -230,7 +230,7 @@ class MenuPluginSettingTab extends PluginSettingTab { new Setting(containerEl) .setName('Default layout') - .setDesc('Layout used when a menu block has no layout: line.') + .setDesc('Layout used when a menu block has no layout: line, or only modifiers (small, grid).') .addDropdown(dropdown => { for (const layout of LAYOUTS) { dropdown.addOption(layout, layout.charAt(0).toUpperCase() + layout.slice(1)); @@ -248,7 +248,8 @@ class MenuPluginSettingTab extends PluginSettingTab { const doc = containerEl.createEl('div', { cls: 'menu-settings-docs' }); doc.createEl('p', { - text: 'Put one link per line in a `menu` code block. Options go before the links.' + text: 'Put one link per line in a `menu` code block. Options go before the links. ' + + 'To edit a menu in Live Preview, click the thin strip on its left edge.' }); doc.createEl('h4', { text: 'Example' }); @@ -271,10 +272,11 @@ radius: 99px tr.createEl('td', { text: syntax, cls: 'menu-settings-syntax' }); tr.createEl('td', { text: description }); }; - addRow('[[Note]]', 'Opens an Obsidian note (Ctrl-click or middle-click: new tab)'); + addRow('[[Note]]', 'Opens an Obsidian note (Ctrl-click or middle-click: new tab; Ctrl-hover: preview)'); addRow('[[Note|Alias]]', 'Obsidian note with custom display text'); addRow('[Text](https://...)', 'Opens URL in your browser'); addRow('[Text](file:///path)', 'Opens a local file or folder (desktop only)'); + addRow('[Text]()', 'File path containing spaces'); doc.createEl('h4', { text: 'Options' }); const propTable = doc.createEl('table', { cls: 'menu-settings-table' }); @@ -290,6 +292,6 @@ radius: 99px addProp('hover-text / hover-bg / hover-border', 'any CSS value', 'Hover colors'); addProp('size / gap / radius / padding', 'any CSS length', 'Font size, spacing, corner rounding'); addProp('internal-* / external-* / file-*', 'any CSS value', 'Color or font for one link type'); - addProp('dataview: / dv:', 'Dataview query', 'Add links from Dataview (rest of block)'); + addProp('dataview: / dv:', 'Dataview query', 'Add links from Dataview; the rest of the block is the query (needs Dataview)'); } } diff --git a/package.json b/package.json index bde3dbc..757de71 100644 --- a/package.json +++ b/package.json @@ -1,15 +1,14 @@ { - "name": "menu-plugin", + "name": "monster-menus", "version": "2.0.0", "description": "Create custom menus using code blocks with links and CSS styling.", "main": "main.js", "scripts": { "dev": "node esbuild.config.mjs", - "build": "tsc -noEmit -skipLibCheck && node esbuild.config.mjs production", - "version": "node version-bump.mjs" + "build": "tsc -noEmit -skipLibCheck && node esbuild.config.mjs production" }, "keywords": ["obsidian", "plugin", "menu"], - "author": "Your Name", + "author": "Olivier Legendre", "license": "MIT", "devDependencies": { "@types/node": "^16.11.6",